{"id":4610,"library":"linkedin-api-client","title":"LinkedIn API Python Client","description":"The official Python client library for LinkedIn APIs. It provides a thin client for making requests to LinkedIn APIs, handling the complexities of the Rest.li framework, formatting requests, and managing authentication (OAuth2). The library aims to reduce the difficulty of interacting with LinkedIn's robust but complex API protocol. The current version is 0.3.0, and it maintains an active release cadence.","status":"active","version":"0.3.0","language":"python","source_language":"en","source_url":"https://github.com/linkedin-developers/linkedin-api-python-client","tags":["linkedin","api","client","oauth","restli"],"install":[{"cmd":"pip install linkedin-api-client","lang":"bash","label":"Install stable version"}],"dependencies":[],"imports":[{"symbol":"RestliClient","correct":"from linkedin_api.clients.restli.client import RestliClient"},{"symbol":"AuthClient","correct":"from linkedin_api.clients.auth.auth_client import AuthClient"},{"note":"The `Linkedin` class from `linkedin_api` (lowercase) refers to a popular, unofficial library that is *not* this official client. Using the unofficial library may violate LinkedIn's Terms of Service.","wrong":"from linkedin_api import Linkedin","symbol":"Linkedin","correct":"from linkedin_api.clients.restli.client import RestliClient"}],"quickstart":{"code":"import os\nfrom linkedin_api.clients.restli.client import RestliClient\n\n# Get your 3-legged access token from environment variables or a secure store.\n# This token must be generated via the LinkedIn Developer Portal's OAuth 2.0 flow.\nACCESS_TOKEN = os.environ.get('LINKEDIN_ACCESS_TOKEN', 'YOUR_ACCESS_TOKEN_HERE')\n\nif not ACCESS_TOKEN or ACCESS_TOKEN == 'YOUR_ACCESS_TOKEN_HERE':\n    raise ValueError(\"Please set the LINKEDIN_ACCESS_TOKEN environment variable or replace the placeholder.\")\n\nrestli_client = RestliClient()\n\ntry:\n    # Example: Fetch current user's information\n    response = restli_client.get(\n        resource_path=\"/userinfo\",\n        access_token=ACCESS_TOKEN\n    )\n    print(\"Successfully fetched user info:\")\n    print(response.entity)\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")","lang":"python","description":"This quickstart demonstrates how to make a simple GET request to the `/userinfo` endpoint using the `RestliClient`. It requires a 3-legged access token with appropriate scopes (e.g., `openid`, `profile`) obtained from the LinkedIn Developer Portal. Ensure you replace `YOUR_ACCESS_TOKEN_HERE` with a valid token or set the `LINKEDIN_ACCESS_TOKEN` environment variable."},"warnings":[{"fix":"Monitor official GitHub releases and documentation for updates and stability improvements. Implement robust error handling and fallback mechanisms in production applications.","message":"This API client library is officially in beta and is subject to change. It may contain bugs, errors, or other issues. Use in production environments should be approached with caution, and users should be prepared for unexpected behavior.","severity":"beta","affected_versions":"0.1.0 - 0.3.0"},{"fix":"Always verify the import path (`from linkedin_api.clients.restli.client import RestliClient`) to ensure you are using the official client. Consult the official GitHub repository for this library.","message":"There are multiple Python libraries for LinkedIn, including a popular unofficial one (`linkedin-api` by Tom Quirk) that uses web scraping/simulation. This official `linkedin-api-client` library requires proper OAuth2 authentication and interaction via the LinkedIn Developer Portal, while the unofficial one may work by using a username/password, potentially violating LinkedIn's Terms of Service.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Regularly consult the LinkedIn Developer documentation for API versioning and breaking changes. Test your integration thoroughly when new API versions are released or when updating the client library. Specify API versions in your requests where possible if the client supports it.","message":"LinkedIn's underlying APIs are frequently updated with monthly versions, and these can introduce breaking changes (e.g., changes to resource paths, required fields, or deprecation of features). The client library aims to abstract some of this, but direct API calls may still be affected.","severity":"breaking","affected_versions":"All versions (due to upstream API changes)"},{"fix":"Familiarize yourself with the LinkedIn OAuth2 documentation. Ensure your LinkedIn application is correctly configured with necessary scopes and redirect URIs. For 3-legged auth, users must authorize your application in a web browser to get an authorization code, which is then exchanged for an access token.","message":"Authentication for the official LinkedIn API client relies on OAuth2 flows (2-legged for applications, 3-legged for user-specific actions). Obtaining valid access tokens (especially 3-legged) requires a pre-requisite setup in the LinkedIn Developer Portal, including creating an application, requesting API product access, and configuring redirect URIs.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Check the GitHub Issues for `linkedin-api-python-client` for specific workarounds or fixes related to pagination. Implement custom pagination logic if the built-in methods are not functioning as expected for your target API endpoints.","message":"Some GitHub issues indicate that pagination may be broken with certain API versions, particularly for cursor-based pagination.","severity":"gotcha","affected_versions":"Potentially 0.1.0 - 0.3.0 (depending on API version used)"}],"env_vars":null,"search_vec":"'0.3.0':58 'activ':63 'aim':39 'api':2,12,23,52,67 'authent':35 'cadenc':65 'client':4,8,17,68 'complex':26,51 'current':55 'difficulti':43 'format':31 'framework':30 'handl':24 'interact':45 'librari':9,38 'linkedin':1,11,22,47,66 'maintain':61 'make':19 'manag':34 'oauth':69 'oauth2':36 'offici':6 'protocol':53 'provid':14 'python':3,7 'reduc':41 'releas':64 'request':20,32 'rest':70 'rest.li':29 'robust':49 'thin':16 'version':56","created_at":"2026-04-12T14:00:01.050758+00:00","updated_at":"2026-04-16T16:15:11.035237+00:00","problems":[{"fix":"Ensure you are using a currently valid access token obtained through the correct OAuth 2.0 flow. If the token is expired, refresh it using the refresh token; if the refresh token is also invalid, re-authenticate the user to obtain new tokens.","cause":"This error occurs when the access token used in the API request is expired, revoked, malformed, or was never valid to begin with.","error":"{\"serviceErrorCode\": 65600, \"message\": \"Invalid access token\", \"status\": 401}"},{"fix":"Verify that your application has been granted all required API permissions in the LinkedIn Developer Portal, that the correct scopes are requested during the OAuth 2.0 authorization flow, and ensure your redirect_uri exactly matches the one configured in your app settings. For advanced data, you may need to join a LinkedIn Partner Program.","cause":"This '403 Access Denied' error indicates that your application does not have the necessary permissions (scopes) approved in the LinkedIn Developer Portal to access the requested API endpoint or data, or that your OAuth 2.0 implementation has issues like mismatched redirect URIs.","error":"{\"serviceErrorCode\": 100, \"message\": \"Not enough permissions to access: GET /me\", \"status\": 403}"},{"fix":"This is a token lifecycle problem; the only solution is to re-authenticate the user to obtain a new authorization code, which can then be exchanged for a new access token and refresh token. Ensure your application saves the most recent refresh token and handles token refresh proactively.","cause":"This error typically occurs when attempting to exchange a refresh token for a new access token, but the refresh token is no longer valid because it has expired (LinkedIn refresh tokens have a fixed one-year lifetime), the user or an administrator revoked the app's access, or the app's permissions were changed.","error":"{\"error\": \"invalid_grant\", \"error_description\": \"Token has been expired or revoked.\"}"},{"fix":"Update your API request URLs and parameters to use the current LinkedIn API version (e.g., v2 or /rest endpoints), referring to the latest LinkedIn API documentation for the correct endpoints and data formats.","cause":"This error, often accompanied by a '410 Gone' HTTP status, means your application is trying to access an old LinkedIn API endpoint that has been deprecated and removed, as LinkedIn transitioned from v1 to v2 (and later versions) of its API.","error":"This resource is no longer available under v1 APIs"},{"fix":"Double-check your `client_id` and `client_secret` values against those registered in your LinkedIn Developer Portal application. Ensure that the POST request for the token exchange includes `Content-Type: application/x-www-form-urlencoded` in the headers and sends `grant_type`, `client_id`, and `client_secret` in the request body.","cause":"This error arises during the OAuth 2.0 token exchange when the client ID or client secret provided by your application is incorrect, or the request format (e.g., `Content-Type`) for the token exchange is improperly set.","error":"{\"error\": \"invalid_client\", \"error_description\": \"Client authentication failed\"}"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"0.3.0","cli_name":"","cli_version":null,"type":"library","homepage":"https://developer.linkedin.com","github":"https://github.com/linkedin-developers/linkedin-api-python-client","docs":"https://github.com/linkedin-developers/linkedin-api-python-client","changelog":null,"pypi":"https://pypi.org/project/linkedin-api-client/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["communication","auth-security","crm-productivity","http-networking"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-08-30","next_check":"2026-07-28","install_tag":null}}