Learn to register, authenticate, and make API calls so your app can read and post LinkedIn data instantly
Before We Start: What You'll Walk Away With
By the end of this guide youâll have a fullyâfunctional LinkedIn app that talks to the API just like a smartphone talks to a weather service.
First youâll create a LinkedIn Developer App and walk away with a client ID and client secret. Think of it as ordering a meal: the app is the menu, the ID and secret are the order ticket that tells the kitchen (LinkedIn) whoâs eating.
Next youâll generate an OAuthâŻ2.0 access token and set it to refresh itself automatically. It works like a GPS that updates its route when traffic changesâyour token stays fresh without you lifting a finger.
Finally youâll fire a real request: pull a profileâs basic info and post a status update. Itâs the same as packing a suitcase, slipping the items (API call) into the bag (your code), and zipping it closed (sending it to LinkedIn).
Register the app â get
client_id&client_secret.Exchange the code for an
access_tokenand set up autoârefresh.Call
GET /v2/meandPOST /v2/ugcPoststo read a profile and publish.Tools: LinkedIn Developer Portal, any HTTP client (curl, Postman, fetch).
Tip: Keep the redirect URI identical everywhere; mismatches are the most common roadblock.
Cheat sheet:
client_id,client_secret,access_token,refresh_token.
Ready to start building? Letâs move on to the first concrete step.
What the LinkedIn API Actually Is (No Jargon)
The LinkedIn API is simply a collection of HTTPS URLs you can call to read or write LinkedIn data as if you were using the website yourself.
Each URL is a specific function â like pulling a userâs profile, posting a share, or getting company analytics. You send a request, LinkedIn sends back JSON, and your app can do whatever you need with that data.
Think of it like a restaurant menu. The menu lists dishes (profile, share, analytics). When you pick a dish, you place an order with the kitchen. OAuth is the reservation system that checks youâre actually allowed to sit at that table before the kitchen starts cooking.
Read endpoints let you fetch data â e.g.,
/v2/mereturns the authenticated userâs profile.Write endpoints let you create or modify data â e.g.,
/v2/ugcPostspublishes a post on behalf of the user.Organization endpoints let you act for a company page â e.g.,
/v2/organizationsfetches page details.
All you need is a valid access token, which OAuth hands to you after the user grants permission. With that token, each call works just like ordering a dish youâve already reserved.
Thatâs the whole LinkedIn API in plain English â a menu of web calls, and a reservation system that proves you belong at the table.
The 3 Mistakes Everyone Makes With LinkedIn API Integration
Most developers hit a wall fast because they skip the little details that actually make a LinkedIn API integration work.
Using the wrong redirect URI. Think of it like ordering food and giving the delivery driver the wrong apartment numberâLinkedIn never finds the right door, and the error message is cryptic. Doubleâcheck the URI in your app settings matches exactly what you send in the OAuth request.
Forgetting to request the exact permission scopes. Itâs similar to asking Google Maps for driving directions when you only need walking routes; youâll end up without the data you expected. If you need a full profile, ask for
r_fullprofile, not justr_liteprofile.Treating the access token as permanent. Imagine packing a suitcase for a monthâlong trip and assuming the luggage will never need to be repackedâafter 60 days LinkedIn forces a refresh. Implement the refresh flow before the token expires.
Check URI: copy it straight from the LinkedIn dashboard into your code.
Scope audit: list the fields you really need; request only those.
Refresh timer: set a cron job to call
POST https://www.linkedin.com/oauth/v2/accessTokenwithgrant_type=refresh_tokenbefore day 60.
Fix these three and the rest of the integration becomes a lot less painful.
How to Connect Your App to the LinkedIn API: Step-by-Step
Grab a coffee and letâs wire your app straight into the LinkedIn API.
Sign in to LinkedIn Developers and create a new app. Think of it like opening a new bank accountâyou need a profile before you can move money.
Add OAuthâŻ2.0 redirect URLs and note the ClientâŻID and ClientâŻSecret. These two strings are your appâs passport; store them safely, just like youâd keep a passport in a lockbox.
Build the authorization URL with required scopes and send the user to it. Itâs similar to ordering a meal: you list the dishes (scopes) you want, then hand the menu (URL) to the user.
Capture the authorization code from the redirect and exchange it for an access token. The code is a temporary ticket; swapping it for a token is like exchanging a concert ticket for entry.
Store the access token securely and set up a refreshâtoken workflow. Treat the token like cash in a safeâuse a secret manager or environment variable. When it expires, use the refresh token to get a new one without bothering the user.
Make a test API call. For example:
curl -H "Authorization: Bearer YOUR_ACCESS_TOKEN" https://api.linkedin.com/v2/me
If you get your profile JSON back, youâre good to go.
Handle errors and rateâlimit responses gracefully. Imagine a busy restaurant: if the kitchen says âno more orders,â back off and retry later. Check for
401(invalid token) and429(rate limit) and implement exponential backâoff.Tip: Keep a
.envfile forCLIENT_ID,CLIENT_SECRET, andACCESS_TOKEN.Cheat sheet:
GET https://api.linkedin.com/v2/me= profile,POST https://api.linkedin.com/v2/ugcPosts= share content.
Now you have a live LinkedIn API integrationânext weâll pull real data.
A Real Example: Posting a Company Update for a Marketing Manager
Maya, the Marketing Manager at Acme Co., wants her weekly product highlight to appear on the companyâs LinkedIn page without her lifting a finger each Friday.
She logs into the LinkedIn Developer Portal, selects the app she created earlier, and adds the w_organization_social scope. This is like giving a friend a key to your house so they can drop off a package.
She runs the OAuth flow from stepâŻ3 and copies the resulting access token. Think of the token as the receipt that proves sheâs allowed to post on the organizationâs behalf.
She writes a tiny Python script that builds the payload and sends a
POSTtohttps://api.linkedin.com/v2/ugcPosts. The payload includes the company URN (urn:li:organization:123456) and a URL to the product image.She executes the script and watches the console print the new postâs ID, confirming the update landed on Acmeâs LinkedIn page.
Tools: PythonâŻ3,
requestslibrary, your appâsclient_idandclient_secret.Tip: Store the access token in an environment variable (
LINKEDIN_TOKEN) so you donât hardâcode it.
Cheat Sheet:
POST https://api.linkedin.com/v2/ugcPostsHeader
Authorization: Bearer $LINKEDIN_TOKENHeader
Content-Type: application/jsonBody includes
author,lifecycleState,specificContent, andvisibility.
import os, json, requests
TOKEN = os.getenv('LINKEDIN_TOKEN')
URN = 'urn:li:organization:123456'
IMAGE_URL = 'https://example.com/product.jpg'
payload = {
"author": URN,
"lifecycleState": "PUBLISHED",
"specificContent": {
"com.linkedin.ugc.ShareContent": {
"shareCommentary": {"text": "Check out this weekâs product highlight!"},
"shareMediaCategory": "IMAGE",
"media": [{"status": "READY", "originalUrl": IMAGE_URL}]
}
},
"visibility": {"com.linkedin.ugc.MemberNetworkVisibility": "PUBLIC"}
}
headers = {
"Authorization": f"Bearer {TOKEN}",
"Content-Type": "application/json"
}
resp = requests.post(
"https://api.linkedin.com/v2/ugcPosts",
headers=headers,
data=json.dumps(payload)
)
print("Post ID:", resp.json().get("id"))
Run this script each Friday and Mayaâs LinkedIn feed stays fresh without a single manual click.
The Tools That Make This Easier
Grab the right helpers and the whole LinkedIn API integration feels like ordering a meal with a clear menu.
Postman â Think of it as a kitchen where you prep, taste, and perfect each API call. Its builtâin OAuth flow lets you fetch a token, hit
/v2/me, and see the raw JSON without writing a single line of code.ngrok â Like a temporary phone line that connects your home kitchen to a delivery driver, ngrok gives your localhost a public URL so LinkedIn can drop the auth code right back to you.
dotenv (npm) â Imagine packing a suitcase and labeling each compartment;
.envkeepsCLIENT_ID,CLIENT_SECRET, and tokens separate from your source. Example:
# .env
CLIENT_ID=your_client_id
CLIENT_SECRET=your_client_secret
ACCESS_TOKEN=eyJhbGci...
Load it in your app with
require('dotenv').config()and referenceprocess.env.ACCESS_TOKENwhenever you call the API.GitHub Actions â Treat it like an automatic coffee machine that brews fresh tokens every night. A simple workflow can run
curlto refresh the token and even push the new value back to your repoâs secrets.RapidAPI Marketplace â When you want to test without hitting LinkedInâs live servers, RapidAPI offers a sandbox that mimics endpoint responses, so you can debug your logic before the real deal.
With these tools in place, youâll spend less time hunting for settings and more time building the feature that matters.
Quick Reference: LinkedIn API Cheat Sheet
Grab this cheat sheet and run through it like youâd check off items on a grocery list.
đ ď¸ Create app â get Client ID/Secret â Think of registering a new kitchen appliance; you need the model number (Client ID) and the warranty code (Secret) before you can start cooking.
đ Authorization URL:
https://www.linkedin.com/oauth/v2/authorizationâ Like opening the restaurantâs front door; youâll be handed a temporary QR code (auth code) after the guest signs in.đ Exchange code â POST
https://www.linkedin.com/oauth/v2/accessTokenâ Swap that QR code for a kitchen key (access token) at the back desk.â° Token lives 60âŻdays â set up refresh flow â Similar to a food delivery ticket that expires after two months; schedule a reminder to renew before it goes stale.
đ Core scopes:
r_liteprofile,r_emailaddress,w_organization_socialâ Imagine youâre giving Alex (our fictional growth hacker) a VIP pass: he can read a profile, grab an email, and post on behalf of a company.â Test call:
GET https://api.linkedin.com/v2/mewithAuthorization: Bearerâ Like checking the GPS after youâve entered a destination; you should see Alexâs basic profile data.đ Post update:
POST https://api.linkedin.com/v2/ugcPostswith JSON payload â Think of sending a status update as ordering a custom pizza; you specify crust, sauce, and toppings in the JSON.
Keep this list handy; itâs the fastest route from zero to a working LinkedIn API integration.
What to Do Next
Kick the tires of what you just built and watch the data roll in.
Easy: Toss the
access_tokeninto a Postman collection and fire aGET /merequest. Think of it like ordering a coffeeâyou already have the menu (endpoint) and the payment method (token), just click âBuy.âMedium: Spin up a tiny webhook that refreshes the token every week and logs the JSON response. Itâs the same as setting a weekly grocery delivery; you schedule the order once and the pantry stays stocked.
Hard: Wire the whole token workflow into your production backendâNode, Django, or Springâthen schedule automated company updates. This is like installing a smart thermostat: you connect the hardware, write the rules, and let it run without you lifting a finger.
Keep
client_idandclient_secretout of source control; use environment variables.Log token expiry timestamps so your refresher knows when to act.
Test each step locally before deploying to avoid âworks on my machineâ surprises.
Got stuck at any step? Drop a comment below and Iâll help you troubleshoot.
About the Author
Abdullah Sheikh is the Founder & CEO at Exteed, where he leads a team of skilled developers specializing in Web2 and Web3 applications, Custom Smart Contracts, and Blockchain solutions.
With 6+ years of experience, Abdullah has built CRMs, Crypto Wallets, DeFi Exchanges, E-Commerce Stores, HIPAA Compliant EMR Systems, and AI-powered systems that drive business efficiency and innovation.
His expertise spans Blockchain, Crypto & Tokenomics, Artificial Intelligence, and Web Applications; building reliable and smooth web apps that fit the clientâs goals and requirements.
đ§ info@abdullah-sheikh.com ¡ đ LinkedIn ¡ đ abdullah-sheikh.com
Top comments (0)