Routing dynamic numeric slug to custom template

The easiest way is to simply create a custom rewrite endpoint. This is a two-fer. It will create our actual permalink structure and our query var in one go.

Do note that after creating the below you will need to resave permalinks: Settings -> Permalinks -> save button.

/**
 * Create Careers Endpoint
 * 
 * @return void
 */
function prefix_careers_endpoint() {

    add_rewrite_endpoint(
        'careers',  // Permalink Endpoint
        EP_PAGES,   // Use `EP_ROOT` for more complex permalink strucures such as `careers/job`
        'jobid'     // Custom Query Var ( if not passed, defaults to Endpoint - first parameter `careers` )
    );

}
add_action( 'init', 'prefix_careers_endpoint' );

Next we can check the global $wp_query object for the query var’s existence. If it exists we’ll switch out the current template with one of our own choosing. In this case it will look for in the theme endpoint-careers.php.

/**
 * Include template if query var exists
 * 
 * @param String $template
 * 
 * @return String $template
 */
function prefix_careers_template( $template ) {

    global $wp_query;

    // Ensure our `jobid` query var exists and is not empty
    if( '' !== $wp_query->get( 'jobid' ) ) {

        // Ensure our template file exists
        if( '' !== ( $new_template = locate_template( 'endpoint-careers.php' ) ) ) {
            $template = $new_template; // Assign templae file path from conditional
        }

    }

    return $template;

}
add_filter( 'template_include', 'prefix_careers_template' );

Finally, inside our custom template file endpoint-careers.php after get_header() we can create and call a custom function prefix_get_data() which will grab the jobid from the global $wp_query and do a wp_remote_get() against your API passing in the Job ID. This will hopefully return useful data we can then use in the template.

/**
 * Return data from external API
 * 
 * @param Integer $jobid
 * 
 * @return Array
 */
function prefix_get_data( $jobid = 0 ) {

    global $wp_query;

    $jobid = ( ! empty( $jobid ) ) ? $wp_query->get( 'jobid', $jobid ) : $jobid;

    $response = wp_remote_get( 'http://foobar.url', array(
        'body' => array(
            'jobid' => $jobid,
        )
    ) );

    return json_decode( $response );

}

Calling it as $data = prefix_get_data(). You may need to modify this function depending on what your API expects to get and what the API returns. You could even create a custom class with with intuitive methods to handle and call your data. The possibilities are endless!