Back to blog

How to Get a LinkedIn API Key in 2026 (Step by Step)

Ruz, Founder LeadShark · Nov 26, 2026 · 5 min read

Short answer: LinkedIn does not hand out a single "API key". You create an app in the LinkedIn Developer Portal, which gives you a Client ID (LinkedIn's docs call it the Consumer key or API key) and a Client Secret. You then add products to the app, like Sign In with LinkedIn using OpenID Connect or Share on LinkedIn, and use OAuth 2.0 to get an access token. That token is what you actually send with API calls, and LinkedIn currently issues every access token with a 60-day lifespan.

The key itself takes about ten minutes. Getting access to the APIs most people want (messaging, reading post comments, Sales Navigator data) is the hard part, because those need partner approval. Steps below, checked against LinkedIn's Microsoft Learn documentation in November 2026.

I build LeadShark, so read the last section with that in mind.


What you need before you start

  • A personal LinkedIn account you can sign in with.
  • A LinkedIn Company Page to attach the app to. Every app is associated with a Page, and a Page admin has to verify the app.
  • A privacy policy URL and an app logo.
  • An HTTPS redirect URL on your server (or Postman's callback, https://oauth.pstmn.io/v1/callback, if you are only testing).

Step 1: Create an app in the Developer Portal

  1. Go to the LinkedIn Developer Portal and choose Create app.
  2. Enter the app name, pick your Company Page, add your privacy policy URL and upload a logo.
  3. Accept the API Terms of Use and create the app.
  4. Send the verification link to a Page admin (or approve it yourself if you are the admin).

Step 2: Copy your Client ID and Client Secret

Open your app and click the Auth tab. You will see:

Credential What it is Keep it secret?
Client ID Your app's public identifier (the "API key") No, it appears in OAuth URLs
Client Secret Proves requests come from your app Yes. Never put it in a URL, front-end code, support forum or chat

On the same tab, add your redirect URL. It must match the redirect_uri you send later, character for character.

Step 3: Add products to unlock scopes

Your Client ID does nothing on its own. Scopes come from the Products tab. Only three permissions are open to every developer without review:

Product Scope What it lets you do
Sign In with LinkedIn using OpenID Connect profile Read the signed-in member's name, headline and photo
Sign In with LinkedIn using OpenID Connect email Read the signed-in member's primary email
Share on LinkedIn w_member_social Post, comment and like on behalf of the signed-in member

Everything else (Advertising API, Community Management, Sales Navigator Application Platform, talent integrations) needs an application and approval. The Compliance API is closed to new applications.

Step 4: Generate an access token

LinkedIn uses the OAuth 2.0 authorization code flow (3-legged) for member data:

  1. Send the member to https://www.linkedin.com/oauth/v2/authorization with response_type=code, your client_id, your redirect_uri, a state value and the scopes you need.
  2. The member signs in and clicks Allow. LinkedIn redirects back with a code.
  3. Your server exchanges that code at https://www.linkedin.com/oauth/v2/accessToken using your Client ID and Client Secret.
  4. You get back an access_token with expires_in of 5,184,000 seconds (60 days).

For quick tests, the Developer Portal also has a token generator so you can create a token for yourself without writing the flow.

Plan for expiry. Programmatic refresh tokens are only available to a limited set of approved partners. For most apps, the member has to re-authorize when the 60 days run out. If the member already granted access, LinkedIn skips the consent screen and redirects straight back.

Why your LinkedIn API key "doesn't work"

The most common reasons, in order:

  • Missing scope. You requested a scope that is not on your Auth tab because the product was never added or approved.
  • Redirect mismatch. The redirect_uri in your request differs from the one saved on the app.
  • Expired token. It has been more than 60 days.
  • You need a gated API. Sending DMs, reading comments on posts, or pulling profile data for people other than the signed-in member is not part of the open permissions. More on this in our LinkedIn Messaging API guide.

Is the LinkedIn API key free?

Yes. Creating an app and using the open permissions costs nothing. The cost is access, not price: partner programs need approval and some run on custom terms. Full breakdown in LinkedIn API pricing.

If you only wanted the key to automate DMs or comment replies

Most people searching for a LinkedIn API key want one of two things: send DMs automatically, or reply to everyone who comments on a post. The open permissions do not cover either.

That is the job LeadShark does without you building an app. You post your lead magnet, and LeadShark DMs everyone who comments. You set your DM volume from 0 to 250 DMs a day (150 recommended max). LeadShark has processed 3.2M+ comments and delivered 2.8M+ DMs.

If you work with AI agents, Apex by LeadShark gives Claude and other MCP clients LinkedIn tools over OAuth, with no developer app or partner approval on your side. See the LinkedIn MCP server.

FAQ

Is the Client ID the same as the API key? Yes. LinkedIn's documentation describes the Client ID as the Consumer key or API key. You still need the Client Secret and an OAuth access token to call the API.

Do I need a Company Page to get a LinkedIn API key? Yes. Every Developer Portal app is attached to a LinkedIn Page, and a Page admin verifies it.

How long does a LinkedIn access token last? 60 days. Refresh tokens are limited to some approved partners.

Can I get a LinkedIn API key for messaging? Not through self-serve. The Messages API is for approved partners only.

Ruz, Founder LeadShark

Written by

Ruz

Founder LeadShark

Put your lead magnets on autopilot

Reply to every commenter and deliver your resource in DMs, automatically. 7-day free trial, no card.

Start automating for free