---
title: "POST /v1/linkedin/accounts"
description: "Connect your own LinkedIn session"
canonical_url: https://groundsocial.dev/docs/api/linkedin-accounts-connect
---
# POST /v1/linkedin/accounts

> Connect your own LinkedIn session

> ## Agent Instructions
> The Groundsocial REST API is at https://api.groundsocial.dev (OpenAPI: https://groundsocial.dev/openapi.json). Set yourself up with https://groundsocial.dev/SKILL.md; the MCP server is https://api.groundsocial.dev/mcp. Every docs page is Markdown at its URL plus `.md`; the index is https://groundsocial.dev/llms.txt.

|  |  |
| --- | --- |
| Request | `POST /v1/linkedin/accounts` |
| Operation id | `linkedin.accounts.connect` |
| Cost | Free |
| Auth | API key: `Authorization: Bearer <key>` or `x-api-key`. |

Checks the session with LinkedIn and stores it only if it works. A session that needs a security check, is restricted or logged out is refused with a 422-style invalid_request and nothing is stored.

## Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `li_at` | `string` | yes | The value of the li_at cookie of a session you logged into yourself. |
| `jsessionid` | `string` | yes | The JSESSIONID cookie of the same session (ajax:…). |
| `user_agent` | `string` | yes | The user agent of the browser that session lives in. |
| `li_a` | `string` | no | Optional: the li_a cookie LinkedIn sets once you open Sales Navigator in that browser. Needed for the Sales Navigator endpoints. |
| `proxy` | `string` | no | Optional: your own proxy (ideally a static IP in your country) for every request on this account. Without one we pin the account to one sticky residential exit. |
| `country` | `string` | no | Optional: ISO country of the account, for the exit we pin. |
| `label` | `string` | no | Your name for this session, up to 60 characters. |

## Responses

| Status | Meaning | Schema |
| --- | --- | --- |
| `201` | Connected. | `ConnectedSession` |
| `400` | Invalid input. | `Error` |
| `401` | Missing or invalid credentials. | `Error` |
| `404` | No connected LinkedIn session with that id among yours. | `Error` |
| `409` | Already 10 connected LinkedIn sessions on this account. | `Error` |
| `422` | LinkedIn did not accept the session. Nothing was stored. | `Error` |
| `429` | Too many connect attempts. Wait for Retry-After seconds. | `Error` |
| `503` | LinkedIn could not be reached. Retryable; nothing was stored. | `Error` |

### ConnectedSession fields

| Field | Type | Description |
| --- | --- | --- |
| `id` | `string` |  |
| `platform` | `string` |  |
| `label` | `string \| null` |  |
| `status` | `"ok" \| "checkpoint" \| "restricted" \| "logged_out"` | ok: usable. checkpoint, restricted, logged_out: the network needs you, in your own browser; calls on it stop until you reconnect. |
| `status_detail` | `string \| null` |  |
| `profile` | `object` | Non-secret facts about the account (name, public id). |
| `created_at` | `string` |  |
| `last_checked_at` | `string \| null` |  |
| `last_used_at` | `string \| null` |  |
| `quotas` | `object[]` |  |

Errors use one shape everywhere; see [Errors](https://groundsocial.dev/docs/errors) for every code and what to do.

## Example

cURL:

```bash
curl -X POST "https://api.groundsocial.dev/v1/linkedin/accounts" \
  -H "Authorization: Bearer $GROUNDSOCIAL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"li_at":"<li_at>","jsessionid":"<jsessionid>","user_agent":"<user_agent>"}'
```

TypeScript:

```ts
const res = await fetch('https://api.groundsocial.dev/v1/linkedin/accounts', {
  method: 'POST',
  headers: { Authorization: `Bearer ${process.env.GROUNDSOCIAL_API_KEY}`, 'Content-Type': 'application/json' },
  body: JSON.stringify({"li_at":"<li_at>","jsessionid":"<jsessionid>","user_agent":"<user_agent>"}),
})
if (!res.ok) throw new Error((await res.json()).error.hint)
const data = await res.json()
```

Python:

```python
import os, requests

res = requests.post(
    "https://api.groundsocial.dev/v1/linkedin/accounts",
    headers={"Authorization": f"Bearer {os.environ['GROUNDSOCIAL_API_KEY']}"},
    json={"li_at":"<li_at>","jsessionid":"<jsessionid>","user_agent":"<user_agent>"},
)
res.raise_for_status()
data = res.json()
```

_Canonical HTML: https://groundsocial.dev/docs/api/linkedin-accounts-connect_

## Site Navigation

### Global Hub
- [Home](https://groundsocial.dev/index.md)
- [Pricing](https://groundsocial.dev/pricing.md)
- [Endpoints](https://groundsocial.dev/endpoints.md)
- [For agents](https://groundsocial.dev/agents.md)
- [Docs](https://groundsocial.dev/docs.md)
- [Compare](https://groundsocial.dev/compare.md)
- [Blog](https://groundsocial.dev/blog.md)
- [Reports](https://groundsocial.dev/reports.md)
- [Tutorials](https://groundsocial.dev/tutorials.md)
- [Changelog](https://groundsocial.dev/changelog.md)
- [llms.txt](https://groundsocial.dev/llms.txt)
- [Agent skill](https://groundsocial.dev/SKILL.md)

### On This Topic
- [Groundsocial docs](https://groundsocial.dev/docs.md)
- [Quickstart](https://groundsocial.dev/docs/quickstart.md)
- [Authentication](https://groundsocial.dev/docs/authentication.md)
- [Credits and payments](https://groundsocial.dev/docs/payments.md)
- [Rate limits](https://groundsocial.dev/docs/rate-limits.md)
- [Errors](https://groundsocial.dev/docs/errors.md)
- [Data freshness and caching](https://groundsocial.dev/docs/freshness.md)
- [MCP server](https://groundsocial.dev/docs/mcp.md)
- [SKILL.md, llms.txt and Markdown twins](https://groundsocial.dev/docs/skill.md)
- [CLI](https://groundsocial.dev/docs/cli.md)
- [TypeScript SDK](https://groundsocial.dev/docs/sdk.md)
- [PRAW and snoowrap](https://groundsocial.dev/docs/praw.md)
- [Legal and compliance](https://groundsocial.dev/docs/compliance.md)
- [API reference](https://groundsocial.dev/docs/api.md)

## Structured data

```json
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://groundsocial.dev/"},{"@type":"ListItem","position":2,"name":"Docs","item":"https://groundsocial.dev/docs"},{"@type":"ListItem","position":3,"name":"API reference","item":"https://groundsocial.dev/docs/api"},{"@type":"ListItem","position":4,"name":"POST /v1/linkedin/accounts","item":"https://groundsocial.dev/docs/api/linkedin-accounts-connect"}]}
```
