To call a LinkedIn profile API from Node.js, use the fetch that ships with Node 18 and later: POST the profile URL as JSON to https://api.profilehunt.dev/v1/profile, send your API key from an environment variable in the Authorization header, and read status and profile from the JSON that comes back. No SDK and no npm package are needed. This guide covers that one call properly: the key, the request, the errors, and a TypeScript type for the result.
If you want the concepts first, read what a LinkedIn profile API is, then come back for the code.
Key takeaways
- Node 18+ needs no dependencies.
fetchis global, so the whole call is about ten lines. - The key lives in
process.env. Never hard-code it and never ship it to a browser. - HTTP 200 is not the whole answer. Check the body's
status:ok,goneorunavailable. Onlyokcosts a credit. - Errors are typed by HTTP status.
401,402,422and429each need a different reaction, and none of them is charged.
Call the API from Node.js in four steps
The steps below go from an empty folder to a function you can import anywhere in a Node.js backend.
Step 1: Check your Node.js version
node --version
Anything from v18 up has a global fetch (MDN's Fetch API reference describes it; Node uses the same interface). On Node 16 or older you would need a package such as node-fetch; upgrading is the better fix, as those versions no longer get security updates.
Save the code in a file ending in .mjs (or set "type": "module" in package.json) so you can use await at the top level.
Step 2: Put the API key in an environment variable
Sign in at profilehunt.dev/login, copy the key from the Keys page, and expose it to Node:
export PROFILEHUNT_KEY="your-key-here"
On Node 20.6 or later you can keep it in a .env file instead and start the script with node --env-file=.env profile.mjs (see the Node.js CLI docs). Add .env to .gitignore; storing credentials for a profile API covers production secret stores too. The authentication docs cover the two accepted headers: Authorization: Bearer <key> or x-api-key: <key>.
Step 3: Send the request
This is the Node.js sample from the ProfileHunt docs, unchanged:
const res = await fetch("https://api.profilehunt.dev/v1/profile", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.PROFILEHUNT_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ url: "https://www.linkedin.com/in/williamhgates" }),
});
const { profile } = await res.json();
console.log(profile.full_name, profile.headline, profile.last_post_at);
The call waits while the profile is read live, usually a few seconds. For the sample URL it prints:
Bill Gates Chair, Gates Foundation and Founder, Breakthrough Energy 2026-10-12T20:10:59.000Z
That one response used one credit, which is $0.0005 at $0.50 per 1,000 profiles.
Step 4: Handle statuses and errors
The sample above assumes success. Production code needs to separate three cases: a profile was found, no profile was found, and the request itself failed. Wrap the call in a function that makes those cases explicit:
const API_URL = "https://api.profilehunt.dev/v1/profile";
export async function getProfile(url) {
const res = await fetch(API_URL, {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.PROFILEHUNT_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ url }),
});
if (res.status === 429) {
const wait = Number(res.headers.get("retry-after") ?? 5);
await new Promise(r => setTimeout(r, wait * 1000));
return getProfile(url);
}
if (!res.ok) {
const { error } = await res.json().catch(() => ({ error: "unknown" }));
throw new Error(`ProfileHunt ${res.status}: ${error}`);
}
const body = await res.json();
return body; // { status: "ok", profile } or { status: "gone" | "unavailable", profile: null }
}
Then branch on status where you use it:
const result = await getProfile("https://www.linkedin.com/in/williamhgates");
if (result.status === "ok") saveProfile(result.profile);
else if (result.status === "gone") markNoPublicProfile();
else scheduleRetry(); // "unavailable": LinkedIn didn't serve it just then
Here is what each outcome means for your code. The full table is in the errors reference.
| Outcome | What your code should do | Credit |
|---|---|---|
200, status: "ok" | Use profile | 1 |
200, status: "gone" | Mark the record; don't retry | 0 |
200, status: "unavailable" | Retry later, not straight away | 0 |
401 unauthorized | Fix the key; retrying won't help | 0 |
402 insufficient_credits | Stop and top up | 0 |
422 invalid_url | The input isn't a linkedin.com/in/ URL; fix the data | 0 |
429 rate_limited | Wait Retry-After seconds, then retry | 0 |
500, 502, 504 | Retry after a few seconds, with back-off | 0 |
503 | Wait Retry-After seconds, then retry | 0 |
For a deeper retry matrix with exponential back-off, see response status handling for failed profile lookups.

Add a TypeScript type for the response
The response is a discriminated union on status, which TypeScript handles well: once you check status === "ok", the compiler knows profile is not null.
type ProfileResult =
| { status: "ok"; profile: Profile }
| { status: "gone" | "unavailable"; profile: null };
type Profile = {
public_id: string;
profile_url: string;
full_name: string | null;
headline: string | null;
location: string | null;
country: string | null;
followers: number | null;
connections: number | null;
last_post_at: string | null;
scraped_at: string;
// …plus experience, education, recent_posts and the rest
};
export async function getProfile(url: string): Promise<ProfileResult> {
// same body as the JavaScript version
}
This trimmed Profile is enough for a first call. The complete type, with every field including experience, education, posts, articles, reactions and comments, is in how to parse LinkedIn profile API responses in JavaScript, along with null handling and dates.
What Most Guides Get Wrong
They add an HTTP library you don't need. Many Node.js examples start with npm install axios. Since Node 18, fetch covers a JSON POST with headers, and it matches the browser API you may already know.
They treat HTTP 200 as success. With ProfileHunt, a profile that doesn't exist is still a 200, with status: "gone" and profile: null. Code that reads profile.full_name without checking status crashes on the first deleted profile in a list.
They retry everything the same way. Retrying a 401 or 422 will never work, and retrying unavailable immediately usually returns the same answer. Each outcome has its own rule, shown in the table above.
Myth vs Reality
| Myth | Reality |
|---|---|
| "You need an official SDK to call a LinkedIn profile API from Node.js." | It's one HTTPS POST with a JSON body. fetch is the SDK. |
| "A failed lookup still costs a credit." | gone, unavailable and every error response are free. Only a found profile uses a credit. |
| "Calling the API from React is fine if the key is in an env var." | Front-end env vars are bundled into the page, where anyone can read them. Call the API from your server. |
| "You need your LinkedIn login to get profile data in code." | ProfileHunt reads the public profile view and never uses your LinkedIn account, cookie or seat. |
Advanced: Timeouts and Concurrency in a Long-Running Service
Two settings matter once getProfile runs inside a server rather than a one-off script.
Give the request a timeout. fetch has no timeout by default. Pass signal: AbortSignal.timeout(60_000) in the options so a stalled connection can't hold a request handler open forever. Keep it generous, since a live profile read takes a few seconds, and treat an abort like a 504: free and safe to retry.

Respect 60 requests a minute per key. Promise.all over 500 URLs will hit 429 within the first minute. Two patterns work:
- Cap concurrency with a small worker pool (five or ten in flight) and let the
429branch absorb the occasional overflow. TheX-RateLimit-Remainingheader tells you how many requests are left in the current minute; the rate limit docs explain the clock-minute window. - Switch to the batch API for lists. One batch request carries up to 100 URLs and counts as a single request, and polling it isn't rate limited. The Node.js enrichment workflow shows the full script.
Use a separate key per service, too. Keys in a workspace share its credits, but the Usage page shows which key made each request, so a misbehaving worker is easy to trace and revoke.
Where ProfileHunt Fits
ProfileHunt is a LinkedIn Profile API: public LinkedIn profile URL in, JSON out. From Node.js that's one fetch call with a stable response shape, where every key is always present, so your code checks for null instead of missing keys.
Pricing is $1 for 2,000 credits, one credit per profile found, with no subscription and credits that never expire. It returns the public view: what a logged-out visitor sees. It does not return emails or phone numbers, titles for past roles, or a connections number above 500.
Getting Started
- Sign in at profilehunt.dev/login. A work email gets 100 free credits, a personal one gets 10.
- Copy your key and run the Step 3 sample with your own profile URL.
- Follow the quickstart for the same call in cURL and Python.
Once that works, the LinkedIn profile API overview explains what the data covers and where it comes from.
Frequently asked questions
Can I call the ProfileHunt API with axios instead of fetch?
Yes. Any HTTP client that can send a JSON POST with a header works, including axios, got and undici. On Node 18 and later, the built-in fetch does the same job with no extra dependency.
Does the LinkedIn profile API work with Node 16?
Node 16 has no global fetch, so you would need a package such as node-fetch. Upgrading to a supported Node.js version (18 or later) is the cleaner fix, and the API itself doesn't care which client sends the request.
Why does my Node.js request return 401?
The API key is missing, wrong or revoked. Check that process.env.PROFILEHUNT_KEY is actually set in the process making the call (console.log(!!process.env.PROFILEHUNT_KEY)), and that the header reads Bearer <key> with a space.
How do I use the LinkedIn profile API in TypeScript?
Type the response as a union on status: { status: "ok"; profile: Profile } or { status: "gone" | "unavailable"; profile: null }. The full Profile type is in the JavaScript parsing guide.
Can I call the LinkedIn profile API from Next.js?
Yes, from server code: a Route Handler, a Server Action or any server component. Keep the key in a server-only environment variable and never in a NEXT_PUBLIC_ one, which is bundled into the browser.


