Skip to main content

Overview

Fetch full details for a single LinkedIn job by ID or URL. Useful for getting descriptions, seniority level, and other metadata without running a full search. This is a specialized function for LinkedIn. For a universal function that works with all supported sites, see fetchJobDetails().

Signature

async function fetchLinkedInJob(
  jobIdOrUrl: string,
  options?: {
    format?: string;
    proxies?: string | string[];
  }
): Promise<LinkedInJobDetails>

Parameters

jobIdOrUrl
string
required
LinkedIn job ID (e.g. "4127292817") or full URL (e.g. "https://www.linkedin.com/jobs/view/4127292817")The function automatically extracts the job ID from URLs, so both formats work.
options
object
Optional configuration object
options.format
string
default:"markdown"
Description format:
  • "markdown" — converts HTML to Markdown (default)
  • "html" — preserves original HTML
  • "plain" — strips all markup
options.proxies
string | string[]
Proxy server(s) for the request. Accepts formats:
  • "host:port"
  • "user:pass@host:port"
  • "http://host:port"
  • "socks5://host:port"
Multiple proxies rotate round-robin.

Return Value

Returns a LinkedInJobDetails object with the following fields:
job_url
string
Canonical LinkedIn job URL (e.g. "https://www.linkedin.com/jobs/view/4127292817")
description
string
Full job description, formatted according to the format option
job_level
string
Seniority level (e.g. "mid-senior level", "entry level", "director")
job_type
string[]
Array of employment types (e.g. ["fulltime"], ["contract", "parttime"])
job_function
string
Job function category (e.g. "Engineering", "Product Management")
company_industry
string
Company industry classification (e.g. "Software Development", "Financial Services")
Company logo image URL
job_url_direct
string
Direct employer/ATS application URL (if available)

Examples

Fetch by Job ID

import { fetchLinkedInJob } from "jobspy-js";

const job = await fetchLinkedInJob("4127292817");

console.log(job.description);
console.log(job.job_level);        // "mid-senior level"
console.log(job.job_type);         // ["fulltime"]
console.log(job.company_industry); // "Software Development"
console.log(job.job_url_direct);   // direct application URL

Fetch by URL

import { fetchLinkedInJob } from "jobspy-js";

const job = await fetchLinkedInJob(
  "https://www.linkedin.com/jobs/view/4127292817"
);

console.log(job.description);

With Plain Text Format

const job = await fetchLinkedInJob("4127292817", {
  format: "plain",
});

// Description will have all markup stripped
console.log(job.description);

With Proxy

const job = await fetchLinkedInJob("4127292817", {
  format: "html",
  proxies: "user:[email protected]:8080",
});

With Multiple Proxies

const job = await fetchLinkedInJob("4127292817", {
  proxies: [
    "user:[email protected]:8080",
    "user:[email protected]:8080",
  ],
});

Extract Job ID from Search Results

import { scrapeJobs, fetchLinkedInJob } from "jobspy-js";

// First, search for jobs
const searchResult = await scrapeJobs({
  site_name: "linkedin",
  search_term: "software engineer",
  location: "San Francisco, CA",
  results_wanted: 5,
});

// Then fetch full details for each job
for (const job of searchResult.jobs) {
  // Extract ID from URL
  const jobId = job.job_url.split("/").pop()?.split("?")[0];
  
  if (jobId) {
    const details = await fetchLinkedInJob(jobId);
    console.log(`${job.title}: ${details.job_level}`);
  }
}

Error Handling

try {
  const job = await fetchLinkedInJob("4127292817");
  console.log(job.description);
} catch (err) {
  console.error("Failed to fetch job:", err);
}

Notes

  • This function initializes a new LinkedIn session for each call
  • The session is automatically closed after fetching
  • For bulk operations, consider using scrapeJobs() with linkedin_fetch_description: true instead
  • Job IDs are extracted from URLs by taking the last segment before any query parameters

Build docs developers (and LLMs) love