LINKEDIN PROFILE API

Secure API Authentication for LinkedIn Profile Enrichment

A secure API authentication pattern for LinkedIn profile data enrichment: server-side keys, a backend proxy, a key per environment and safe rotation.

By Surender Kumar, GTM Engineer, ProfileHunt · Published · 9 min read

Also in: Español · Português (Brasil) · Deutsch · Français · 简体中文 · हिन्दी · العربية · বাংলা · Русский · Bahasa Indonesia · اردو · 日本語 · मराठी · Tiếng Việt · తెలుగు · Hausa · Türkçe · தமிழ் · 한국어

Secure API Authentication for LinkedIn Profile Enrichment

The secure API authentication pattern for LinkedIn profile data enrichment is simple to state: the API key lives only on a server you control, your users and front ends talk to your server, and your server talks to the profile API. Add one key per environment or tool, and rotate by creating a new key before revoking the old one. With ProfileHunt the key travels in Authorization: Bearer <key>, and everything in this post is about where that header gets added and who can see it. For what the API itself does, see what a LinkedIn profile API is.

Key takeaways

  • The key never ships to a client. Not in a web page, a mobile app or a browser extension. Anything a user's device holds, the user can read.
  • Your backend is the gatekeeper. A small proxy endpoint checks your own user, validates the URL, adds the key and returns only the fields the client needs.
  • One key per environment and tool. Each key has its own 60-requests-a-minute limit, its own "Last used" date and can be revoked alone.
  • Rotation is create, deploy, verify, revoke. A workspace can hold several active keys, so the switch needs no downtime, and a revoked key gets 401.
  • Least privilege applies to people too. Workspace members can't see key values; only owners and admins can.

Why the key belongs on the server

A ProfileHunt key spends the workspace's credits. Anyone holding it can run lookups that your workspace pays for, so it gets the same treatment as a database password.

The API backs this up. Browsers can only call it from the ProfileHunt dashboard; a call from your own web page is blocked by CORS. That is a guard rail, not the security model. CORS stops a browser from reading the response, but a key in your JavaScript bundle is still in plain view, and a script outside the browser doesn't care about CORS at all.

Where the call runsKey exposureVerdict
Your backend or serverless functionOnly your serversUse this
A scheduled job or scriptOnly the machine running itUse this
n8n, Make, Zapier or ClayThe tool's settings, visible to its editorsFine, with a key of its own
Browser JavaScriptAnyone who opens dev toolsNever
Mobile app binaryAnyone who unpacks the appNever
Browser extensionAnyone who installs itNever

Blocks entering a closed box with one pipe leaving it

The backend proxy pattern

When a user-facing app needs profile data, put a thin endpoint of your own between the client and ProfileHunt. The client calls your endpoint with your app's normal session; your endpoint calls ProfileHunt with the key.

// Your endpoint, e.g. POST /api/enrich. requireUser() is your app's own session check.
export async function POST(req) {
  const user = await requireUser(req);
  const { url } = await req.json();
  if (typeof url !== "string" || !/linkedin\.com\/in\//i.test(url)) {
    return Response.json({ error: "invalid_url" }, { status: 422 });
  }

  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 Response.json({ error: "lookup_failed" }, { status: 502 });

  const { status, profile } = await res.json();
  return Response.json({
    status,
    profile: profile && { full_name: profile.full_name, headline: profile.headline, location: profile.location },
  });
}

Four things make this proxy secure rather than just a relay:

  1. It authenticates your user first. An unauthenticated proxy is a public faucet for your credits. Check the session before anything else.
  2. It validates the input. Only linkedin.com/in/ URLs go upstream. ProfileHunt would refuse the rest with a free 422, but rejecting early keeps junk out of your logs.
  3. It returns a subset. The client gets the fields the screen needs, not the whole profile. Less data on the device is less to leak.
  4. It hides upstream errors. A ProfileHunt 401 means your server's key is wrong. Log it and alert on it; don't pass "unauthorized" to an end user who did nothing wrong.

Add your own per-user limit on top: ProfileHunt's 60 requests a minute per key protects the API, not your budget. The guide on integrating a profile API with a custom backend covers the service module and job queue around this endpoint, and the single lookup endpoint guide covers the loading states and caching your proxy's callers need.

One key per environment and tool

Create a key for each place that calls the API, and name it after that place: dev, staging, production, n8n, clay-table. Owners and admins create keys on the Keys page.

BenefitWhy it matters
Separate rate limitsEach key gets 60 requests a minute. A test script flooding dev can't slow production.
Clean attributionThe Usage page shows which key made each request, so spend traces to a system.
Small blast radiusRevoking a leaked n8n key leaves the backend running.
A clear "Last used" signalA key that stopped being used is a key you can retire.

All keys still draw from the workspace's one credit balance. Separate keys isolate access and traffic, not money.

What Most Guides Get Wrong About API Key Security

"CORS protects the key." CORS controls which web pages may read a response in a browser. It does nothing about a key visible in your page source, and nothing about curl. ProfileHunt's CORS blocks front-end calls from your site, which is good, but the fix is to never put the key there.

"Environment variables in the front end are secret." Build tools that inline environment variables into client bundles (anything prefixed for public use) publish them. A key read in a server function stays on the server; a key read in a component ships to every visitor. Where JavaScript can run the call draws that line for servers, edge functions and the browser.

"Rotate keys every 90 days and you're safe." Calendar rotation helps less than fast revocation and one-key-per-caller. What protects you is being able to revoke one key in seconds without an outage, which the pattern below gives you.

Myth vs Reality

MythReality
Obfuscating the key in a mobile app is enough.Obfuscated strings are recovered by anyone who unpacks the app. Route mobile calls through your backend.
A proxy adds noticeable latency.One extra hop inside your own infrastructure is small next to a live profile read, which usually takes a few seconds.
Revoking a key needs a support ticket or a wait.Owners and admins revoke on the Keys page, and the key fails on its next request.
Every teammate needs to see the key to work with the API.Members see usage and key names, not key values. Give only deployers the admin role.
AI agents need the key in their instructions.Keep the key in the agent's HTTP tool configuration; the model only fills in the profile URL. See AI agents.

Two keys on a rack, one plain above an open lock, one blue

Rotating a key without downtime

Rotation is a four-step procedure. It works because a workspace can hold several active keys at once.

Step 1: Create the new key

On the Keys page, create a key with a name that tells the two apart, such as production-2026-11. Copy it.

Step 2: Deploy the new key

Update the secret where your service reads it and redeploy or restart. Both keys are valid at this point, so in-flight requests on the old key still succeed.

Step 3: Confirm the switch

Check that the new key is serving traffic: its "Last used" date on the Keys page moves to today, and the Usage page attributes new requests to it. For a check from the server itself, one real lookup from the new deployment returns 200 with a valid key and 401 with a bad one; it uses a credit only if the profile is found.

Step 4: Revoke the old key

When the old key's "Last used" date stops moving, click Revoke. It fails with 401 from the next request on, and it disappears from the Keys list.

Advanced: Designing for Many Callers and Incidents

For teams running several services, automations and agents against one workspace, a few extra layers pay off.

  • Treat a 401 as an incident signal. In steady state your services never see a 401. Alert on the first one: it means a secret didn't reach a deploy, or someone revoked a key that was still in use.
  • Batch jobs authenticate twice. Creating a batch and polling it both need the key, and polls can run for minutes. Rotate between batches, not in the middle of one, or keep the old key alive until the polls finish.
  • Separate who can spend from who can see. Buying credits, creating keys and revoking keys need the owner or admin role. Analysts who only read usage belong in the member role.
  • Scope automation keys tightly. In n8n, Make, Zapier or Clay, anyone who can edit the workflow can usually read the header in it. Give each tool its own key so a shared workflow never exposes your backend's key. Where the key itself should live in each of these tools is covered in how developers should store credentials.

The mechanics underneath this design, the two headers, what a key looks like and what a 401 means, are in how to authenticate with an API key.

Where ProfileHunt Fits

ProfileHunt is a LinkedIn Profile API: a public LinkedIn profile URL in, JSON out. Its access model is built for this pattern: workspace keys with owner, admin and member roles, any number of named keys per workspace, per-key rate limits and attribution, revocation from the Keys page, and an API that browsers can't call from third-party pages.

ProfileHunt never uses your LinkedIn account, cookie or seat, so the key is the only credential to protect.

Getting Started

Sign in to get a workspace with a Default key and free credits, then create one named key per environment. The authentication docs summarise keys, workspaces and safety rules, and the rate limits page explains the per-key minute. To see where this fits in the bigger picture, start with what a LinkedIn profile API is.

Frequently asked questions

Is it safe to call a LinkedIn profile API from the browser?

No. A key in front-end code is readable by anyone who opens the page, and ProfileHunt blocks browser calls from pages other than its own dashboard. Call the API from your server and have your front end call your server.

How do I hide my API key in a React or mobile app?

You can't hide it inside the app. Put a small endpoint on your backend that checks your user, adds the key and calls the API, and have the app call that endpoint instead.

How often should I rotate my API key?

Rotate whenever a key may have leaked, when someone with access leaves, or when you retire a system. Rotation itself is create a new key, deploy it, confirm it's in use, then revoke the old one.

Should I use a different API key for development and production?

Yes. Separate keys give each environment its own 60-requests-a-minute limit and its own usage history, and you can revoke one without touching the other. All keys still share the workspace's credits.

What happens to requests using a revoked API key?

They fail with 401 and {"error":"unauthorized"} from the next request on, and they're never charged. Revoked keys disappear from the Keys page.

Get API key 100 free credits with a work email