To extract public LinkedIn profile data as JSON, send the profile URL to a LinkedIn profile API with your API key, check the status in the response, save the profile object, and retry only the outcomes that are temporary. This developer guide walks through that whole path once, from the first key to a stored record with error handling, using the same request in cURL, Python and Node.js.
If you first want the concepts (what the public view is, what a profile API returns and why no login is involved), read what a LinkedIn profile API is. This guide assumes that and gets to work.
Key takeaways
- Five steps cover it. Key, request, parse, store, handle errors. Everything else is a variation on these.
- Read
statusbeforeprofile. A 200 can carryok,goneorunavailable; onlyokhas a profile, and onlyokcosts a credit. - Store the raw JSON next to your columns. The schema is fixed, so a JSON column plus a few extracted fields is easy to query and easy to re-map later.
- Retry by status code, not by habit.
429and503tell you how long to wait;401,402and422will fail again until you fix something.
What you are building
The finished code takes a LinkedIn profile URL and leaves a row in a database. It is short, because the API does the hard part: reading the public profile live and returning a fixed set of keys.
| Stage | Input | Output | Where it can fail |
|---|---|---|---|
| 1. Key | Sign-up | PROFILEHUNT_KEY in your environment | Key in front-end code |
| 2. Request | Profile URL | HTTP response | 401, 422, 429, 5xx |
| 3. Parse | Response body | status and profile | Treating gone as an error |
| 4. Store | profile object | A row keyed by public_id | Overwriting good data with null |
| 5. Errors | Failed attempt | A retry or a clear failure | Retrying what will never succeed |

The workflow, step by step
Step 1: Get an API key and keep it server-side
Sign in at profilehunt.dev/login. Your first sign-in creates a workspace with a key named Default, plus free credits: 100 with a work email, 10 with a personal one. Copy the key and put it in an environment variable:
export PROFILEHUNT_KEY="your-key-here"
Call the API from a server, a script or a tool like n8n, never from a web page: a key in front-end code is readable by anyone. The authentication docs cover keys per workspace and revoking a leaked key.
Step 2: Send one request
The request is a POST to https://api.profilehunt.dev/v1/profile with a JSON body holding one URL. The payload is the same in every language: { "url": "https://www.linkedin.com/in/williamhgates" }.
cURL:
curl -X POST https://api.profilehunt.dev/v1/profile \
-H "Authorization: Bearer $PROFILEHUNT_KEY" \
-H "Content-Type: application/json" \
-d '{ "url": "https://www.linkedin.com/in/williamhgates" }'
Python, with requests:
import os, requests
res = requests.post(
"https://api.profilehunt.dev/v1/profile",
headers={"Authorization": f"Bearer {os.environ['PROFILEHUNT_KEY']}"},
json={"url": "https://www.linkedin.com/in/williamhgates"},
)
body = res.json()
Node.js 18 or later, with the built-in fetch:
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 body = await res.json();
The call waits while the profile is read, usually a few seconds. If you prefer, x-api-key: <key> works in place of the Authorization header.
Step 3: Parse the response, status first
A successful call answers HTTP 200 with one of three statuses. Branch on status before you touch profile:
if body["status"] == "ok":
profile = body["profile"]
current = [e for e in profile["experience"] if e["end_date"] is None]
print(profile["full_name"], profile["headline"], [e["company"] for e in current])
elif body["status"] == "gone":
print("No public profile at this URL") # not charged; don't retry
else: # "unavailable"
print("LinkedIn didn't serve it just now") # not charged; retry later
Every key in profile is always present. A value the profile doesn't show publicly is null, an empty list is [], so profile["experience"] never raises a KeyError. Current roles are the ones with end_date: null, and a person can have several. For what each key holds, see the LinkedIn profile JSON schema; for how each part of the profile page maps to those keys, see how a profile URL becomes JSON.
Step 4: Store the profile
Keep a few columns you query often and the full object beside them. This uses SQLite from Python's standard library (sqlite3 docs); the same table shape works in Postgres with a jsonb column.
import json, sqlite3
db = sqlite3.connect("profiles.db")
db.execute("""CREATE TABLE IF NOT EXISTS profiles (
public_id TEXT PRIMARY KEY, full_name TEXT, headline TEXT, current_company TEXT,
country TEXT, followers INTEGER, scraped_at TEXT, raw TEXT)""")
def save(p):
current = next((e for e in p["experience"] if e["end_date"] is None), None)
db.execute("INSERT OR REPLACE INTO profiles VALUES (?,?,?,?,?,?,?,?)", (
p["public_id"], p["full_name"], p["headline"],
current["company"] if current else None,
p["country"], p["followers"], p["scraped_at"], json.dumps(p)))
db.commit()
public_id is the profile name from the URL you sent, so it makes a natural key. scraped_at records when the profile was read, which you will want when deciding what to refresh. For the service module, job queue and table design around this in a larger app, see integrating a LinkedIn profile API with a custom backend.
Step 5: Handle errors and retries
Anything other than HTTP 200 is an error with a JSON body such as { "error": "rate_limited" }, and none of them use a credit. Some are worth retrying and some are not:
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
async function fetchProfile(url, attempts = 3) {
for (let i = 0; i < attempts; i++) {
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 }),
});
if (res.ok) return res.json(); // { status, profile }
if (res.status === 429 || res.status === 503) {
await sleep(Number(res.headers.get("Retry-After") ?? 5) * 1000);
} else if ([500, 502, 504].includes(res.status)) {
await sleep(2 ** i * 1000);
} else {
const { error } = await res.json(); // 401, 402, 422: fix, don't retry
throw new Error(`${res.status} ${error}`);
}
}
throw new Error(`Gave up on ${url}`);
}
| HTTP | Error code | What to do |
|---|---|---|
401 | unauthorized | Check the key; retrying won't help |
402 | insufficient_credits | Top up, then retry |
422 | invalid_url | Not a linkedin.com/in/ URL; fix the input |
429 | rate_limited | Wait the seconds in Retry-After |
500, 502, 504 | internal, upstream_failed, timeout | Wait a few seconds, back off |
503 | temporarily_unavailable | Wait the seconds in Retry-After |
The errors reference has the full table, and response status handling for failed lookups turns it into a retry matrix with back-off in JavaScript and Python. The Retry-After header is standard HTTP, defined in RFC 9110.
Real Results: one call, one payload
The request above, for williamhgates, returns this (shortened):
{
"status": "ok",
"profile": {
"public_id": "williamhgates",
"full_name": "Bill Gates",
"headline": "Chair, Gates Foundation and Founder, Breakthrough Energy",
"location": "Seattle, Washington, United States",
"country": "US",
"experience": [
{ "company": "Gates Foundation", "title": "Co-chair", "start_date": "2000", "end_date": null },
{ "company": "Breakthrough Energy", "title": "Founder", "start_date": "2015", "end_date": null },
{ "company": "Microsoft", "title": "Co-founder", "start_date": "1975", "end_date": null }
],
"followers": 40725248,
"connections": 8,
"creator": true,
"badges": ["Creator", "Top Voice"],
"last_post_at": "2026-10-12T20:10:59.000Z",
"scraped_at": "2026-10-13T09:00:00.000Z"
}
}
Two things in this one payload are worth noticing. All three roles have end_date: null, so "the current job" is a list, not a single value. And connections is 8 while followers is over 40 million: for well-known people, followers is the reach number to use.
What Most Guides Get Wrong About Extracting LinkedIn Profile JSON
They treat every non-ok answer as an error. gone is a final, correct answer: there is no public profile at that URL. Retrying it wastes time. Mark the record and move on.
They check whether keys exist. With a fixed schema, the checks belong on values: null for "not shown publicly", [] for "none listed".
They assume one current role. Founders, board members and advisers often list several roles with no end date. Pick the one you need by rule (first listed, or a company you match on), not by assuming index 0 is the job.
They loop single calls over a list. Single calls are for one profile needed now. For a list, the batch API takes up to 100 URLs in one request and counts as one request against the limit.
Myth vs Reality
| Myth | Reality |
|---|---|
| "You need a LinkedIn account or session cookie to get profile JSON." | ProfileHunt reads the public view and never uses your LinkedIn account, cookie or Sales Navigator seat. |
| "A 200 response means you got a profile." | A 200 can be ok, gone or unavailable; only ok has a profile. |
| "Failed lookups still cost money." | Only ok uses a credit. gone, unavailable and every error are free. |
| "Profile JSON includes an email if you're lucky." | Email and phone are never in the public view, so they are never in the response. |
| "Cached data is fine for a first build." | Every call reads the profile live; scraped_at shows exactly when. Caching is your choice, made in your own table. |

Advanced: Refreshing Stored Profiles on Purpose
Once profiles are stored, the real engineering question is when to read them again. Each refresh is a live read that uses a credit when the profile is found, so refresh by signal, not on a fixed loop over everything.
- Order by
scraped_at. Refresh the oldest rows first, and give important segments (open deals, active candidates) a shorter interval than the long tail. - Use activity as a hint.
last_active_atis the newest oflast_post_at,last_reaction_atandlast_comment_at. People who are active are more likely to have changed their headline or role. - Don't overwrite with
nullblindly. If a member hides a section, the new read returnsnullfor it. Decide per column whethernullmeans "clear it" or "keep the last known value", and keep the raw JSON of each read if history matters. - Key on the URL you sent.
public_idcomes from the URL in the request. If a member changes their vanity URL, the old URL can come backgone; store the URL with the row so you can see why. - Move scheduled refreshes to batches. A nightly job of a few thousand rows fits the batch API's 100 URLs per request; polling a batch doesn't count against the 60 requests a minute per key.
Where ProfileHunt Fits
ProfileHunt is the API this guide calls: a public LinkedIn profile URL in, the same JSON keys out, every time. It reads the profile live on each call, needs no LinkedIn login, and charges one credit only when a profile is found: $0.50 per 1,000 profiles, with no subscription and credits that never expire.
It returns the public view: what a logged-out visitor sees. That means no email or phone, no titles for past roles, and connections capped at 500. If your product needs those, you need a different kind of source; for everything the public profile shows, this is the shortest path from URL to stored record.
Getting Started
Create a key at profilehunt.dev/login (100 free credits with a work email), run the cURL call from Step 2, then follow the quickstart to wire it into your code. When you are working through lists, move to batches. For the bigger picture of where this fits, go back to what a LinkedIn profile API is.
Frequently asked questions
How do I get LinkedIn profile data as JSON with Python?
Send a POST to https://api.profilehunt.dev/v1/profile with requests, your key in the Authorization: Bearer header and {"url": "<profile url>"} as the JSON body. Read res.json()["status"]; when it is ok, the profile is in res.json()["profile"].
How do I call a LinkedIn profile API from Node.js?
Node.js 18 and later have fetch built in. Post the profile URL as JSON with an Authorization: Bearer header, then await res.json() and branch on status. No SDK is needed.
What should I do when a LinkedIn profile returns gone?
Treat it as a final answer: there is no public profile at that URL, it isn't charged, and retrying won't change it. Mark the record so you don't look it up again.
Which LinkedIn profile API errors should I retry?
Retry 429 and 503 after the seconds in Retry-After, and 500, 502 and 504 after a short back-off. Don't retry 401, 402 or 422 until you've fixed the key, the credits or the URL. Retry unavailable later rather than straight away.
Can I extract LinkedIn profile data without a LinkedIn account?
Yes. ProfileHunt reads the public view of the profile and never uses your LinkedIn account, cookie or seat. You sign up with an email and use an API key.


