# LinkedIn data in Python. Pay per record.

> Call the LinkedIn data API from Python with requests: profiles, companies, posts, jobs and search. No SDK, pay per record, $0.10 free.

Canonical: https://apiforagents.dev/integrations/python · Updated 2026-10-16

One function with requests covers every operation. Quote first, run, and read coverage before data.

- Works with: Python
- Price: from $0.001 / record
- Free to start: $0.10
- Setup: No SDK

## The client

python:

```python
import os, requests

BASE = "https://apiforagents.dev"
KEY = os.environ["AFA_KEY"]  # an API key from the console, or an agent's token

def linkedin(op: str, **params) -> dict:
    """Call one LinkedIn operation. Add estimateOnly=True for a free quote."""
    r = requests.post(
        f"{BASE}/v1/linkedin",
        headers={"Authorization": f"Bearer {KEY}"},
        json={"op": op, **params},
        timeout=120,
    )
    body = r.json()
    if r.status_code != 200:
        raise RuntimeError(f"{body.get('error')}: {body.get('error_description')}")
    return body  # read body["coverage"] and body["notes"] before body["data"]
```

## Quote, then run

python:

```python
quote = linkedin("searchPeople", company="stripe", titles=["Head of Data"], limit=10, estimateOnly=True)
print("at most", quote["cost"]["wouldChargeUsd"], "USD")

answer = linkedin("searchPeople", company="stripe", titles=["Head of Data"], limit=10)
for person in answer["data"]["profiles"]:
    print(person["name"], "-", person["headline"])
print("charged", answer["cost"]["usd"], "USD")
```

## No key yet? Let the script sign up

python:

```python
import requests
reg = requests.post("https://apiforagents.dev/agent/identity", json={"type": "anonymous"}).json()
tok = requests.post("https://apiforagents.dev/oauth2/token", data={
    "grant_type": "urn:ietf:params:oauth:grant-type:jwt-bearer",
    "assertion": reg["identity_assertion"],
}).json()["access_token"]
# $0.10 free to spend; keep reg["identity_assertion"] to sign in again later.
```

## Other platforms in this tool

- [Instagram in Python](https://apiforagents.dev/integrations/python/instagram)
- [YouTube in Python](https://apiforagents.dev/integrations/python/youtube)
- [X / Twitter in Python](https://apiforagents.dev/integrations/python/x_twitter)
- [Reddit in Python](https://apiforagents.dev/integrations/python/reddit)
- [TikTok in Python](https://apiforagents.dev/integrations/python/tiktok)
- [Facebook in Python](https://apiforagents.dev/integrations/python/facebook)
- [Amazon in Python](https://apiforagents.dev/integrations/python/amazon)
- [Shopify in Python](https://apiforagents.dev/integrations/python/shopify)
- [Farfetch in Python](https://apiforagents.dev/integrations/python/farfetch)
- [GOAT in Python](https://apiforagents.dev/integrations/python/goat)
- [StockX in Python](https://apiforagents.dev/integrations/python/stockx)
- [Blinkit in Python](https://apiforagents.dev/integrations/python/blinkit)
- [Swiggy Instamart in Python](https://apiforagents.dev/integrations/python/instamart)
- [Zepto in Python](https://apiforagents.dev/integrations/python/zepto)
- [Indeed in Python](https://apiforagents.dev/integrations/python/indeed)
- [Naukri in Python](https://apiforagents.dev/integrations/python/naukri)
- [Upwork in Python](https://apiforagents.dev/integrations/python/upwork)
- [Contacts in Python](https://apiforagents.dev/integrations/python/contacts)
- [Google Maps in Python](https://apiforagents.dev/integrations/python/google_maps)
- [Yelp in Python](https://apiforagents.dev/integrations/python/yelp)
- [Tripadvisor in Python](https://apiforagents.dev/integrations/python/tripadvisor)
- [Airbnb in Python](https://apiforagents.dev/integrations/python/airbnb)
- [Booking.com in Python](https://apiforagents.dev/integrations/python/booking)
- [Google in Python](https://apiforagents.dev/integrations/python/google)

## Questions

### Where do I get a key?

Two ways. A person signs in at https://apiforagents.dev and makes an API key under Console, API keys. Or the agent signs itself up with one POST to https://apiforagents.dev/agent/identity, exchanges the identity for a token, and starts on $0.10 free; a person claims it later with a six-digit code to top up.

### What does a call cost?

LinkedIn profiles are $0.004 and companies $0.004 each, posts, comments, reactions and ads $0.002, jobs $0.001. Pay as you go from $5, nothing monthly. Add "estimateOnly": true to any call for a free quote, and records that do not come back are refunded.

## Why API for Agents

- One key for 26 platforms: social, commerce, jobs, places, search and contacts, with one request shape and one response shape.
- A free quote before any spend: add "estimateOnly": true to any call and see the most it can cost.
- Pay per record in US dollars. No subscription, nothing expires, top-ups from $5.
- $0.10 free to try, no card. An AI agent can sign itself up in one request; a person claims it later.
- Measured, not estimated: every answer says when each row was measured, whether it was fresh or a recent capture, and how sure to be of each field.
- Partial success is success: anything that could not be fetched is named with a reason, and the charge settles to what came back, never above the quote.
- Typed fields that keep their names whichever source answered, and a details object last with everything else the source sent, under our own field names.
- Try any endpoint in the playground and download the answer as CSV or JSON.

## Start

The playground runs any endpoint by hand: pick a platform and what you want from it, fill a short form named in plain words (or press Use sample input), see the free quote on the Run button, run it, then read the answer as a table or JSON and download it as CSV or JSON. The same call is written out as cURL, Python and Node while you type. Open it at https://apiforagents.dev/dashboard/run (sign in first).

Agents register at https://apiforagents.dev/auth.md (one POST, $0.10 free). People: https://apiforagents.dev/docs#start. Prices: https://apiforagents.dev/pricing.md
