# Lempile Docs > Guides and API reference for Lempile's APIs: Lempile Direct (a LinkedIn API on Unipile's paths, fields and errors), the Google Search API (SerpApi-compatible), Email Finder and People Search. Every page is plain Markdown at its own address plus `.md`. --- # Lempile Direct > Unipile's LinkedIn API paths, fields and errors, served by Lempile from each account's own browser session, without a browser per call. Lempile Direct is a LinkedIn API that answers Unipile's paths, fields, status codes and error types, at `https://direct.lempile.com/api/v1`, without opening a browser for each call. A client written for Unipile points at Direct by changing two things: its base URL and its API key. Anything Direct doesn't do answers Unipile's own `501 errors/feature_not_implemented`, so such a client can fall back to Unipile for that call. ```text your app -> Direct (X-API-KEY) -> the account's own session and proxy -> LinkedIn's own API ``` ## How It Works - Every LinkedIn account Direct serves is a Lempile account: a real browser on Lempile's browser server, signed in to LinkedIn, with its own proxy. - Direct reads that browser's LinkedIn session (cookies, user agent, client hints) through a signed internal route, keeps it encrypted for up to 6 hours, and reads it again when LinkedIn refuses it. - Each call goes to LinkedIn's own web API through the account's own proxy, with the connection fingerprint of the account's Chrome version. LinkedIn sees the same browser, the same address and the same session it always sees from that account. - Calls are paced per account: one at a time, 1.5 to 3 seconds apart, at most 1,500 a day, and a 15-minute rest when LinkedIn says "too many". - Answers are LinkedIn's data reshaped into Unipile's objects (`UserProfile`, `Chat`, `Message`, `Post`…). The test suite checks the read answers against Unipile's published response schemas. ## 60-Second Quickstart ```bash export DIRECT_API_KEY="your-api-key" # The LinkedIn accounts your key can use. curl -sS "https://direct.lempile.com/api/v1/accounts" \ -H "X-API-KEY: $DIRECT_API_KEY" # Who an account is on LinkedIn. curl -sS "https://direct.lempile.com/api/v1/users/me?account_id=$ACCOUNT_ID" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` The [Quick Start](https://lempile.com/docs/direct/quick-start) connects an account, sets up a webhook and tries a first write without sending it. ## What It Covers | Area | Routes | | --- | --- | | Accounts | list, retrieve, resync, delete; hosted auth link to connect or reconnect one | | Webhooks | create, list, delete; `messaging` (`message_received`), `users` (`new_relation`), `account_status` | | Users and profiles | the account's own profile, any profile with its sections, lookup by profile URL | | Relations and invitations | connections, sent invitations, invite, withdraw | | Chats and messages | chats, one chat, messages, one message, attendees; start a chat, send a message, files | | Posts | a member's or a company's posts, one post; create (text, mentions, images, a video), delete | | Comments and reactions | comments and replies, reactions; comment, reply, react, and Direct's own delete routes | | Company search | LinkedIn's classic company search, by keywords | The [Unipile Compatibility](https://lempile.com/docs/direct/unipile-compatibility) page lists every Unipile route, what Direct does with it, and where it differs. ## How It Differs From Unipile - **LinkedIn only.** No email, calendar, WhatsApp or other providers. No Sales Navigator, Recruiter or group conversations. - **Lempile accounts.** An account id is a Lempile account id. Accounts connect through Lempile's own real-browser sign-in (the hosted auth link), and stay in Lempile's browsers. - **Paced per account.** Daily caps on calls and writes, and a rest after LinkedIn's "too many", answered as Unipile's `429` with `retry_after`. See [Errors And Limits](https://lempile.com/docs/direct/errors-and-limits). - **Messages in real time, relations by polling.** Direct keeps LinkedIn's own live connection open for each account, so a message reaches your webhook within seconds, day and night; a read of the inbox now and then catches anything it missed. New relations come from reading them every 30 to 60 minutes. - **Writes are off by default** for each account, until Lempile turns them on for it. - **Extras Unipile doesn't have:** `?dry_run=true` on every write (the exact LinkedIn call, not sent), an `Idempotency-Key` header that never writes twice, routes to delete a comment and to remove a reaction, and `?lempile_light=true` on a profile read (its top card and sections only, in fewer LinkedIn calls). ## When To Use It Use Direct when: - your LinkedIn accounts are (or can be) connected in Lempile; - you have a Unipile integration and want the same calls served from the account's own browser session and address; - you want to see a write's exact LinkedIn call before sending it, and retry writes safely. Keep Unipile (or fall back to it on `501`) when you need another provider, Sales Navigator or Recruiter, people, post or job search, group conversations, or webhook events within seconds. ## Production Host ```text https://direct.lempile.com/api/v1 ``` The OpenAPI document is public at `https://direct.lempile.com/api/v1/openapi.json`, and a reference page draws it at `https://direct.lempile.com/docs`. ## Next - [Quick Start](https://lempile.com/docs/direct/quick-start) - [Authentication And Accounts](https://lempile.com/docs/direct/authentication-and-accounts) - [Webhooks](https://lempile.com/docs/direct/webhooks) - [Errors And Limits](https://lempile.com/docs/direct/errors-and-limits) - [Migrating From Unipile](https://lempile.com/docs/direct/migrating-from-unipile) --- # Lempile Direct: Quick Start > From an API key to a connected LinkedIn account, a first read, a first webhook and a first write tried without sending it. This page takes you from an API key to a connected LinkedIn account, a first read, a first webhook and a first write tried without sending it. Every example uses shell variables: replace them with your own values. ## 1. Set Your Key Direct authenticates every API call with the `X-API-KEY` header. See [Authentication And Accounts](https://lempile.com/docs/direct/authentication-and-accounts) for how to get a key. ```bash export DIRECT_API_KEY="your-api-key" export DIRECT="https://direct.lempile.com/api/v1" ``` Check it: ```bash curl -sS "$DIRECT/accounts" -H "X-API-KEY: $DIRECT_API_KEY" ``` ```json { "object": "AccountList", "items": [], "cursor": null, "total_count": 0, "status_counts": { "OK": 0, "CONNECTING": 0, "CREDENTIALS": 0, "STOPPED": 0, "ERROR": 0 } } ``` The list holds your workspace's accounts only. A missing, wrong or revoked key answers `401` with `"type": "errors/missing_credentials"`. ## 2. Connect A LinkedIn Account Ask for a hosted auth link, then send the person who owns the LinkedIn account to its `url`. They sign in to LinkedIn on Lempile's page, in a real browser (security checks and codes included), and come back to your `success_redirect_url`. ```bash curl -sS -X POST "$DIRECT/hosted/accounts/link" \ -H "X-API-KEY: $DIRECT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "type": "create", "api_url": "https://direct.lempile.com", "providers": ["LINKEDIN"], "expiresOn": "2026-11-01T12:00:00.000Z", "name": "user_42", "success_redirect_url": "https://app.example.com/linkedin/connected", "failure_redirect_url": "https://app.example.com/linkedin/failed", "notify_url": "https://app.example.com/hooks/direct-connected?secret=your-own-secret" }' ``` ```json { "object": "HostedAuthUrl", "url": "https://direct.lempile.com/connect/" } ``` When the account works, Direct POSTs your `notify_url`: ```json { "status": "CREATION_SUCCESS", "account_id": "", "name": "user_42" } ``` Keep `account_id`: every other call names it. ```bash export ACCOUNT_ID="" curl -sS "$DIRECT/accounts/$ACCOUNT_ID" -H "X-API-KEY: $DIRECT_API_KEY" ``` The account is ready when `sources[0].status` is `OK`. ## 3. First Read ```bash curl -sS "$DIRECT/users/me?account_id=$ACCOUNT_ID" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` ```json { "object": "AccountOwnerProfile", "provider": "LINKEDIN", "provider_id": "ACoAAAbcdefghijklmnop", "first_name": "Ada", "last_name": "Sender", "public_identifier": "ada-sender", "public_profile_url": "https://www.linkedin.com/in/ada-sender/", "premium": true } ``` (Shortened.) Then the inbox: ```bash curl -sS "$DIRECT/chats?account_id=$ACCOUNT_ID&limit=20" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` ## 4. First Webhook Register a URL for new messages. Put your own secret in a header: Direct sends it with every delivery, and you check it. ```bash curl -sS -X POST "$DIRECT/webhooks" \ -H "X-API-KEY: $DIRECT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "request_url": "https://app.example.com/hooks/linkedin-messages", "source": "messaging", "name": "messages", "headers": [{ "key": "x-webhook-secret", "value": "your-own-secret" }] }' ``` ```json { "object": "WebhookCreated", "webhook_id": "" } ``` Send the account a LinkedIn message from another account. Within seconds, your URL receives a `message_received` event. Answer any `2xx`. See [Webhooks](https://lempile.com/docs/direct/webhooks) for the payload and the timing. ## 5. First Write, Not Sent Every write takes `?dry_run=true`: Direct answers the exact LinkedIn call it would make, and sends nothing. ```bash export CHAT_ID="" curl -sS -X POST "$DIRECT/chats/$CHAT_ID/messages?dry_run=true" \ -H "X-API-KEY: $DIRECT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "account_id": "'"$ACCOUNT_ID"'", "text": "Thanks, Tuesday works for me." }' ``` ```json { "object": "DryRun", "route": "chats.message", "method": "POST", "path": "/voyager/api/voyagerMessagingDashMessengerMessages?action=createMessage", "body": { "message": { "body": { "attributes": [], "text": "Thanks, Tuesday works for me." } } }, "status": 201 } ``` (Shortened.) To send it for real, drop `dry_run` and add an `Idempotency-Key` header, so a retry never sends it twice: ```bash curl -sS -X POST "$DIRECT/chats/$CHAT_ID/messages" \ -H "X-API-KEY: $DIRECT_API_KEY" \ -H "Idempotency-Key: reply-42" \ -H "Content-Type: application/json" \ -d '{ "account_id": "'"$ACCOUNT_ID"'", "text": "Thanks, Tuesday works for me." }' ``` ```json { "object": "MessageSent", "message_id": "", "id": "" } ``` An account whose writes aren't on yet answers `403` with title `Writes off` (`errors/insufficient_permissions`). Dry runs work either way. ## Next - [Errors And Limits](https://lempile.com/docs/direct/errors-and-limits): what each error means and how to retry. - [Chats And Messages](https://lempile.com/docs/direct/chats-and-messages): files, InMail, ids. - [Migrating From Unipile](https://lempile.com/docs/direct/migrating-from-unipile): moving an existing Unipile integration. --- # Lempile Direct: Authentication And Accounts > API keys, account ids, account statuses, resync, removal, writes per account, and connecting accounts with hosted auth. ## API Keys Every API call carries a Direct API key in the `X-API-KEY` header, as with Unipile: ```bash curl -sS "https://direct.lempile.com/api/v1/accounts" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` - Only the header is read (no `api_key` query parameter). - A missing, wrong or revoked key answers `401` with `"type": "errors/missing_credentials"`, on every route, before anything else is checked. - Direct stores only each key's SHA-256 hash, never the key itself, and never writes a key in a log or an answer. - Two routes are public, with no key: `GET /api/v1/openapi.json` (this API's OpenAPI document) and `GET /docs` (its reference page). ### Keys And Workspaces Every key belongs to one Lempile workspace, and sees and acts on **that workspace's accounts and webhooks only**. - **Getting a key.** A Lempile admin creates it for your workspace in Lempile's dashboard (Direct → API keys). It starts with `ldk_` and is shown once, when it's made: store it as a secret. Ask Lempile for one; each app should have its own. A workspace has at most 50 active keys. - **Revoking a key.** A Lempile admin revokes it in the same place. A revoked key answers `401 errors/missing_credentials` at once, on every route, for good. - **Accounts.** `GET /accounts` lists your workspace's accounts only, and its `total_count` and `status_counts` count those only. Any other account id, whether it belongs to another workspace or doesn't exist, answers exactly the same `404 errors/resource_not_found` (title `Account not found`), on every read, write (dry runs included), account, resync and hosted reconnect route, before any LinkedIn call. A key never learns that another workspace's account exists. - **Webhooks** belong to the workspace of the key that created them. `GET /webhooks` lists your workspace's only; another workspace's webhook id answers `404` to `DELETE`. Only your workspace's accounts send to your webhooks: an account id of another workspace named in `account_ids` is kept but never sends, and its name is never answered. - **Hosted auth.** A new account connected through your key's link joins your workspace. A reconnect link can only name one of your workspace's accounts (served, or removed earlier); any other answers `404`. - **Limits are per account**, not per key: two keys using one account share its pacing and daily caps (see [Errors And Limits](https://lempile.com/docs/direct/errors-and-limits)). - **Writes** are still turned on per account by Lempile (see [Writes Per Account](#writes-per-account)). - Lempile's own admin keys see every workspace, and are the only keys Direct's internal routes (`/api/v1/admin/*`, `/api/v1/canary`) answer; any other key gets `403 errors/insufficient_permissions` there. Those routes aren't part of this API. ## Account IDs An account id is a **Lempile account id** (a UUID). It names one LinkedIn account connected in Lempile: its own browser, its own proxy, its own LinkedIn session. ```bash curl -sS "https://direct.lempile.com/api/v1/accounts" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` ```json { "object": "AccountList", "items": [ { "object": "Account", "type": "LINKEDIN", "id": "00000000-0000-4000-8000-0000000000a1", "name": "Ada Sender", "created_at": "2026-10-28T09:12:44.512Z", "connection_params": { "im": { "id": "ACoAAAbcdefghijklmnop", "publicIdentifier": "ada-sender", "username": "Ada Sender", "premiumId": null, "premiumContractId": null, "premiumFeatures": ["premium"], "organizations": [] } }, "groups": [], "sources": [{ "id": "00000000-0000-4000-8000-0000000000a1_MESSAGING", "status": "OK" }] } ], "cursor": null, "total_count": 1, "status_counts": { "OK": 1, "CONNECTING": 0, "CREDENTIALS": 0, "STOPPED": 0, "ERROR": 0 } } ``` Where the account id goes: | Routes | Where | | --- | --- | | Every read (`GET /users/...`, `/chats/...`, `/posts/...`, `POST /linkedin/search`) | `?account_id=` query parameter, required | | Writes with a body (`POST /users/invite`, `/chats`, `/chats/{chat_id}/messages`, `/posts`, `/posts/{post_id}/comments`, `/posts/reaction`) | `account_id` in the body, or `?account_id=` | | `DELETE` writes (`/users/invite/sent/{id}`, `/posts/{post_id}`, `/posts/{post_id}/comments/{comment_id}`) | `?account_id=` query parameter, required | | `/accounts/{account_id}` routes | the path | Unlike Unipile, **every inbox call names its account**, `GET /chats/{chat_id}` and `POST /chats/{chat_id}/messages` included: a chat id is LinkedIn's own thread id, which doesn't say which account it belongs to. An account id Direct doesn't serve (unknown, removed, or another workspace's) answers `404` with `"type": "errors/resource_not_found"` and title `Account not found`. ## Account Status `sources[0].status` is what Direct has seen, never a guess: | Status | Meaning | What to do | | --- | --- | --- | | `OK` | LinkedIn answered the account's last call (any read, write or check). | Nothing. | | `CONNECTING` | Nothing has answered yet: a new account, before its first check. | Wait; `GET /accounts/{id}` checks it. | | `CREDENTIALS` | LinkedIn refused the account's session (signed out, or a security check), or its browser is signed out. | Reconnect it with a hosted auth link (`type: "reconnect"`). | | `ERROR` | The account's browser or proxy gave no working session, at least twice over 10 minutes with no call succeeding meanwhile. A single hiccup or a slow start is never `ERROR`. | Try a resync in a few minutes; if it stays, contact Lempile. | - `GET /accounts/{account_id}` checks the account first when its status is older than 10 minutes (15 while it's failing): one cheap LinkedIn call through its own session. - For 5 minutes after LinkedIn signs an account out, every read and write for it answers `401` `errors/disconnected_account` at once, without asking LinkedIn again (`GET /accounts/{account_id}` still answers, with `CREDENTIALS`). - A change of status sends the `account_status` webhook (see [Webhooks](https://lempile.com/docs/direct/webhooks)). ## Resync ```bash curl -sS -X POST "https://direct.lempile.com/api/v1/accounts/$ACCOUNT_ID/resync" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` `GET /accounts/{account_id}/sync` (Unipile's form) does the same. Direct drops the session it kept, reads a fresh one from the account's browser, and checks it with LinkedIn: | Answer | Meaning | | --- | --- | | `200 {"object": "AccountResync", "status": "SYNC_DONE"}` | The fresh session works. The `account_status` webhook `SYNC_SUCCESS` is sent. | | `200 {"object": "AccountResync", "status": "SYNC_ERROR"}` | The browser or the proxy didn't give a working session. Try again in a few minutes. | | `401 errors/disconnected_account` | LinkedIn signed the account out. Reconnect it. | ## Removing An Account ```bash curl -sS -X DELETE "https://direct.lempile.com/api/v1/accounts/$ACCOUNT_ID" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` ```json { "object": "AccountDeleted" } ``` - Direct stops serving the account, and it stays off across restarts. Its kept session is dropped, and the `account_status` webhook `DELETED` is sent. - The LinkedIn session, the browser and the Lempile account are untouched: Direct never signs anyone out of LinkedIn. `provider_session_revoke=true` answers `501`. - A removed account can come back through a hosted auth link with `type: "reconnect"` and its id. ## Writes Per Account Writes are **off by default** for each account. Lempile turns them on per account. Until then, a write answers `403`: ```json { "title": "Writes off", "detail": "This account doesn't write through Lempile Direct.", "type": "errors/insufficient_permissions", "status": 403 } ``` Dry runs (`?dry_run=true`) work for every served account, writes on or off. ## Connecting Accounts: Hosted Auth `POST /api/v1/hosted/accounts/link` takes Unipile's body and answers a link to a page Direct serves: | Field | Required | Notes | | --- | --- | --- | | `type` | yes | `create` (a new account) or `reconnect` | | `api_url` | yes | Any non-empty string, as Unipile requires it (Direct doesn't use it). | | `providers` | for `create` | One provider, a category or a list, taking LinkedIn: `"LINKEDIN"`, `["LINKEDIN"]`, `"*"` or `"*:MESSAGING"`. Optional for `reconnect`; when given, it must take LinkedIn too. | | `expiresOn` | yes | ISO 8601 UTC, in the future. The link lasts 24 hours at most, whatever this says. | | `reconnect_account` | for `reconnect` | The account id to sign in again: one of your workspace's (a removed one works too). | | `name` | no | Your reference (1 to 500 characters), sent back to `notify_url`. | | `success_redirect_url`, `failure_redirect_url` | no | https. Where the person lands. | | `notify_url` | no | https. Direct POSTs `{status, account_id, name}` there when the account works. | | `bypass_success_screen` | no | Accepted, no effect: with `success_redirect_url`, Direct redirects at once. | Unipile's other options (`disabled_features`, `disabled_options`, `proxy`, `sync_limit`, `google_scopes`, `microsoft_scopes`, `single_use`) are accepted and ignored. Direct answers `200` with `{"object": "HostedAuthUrl", "url": "https://direct.lempile.com/connect/"}`. What happens next: 1. The person opens the `url`. A new account will join your key's workspace. The page says "Connect your LinkedIn account" (or "Reconnect") with Cancel and Continue. 2. Continue goes to Lempile's own LinkedIn sign-in, in a real browser on Lempile's servers, with LinkedIn's security checks and codes handled there. Direct never sees the password. The person chooses how to sign in: **Credentials**, **Cookies**, or **Extension**, which connects the LinkedIn account already open in their own Chrome through Lempile's Chrome extension ([Chrome Extension](https://lempile.com/docs/direct/chrome-extension)), as Unipile's UniLogin does. 3. Back on Direct, the account is served and its session checked (up to 3 tries, 20 seconds apart, for a fresh browser). 4. When it works: Direct POSTs `notify_url` with exactly `{"status": "CREATION_SUCCESS" | "RECONNECTED", "account_id", "name"}` (retried like a webhook), sends the `account_status` webhooks, and redirects (303) to `success_redirect_url`. 5. A cancel, a failed sign-in or a session that doesn't work redirects to `failure_redirect_url`. A reconnect that comes back with a different account fails. Notes: - The link's token holds only a random id and its expiry. The redirect and notify URLs stay on Direct's server, encrypted, and never appear in a URL. - An expired link shows "This link has expired" (`410`). The way back from the sign-in stays open 30 minutes past the link's expiry, for a sign-in that took long. - One link starts at most 5 sign-in attempts. A reconnect keeps Lempile's own limit (3 failed attempts in 6 hours). - `notify_url` gets no extra header: put your own secret in the URL and check it. - Direct never signs anyone in or out of LinkedIn itself: the sign-in is Lempile's, in the account's own browser. --- # Lempile Direct: Chrome Extension > Connect a LinkedIn account from the person's own Chrome with the Lempile Connect extension, without a password or copied cookies: what it reads, what it sends, and where. **Lempile Connect** is Lempile's Chrome extension ([Chrome Web Store](https://chromewebstore.google.com/detail/jmgepijogciljnamndllchedgfjhdpdd)). It connects the LinkedIn account already signed in on a person's own Chrome to Lempile, without typing a password and without copying cookies by hand. It does what Unipile's UniLogin extension does for Unipile's hosted auth. ## Where It Appears Every LinkedIn connect page of Lempile offers three ways to sign in: **Credentials**, **Cookies** and **Extension**. That includes the page your hosted auth links open (`POST /api/v1/hosted/accounts/link`, see [Authentication And Accounts](https://lempile.com/docs/direct/authentication-and-accounts)). Nothing changes in your API calls: the account, its `account_id`, the `notify_url` call and the webhooks are the same whichever way the person signs in. Unipile's `unilogin` option on the link is accepted and has no effect: the Extension tab is always there. ## What The Person Does 1. On the connect page, they choose **Extension**. 2. If the extension isn't in their Chrome yet, the page shows **Install for Chrome**, which opens [its Chrome Web Store page](https://chromewebstore.google.com/detail/jmgepijogciljnamndllchedgfjhdpdd), and **I already installed it**. 3. They click **Connect**. The extension opens its own small window. It names the site that asked and lists exactly what will be sent. 4. They click **Connect** in that window. The window closes, and the connect page carries on as for any sign-in: checks, then the account is connected. If they aren't signed in to LinkedIn in that Chrome, the window says so and offers **Open LinkedIn**, then **Check again**. ## What The Extension Reads And Sends Only after the click in its own window, and once, to that one connection: - the LinkedIn session of that Chrome: the `li_at` cookie, `li_a` when the account has Sales Navigator or Recruiter, and the other cookies Chrome keeps for linkedin.com (such as `bcookie` and `JSESSIONID`), which tell LinkedIn it is still the same browser; - that browser's user agent, languages, time zone and client hints (the same fields Unipile's cookie connect takes: `user_agent`, `user_language`, `user_languages`, `user_timezone`). The session goes straight from the extension to Lempile's server over HTTPS. The connect page itself never sees a cookie, and neither does your app. ## How The Handoff Is Protected - The connect page first asks Lempile's server for a **one-time handoff**: valid for 5 minutes, used once, for that page's own sign-in only (that console user, or that hosted auth link) and for that account only on a reconnect. - The extension accepts requests only from Lempile's own pages. It sends only to the same Lempile site that asked, on one fixed path. Lempile's server accepts that POST only from a Chrome extension. - Lempile keeps the session encrypted while it waits, and wipes it the moment the sign-in starts. A handoff nobody used is wiped after its 5 minutes. - The extension stores nothing: no cookie, no history, no settings. It never runs in the background, and it reads nothing until the person clicks Connect in its window. ## Keeping The Account Connected The connected account uses the same LinkedIn session as the person's Chrome. If the person signs out of LinkedIn in that Chrome, LinkedIn ends that session everywhere, Lempile included, and the account must be reconnected. Ask people to stay signed in to LinkedIn in the Chrome they connected from. ## Permissions | Permission | Why | | --- | --- | | `cookies`, on `*.linkedin.com` | To read the LinkedIn session of that Chrome, after the click. | | `lempile.com`, `admin.lempile.com` | To see that a Lempile connect page asks for it, and to send the session to that page's handoff. | Nothing else: no access to other sites, no browsing history, no storage, no background activity. Privacy policy: [lempile.com/privacy/chrome-extension](https://lempile.com/privacy/chrome-extension). --- # Lempile Direct: Users And Profiles > The account's own profile, any profile with its sections, and lookup by profile URL. Every route here is a read: it takes `?account_id=` and answers Unipile's objects. ## The Account's Own Profile ```bash curl -sS "https://direct.lempile.com/api/v1/users/me?account_id=$ACCOUNT_ID" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` ```json { "object": "AccountOwnerProfile", "provider": "LINKEDIN", "provider_id": "ACoAAAbcdefghijklmnop", "entity_urn": "urn:li:fsd_profile:ACoAAAbcdefghijklmnop", "object_urn": "urn:li:member:123", "first_name": "Ada", "last_name": "Sender", "profile_picture_url": "https://media.licdn.com/dms/image/x/400.jpg", "public_profile_url": "https://www.linkedin.com/in/ada-sender/", "public_identifier": "ada-sender", "email": "ada@example.com", "premium": true, "open_profile": true, "organizations": [], "recruiter": null, "sales_navigator": null, "headline": "Founder", "occupation": "Founder", "location": "Paris, Île-de-France, France" } ``` Three LinkedIn calls the first time, then kept for an hour. `organizations` is always `[]`, `recruiter` and `sales_navigator` always `null`. ## A Profile ```bash curl -sS "https://direct.lempile.com/api/v1/users/ada-sender?account_id=$ACCOUNT_ID" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` `{identifier}` can be: - a provider id (`ACoAAAbcdefghijklmnop`), the id every write takes; - a public identifier (`ada-sender`); - `urn:li:fsd_profile:…`; - a profile URL, URL-encoded (`https%3A%2F%2Fwww.linkedin.com%2Fin%2Fada-sender%2F`). ```json { "object": "UserProfile", "provider": "LINKEDIN", "provider_id": "ACoAAAzyxwvutsrqponml", "public_identifier": "bob-buyer", "first_name": "Bob", "last_name": "Buyer", "headline": "Head of Sales", "websites": ["https://example.com"], "is_premium": false, "is_influencer": false, "is_creator": false, "is_open_profile": true, "is_relationship": true, "is_self": false, "public_profile_url": "https://www.linkedin.com/in/bob-buyer/", "member_urn": "123", "location": "Boston, Massachusetts, United States", "profile_picture_url": "https://media.licdn.com/dms/image/x/100.jpg", "profile_picture_url_large": "https://media.licdn.com/dms/image/x/800.jpg", "background_picture_url": "https://media.licdn.com/dms/image/x/800.jpg", "network_distance": "FIRST_DEGREE", "connected_at": 1761000000000, "follower_count": 973, "connections_count": 970, "shared_connections_count": 1, "is_verified": true, "contact_info": { "emails": ["bob@example.com"] } } ``` - Three LinkedIn calls, as Unipile answers a profile: the profile's top card, the profile page's second card (`follower_count`, `connections_count`, `shared_connections_count` when LinkedIn shows mutual connections, `is_verified`) and its contact info (`websites`, `contact_info`: `emails`, `phones`, `adresses`, `socials`, as the member shares them with the account; `birthdate` when shared). - Someone from the account's conversations of the last half hour, read by provider id without sections, is answered from what the conversation showed, with no LinkedIn call: names, headline, picture, link and degree only. - `network_distance` is `FIRST_DEGREE`, `SECOND_DEGREE`, `THIRD_DEGREE` or `OUT_OF_NETWORK`; it's absent for the account itself (`is_self: true`). `connected_at` (ms) is a connection's date. - `invitation` appears when an invitation is between the account and this person: `SENT` by the account, or `RECEIVED` from them; `status` `PENDING`, or `IGNORED` for a received one the account ignored. - Pictures are Unipile's sizes: `profile_picture_url` 100 px, `profile_picture_url_large` the largest, `background_picture_url` 800 × 200. - Keys LinkedIn has no value for are left out (a profile with no location has no `location`). - An unknown profile answers `404` `errors/resource_not_found`. `linkedin_api` (Recruiter, Sales Navigator) answers `501`. ### Sections `linkedin_sections` adds the profile's sections, as Unipile's: ```bash curl -sS "https://direct.lempile.com/api/v1/users/ada-sender?account_id=$ACCOUNT_ID&linkedin_sections=experience,skills_preview" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` | Value | Adds | | --- | --- | | `about` | `summary` | | `experience` | `work_experience` (every position, grouped by company, newest first, with locations), `work_experience_total_count` | | `education` | `education`, `education_total_count` | | `skills` | `skills` (every skill), `skills_total_count` | | `languages` | `languages`, `languages_total_count` | | `certifications` | `certifications`, `certifications_total_count` | | `volunteering_experience` | `volunteering_experience`, `volunteering_experience_total_count` | | `projects` | `projects`, `projects_total_count` | | `recommendations_received`, `recommendations_given` | `recommendations.received`, `recommendations.given` and their totals | | `recruiting_activity` | `recruiting_activity`, always `[]` | | `*` | every section, in full | | `_preview`, `*_preview` | the same section; only `skills_preview` differs from `skills`: the skills the profile shows first, without reading them all | - Repeat the parameter or separate values with commas. Full wins when a section is asked both ways. - Dates are Unipile's `month/day/year`, on the 1st of the month: `"2/1/2024"`. A current position has `"end": null` and `"current": true`. - Sections cost more LinkedIn calls: the full profile (for `about`, `education`, `skills`, `languages`, `certifications`, `volunteering_experience`, `projects`), the positions (`experience`), every skill (`skills` in full, when the profile has more than it shows), and one per kind of recommendation: 1 to 5 more calls. Ask only the sections you use. - An unknown section name answers `400` `errors/invalid_parameters`. - Skills carry no endorsements: `endorsement_count` is always `0`. ```json { "work_experience": [ { "id": "2398765", "position": "Founder", "company": "Example Co", "skills": [], "current": true, "start": "2/1/2024", "end": null, "company_id": "1035", "company_url": "https://www.linkedin.com/company/example-co/", "location": "Paris, Île-de-France, France", "description": "Building it.", "status": "Full-time" } ], "work_experience_total_count": 1 } ``` ### Light Reads (Lempile Only) `lempile_light=true` is Direct's own, not Unipile's: it reads the profile's top card and the sections asked, nothing else. Every LinkedIn call counts against the account's daily cap, so ask for it when you don't use the second card's counts or the contact details. ```bash curl -sS "https://direct.lempile.com/api/v1/users/ada-sender?account_id=$ACCOUNT_ID&linkedin_sections=experience&lempile_light=true" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` | Read | LinkedIn calls | With `lempile_light=true` | | --- | --- | --- | | No section | 3 | 1 | | `linkedin_sections=experience` | 4 | 2 | | Any other sections | 3 + the sections' calls | 1 + the sections' calls | - Left out, never answered empty, since their reads are skipped: `follower_count`, `connections_count`, `shared_connections_count`, `is_verified` (the second card), `websites`, `contact_info` and `birthdate` (the contact info). `websites` is the one key a Unipile answer always has; a light answer doesn't. - Without it, or with `lempile_light=false`, the answer is Unipile's, exactly as above. - Only on `GET /users/{identifier}`. A profile link works there as the identifier, URL-encoded. ## Lookup By Profile URL ```bash curl -sS "https://direct.lempile.com/api/v1/users?account_id=$ACCOUNT_ID&provider_url=https%3A%2F%2Fwww.linkedin.com%2Fin%2Fada-sender%2F" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` Answers the `UserProfile` itself, as `GET /users/{identifier}` does. Without `provider_url`, `GET /users` lists everyone the account has a conversation with (as `GET /chat_attendees`, see [Chats And Messages](https://lempile.com/docs/direct/chats-and-messages)). ## A Profile's Posts See [Posts](https://lempile.com/docs/direct/posts): `GET /users/{identifier}/posts`. ## A Member's Comments And Reactions ```bash curl -sS "https://direct.lempile.com/api/v1/users/ACoAAAbcdefghijklmnop/comments?account_id=$ACCOUNT_ID&limit=10" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` ```json { "object": "CommentList", "items": [ { "object": "Comment", "id": "7391000000000000001", "post_id": "7390000000000000004", "post_urn": "urn:li:activity:7390000000000000004", "author": "Ada Sender", "author_details": { "id": "ACoAAAbcdefghijklmnop", "headline": "Founder", "profile_url": "https://www.linkedin.com/in/ada-sender", "profile_picture_url": null, "network_distance": null }, "date": "2025-10-24T10:00:00.000Z", "text": "Great point", "reaction_counter": 3, "reply_counter": 1 } ], "cursor": null, "paging": { "page_count": 1 } } ``` `GET /users/{identifier}/reactions` lists the posts the member reacted to (`PostReactionList`: `value` is the reaction LinkedIn shows, `post_id` the post). Both read the member's profile activity, 20 posts a LinkedIn call; `{identifier}` is a provider id, a public identifier (one more read) or `me`. --- # Lempile Direct: Relations And Invitations > Connections, sent invitations, sending and withdrawing invitations, and LinkedIn's refusals. ## Relations The account's connections, newest first. ```bash curl -sS "https://direct.lempile.com/api/v1/users/relations?account_id=$ACCOUNT_ID&limit=100" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` ```json { "object": "UserRelationsList", "items": [ { "object": "UserRelation", "first_name": "Bob", "last_name": "Buyer", "headline": "Head of Sales", "public_identifier": "bob-buyer", "public_profile_url": "https://www.linkedin.com/in/bob-buyer/", "created_at": 1761000000000, "member_id": "ACoAAAzyxwvutsrqponml", "member_urn": "urn:li:fsd_profile:ACoAAAzyxwvutsrqponml", "connection_urn": "urn:li:fsd_connection:ACoAAAzyxwvutsrqponml", "profile_picture_url": "https://media.licdn.com/dms/image/x/400.jpg" } ], "cursor": "eyJrIjoicmVsYXRpb25zIiwicyI6MTAwfQ" } ``` - `limit`: 1 to 1,000 (default 100). LinkedIn gives 100 a call, so a page of 1,000 costs 10 calls. - `member_id` is the relation's provider id: what writes take as `provider_id` or `attendees_ids`. - `created_at` is when the connection was made, in milliseconds. - `filter` (search relations by name) answers `501`. - New relations also arrive as the `users` webhook `new_relation` (see [Webhooks](https://lempile.com/docs/direct/webhooks)). ## Followers The account's followers, newest first, as My Network → Followers lists them. ```bash curl -sS "https://direct.lempile.com/api/v1/users/followers?account_id=$ACCOUNT_ID&limit=100" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` ```json { "object": "UserFollowersList", "items": [ { "object": "UserFollower", "id": "ACoAAAfollower00000000", "urn": "urn:li:fsd_profile:ACoAAAfollower00000000", "name": "Follower 0", "headline": "Founder at Example 0", "profile_url": "https://www.linkedin.com/in/ACoAAAfollower00000000", "profile_picture_url": "https://media.licdn.com/dms/image/f0/100.jpg", "profile_picture_url_large": "https://media.licdn.com/dms/image/f0/800.jpg" } ], "cursor": "" } ``` - One LinkedIn call a page; `limit` 1 to 100 (default 100). LinkedIn may answer a few less than asked; the next page starts after the ones asked, as Unipile's. - `user_id`: the account's own provider id is its own list; another member's answers an empty list (LinkedIn shows a member's follower count, never the list, to another account; Unipile answers the same); a company's answers `501`. - `GET /users/following` answers Unipile's own `501` for LinkedIn (`errors/feature_not_implemented`, "Missing feature"). ## Sent Invitations Invitations the account sent that are still waiting, newest first. ```bash curl -sS "https://direct.lempile.com/api/v1/users/invite/sent?account_id=$ACCOUNT_ID&limit=100" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` ```json { "object": "InvitationList", "items": [ { "object": "InvitationSent", "id": "7300000000000000001", "invited_user": "Bob Buyer", "invited_user_id": "ACoAAAzyxwvutsrqponml", "invited_user_public_id": "bob-buyer", "invited_user_description": "Founder", "date": "2025-10-24T10:00:00.000Z", "parsed_datetime": "2025-10-24T10:00:00.000Z", "invitation_text": "Hi Bob", "specifics": { "provider": "LINKEDIN", "shared_secret": "" }, "inviter": { "inviter_name": "Ada Sender", "inviter_id": "ACoAAAbcdefghijklmnop", "inviter_public_identifier": "ada-sender", "inviter_description": "Founder" } } ], "cursor": null } ``` `limit`: 1 to 100 (default 10). ## Send An Invitation ```bash curl -sS -X POST "https://direct.lempile.com/api/v1/users/invite" \ -H "X-API-KEY: $DIRECT_API_KEY" \ -H "Idempotency-Key: invite-bob-1" \ -H "Content-Type: application/json" \ -d '{ "account_id": "'"$ACCOUNT_ID"'", "provider_id": "ACoAAAzyxwvutsrqponml", "message": "Hi Bob, good to meet you at the meetup." }' ``` ```json { "object": "UserInvitationSent", "invitation_id": "7300000000000000002" } ``` | Field | | | --- | --- | | `account_id` | The account that invites (or `?account_id=`). | | `provider_id` | The person: provider id, public identifier or profile URL. | | `message` | Optional note, 300 characters at most. | | `user_email` | Optional: the person's email address, when LinkedIn asks for it. | Direct reads the person's profile first (one call), because LinkedIn itself accepts an invitation to someone already connected. Then it sends the invitation (one write). Status `200`, as Unipile. | Refusal | Status | `type` | | --- | --- | --- | | Already a connection | 422 | `errors/already_connected` | | An invitation from the account is already waiting | 422 | `errors/already_invited_recently` | | The account itself, or someone whose invitation to the account is waiting (accept theirs instead) | 422 | `errors/cannot_invite_attendee` | | No profile with this id | 422 | `errors/invalid_recipient` | | LinkedIn's weekly invitation limit, or a withdrawn invitation sent again too soon | 422 | `errors/cannot_resend_yet` | | Too many invitations waiting for an answer | 422 | `errors/limit_exceeded` | | The account's connection limit | 422 | `errors/connection_limit_reached` | | LinkedIn wants the account to confirm its email address | 403 | `errors/action_required` | `invitation_id` is empty when LinkedIn's answer didn't name the new invitation; it then appears in `GET /users/invite/sent`. ## Withdraw An Invitation ```bash curl -sS -X DELETE "https://direct.lempile.com/api/v1/users/invite/sent/7300000000000000001?account_id=$ACCOUNT_ID" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` ```json { "object": "InvitationCanceled" } ``` - Direct finds the invitation among the account's latest 100 sent (one read), then withdraws it. One not among them answers `404`. - LinkedIn then blocks a new invitation to that person for about 3 weeks (`errors/cannot_resend_yet`). Both writes take `?dry_run=true` and an `Idempotency-Key` (see [Errors And Limits](https://lempile.com/docs/direct/errors-and-limits)). ## Received Invitations ```bash curl -sS "https://direct.lempile.com/api/v1/users/invite/received?account_id=$ACCOUNT_ID&limit=10" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` ```json { "object": "InvitationList", "items": [ { "object": "InvitationReceived", "id": "7400000000000000000", "invited_user": "Ada Sender", "invited_user_id": "ACoAAAbcdefghijklmnop", "invited_user_public_id": "ada-sender", "invited_user_description": "Founder", "date": "2025-10-24T10:00:00.000Z", "parsed_datetime": "2025-10-24T10:00:00.000Z", "invitation_text": "Hi Ada, let's connect", "inviter": { "inviter_name": "Bob Buyer", "inviter_id": "ACoAAAzyxwvutsrqponml", "inviter_public_identifier": "bob-buyer", "inviter_description": "CTO" }, "specifics": { "provider": "LINKEDIN", "shared_secret": "s3cret0", "invitation_type": "CONNECTION" } } ], "cursor": null } ``` Invitations waiting for the account's answer, newest first: `inviter` is who sent it, `invited_user` the account itself. ## Accept Or Decline One ```bash curl -sS -X POST "https://direct.lempile.com/api/v1/users/invite/received/7400000000000000000" \ -H "X-API-KEY: $DIRECT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "provider": "LINKEDIN", "account_id": "'"$ACCOUNT_ID"'", "action": "accept", "shared_secret": "s3cret0" }' ``` ```json { "object": "UserInvitationHandled", "status": "ACCEPTED" } ``` - `action`: `accept`, or `decline` (LinkedIn's Ignore: the inviter isn't told). `shared_secret` is the invitation's `specifics.shared_secret`. - Direct finds the invitation among the account's latest 100 received (one read) first: one not among them answers `404`, a `shared_secret` that isn't its own `400`. - Only invitations to connect (`specifics.invitation_type` `CONNECTION`). LinkedIn also lists invitations to subscribe to a newsletter (`CONTENT_SERIES`), follow a page (`ORGANIZATION`) or attend an event (`EVENT`), with no `inviter`; Direct answers `422 errors/unprocessable_entity` for those and sends LinkedIn nothing. - LinkedIn's connection limit answers `422 errors/connection_limit_reached`. It takes `?dry_run=true` and an `Idempotency-Key`, as every write. --- # Lempile Direct: Chats And Messages > The LinkedIn inbox: chat and message ids, chats, messages, attendees, starting a chat, sending messages and files. The account's LinkedIn inbox, in Unipile's `Chat`, `Message` and `ChatAttendee` objects. Every call names its account with `account_id`, the writes included. ## Chat And Message IDs - A chat's id is LinkedIn's own conversation id (`2-` and base64), a message's LinkedIn's own message id. - Direct answers them **URL-safe and unpadded** (`+` becomes `-`, `/` becomes `_`, no trailing `=`), so they fit `[A-Za-z0-9_-]` and go in a path as they are: `2-QUFBQXRocmVhZPv_b25lMQ`. - Every route that takes one also takes LinkedIn's own form, URL-encoded (`2-QUFBQXRocmVhZPv%2Fb25lMQ%3D%3D`), and maps it back. - They are not Unipile ids: an id stored from Unipile doesn't resolve here. Read the chats again from Direct. ## List Chats ```bash curl -sS "https://direct.lempile.com/api/v1/chats?account_id=$ACCOUNT_ID&limit=20" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` ```json { "object": "ChatList", "items": [ { "object": "Chat", "id": "2-QUFBQXRocmVhZPv_b25lMQ", "account_id": "00000000-0000-4000-8000-0000000000a1", "account_type": "LINKEDIN", "provider_id": "2-QUFBQXRocmVhZPv_b25lMQ", "name": null, "type": 0, "timestamp": "2026-10-29T09:41:07.000Z", "unread_count": 1, "archived": 0, "muted_until": null, "read_only": 0, "folder": ["INBOX", "INBOX_LINKEDIN_CLASSIC"], "pinned": 0, "attendee_provider_id": "ACoAAAzyxwvutsrqponml" } ], "cursor": "" } ``` | Parameter | | | --- | --- | | `limit` | 1 to 250 (default 10). | | `cursor` | The previous page's `cursor`. | | `unread` | `true`: only chats with unread messages. | | `before`, `after` | Only chats last active before or after this time (ISO 8601 UTC, e.g. `2026-10-01T00:00:00.000Z`). | | `account_type` | `LINKEDIN` or nothing; anything else answers `400`. | - Newest activity first, the inbox and the archive together (LinkedIn's spam folder isn't read). - The newest 20 come from LinkedIn's inbox sync in one call, kept for a minute. When those 20 hold a conversation LinkedIn files in no box, the page is filled from the inbox and the archive instead (2 more calls), and that's kept for a minute too. Further pages, `before`, `after`, `unread` or a `limit` over 20 walk the inbox and the archive by last activity, 25 a call, so a cursor reaches the whole inbox. - `type` is `0` for one person, `1` for a group. `attendee_provider_id` is the other person in a one-to-one chat. - `read_only: 1` when nobody can answer (LinkedIn's sponsored messages: `content_type: "linkedin_offer"` for the ones LinkedIn labels "LinkedIn Offer", `"sponsored"` for the others). `content_type: "inmail"` for an InMail. - `folder` holds the chat's box (`INBOX`, `ARCHIVED`, `OTHER`, `PENDING`, `SPAM`) and `INBOX_LINKEDIN_CLASSIC`. - `pinned` is always `0`; `muted_until` is `-1` when muted. ## One Chat ```bash curl -sS "https://direct.lempile.com/api/v1/chats/$CHAT_ID?account_id=$ACCOUNT_ID" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` The `Chat`, with its latest message as `lastMessage`. Found among the newest conversations, else read from LinkedIn by its id; an unknown id answers `404`. ## Messages ```bash curl -sS "https://direct.lempile.com/api/v1/chats/$CHAT_ID/messages?account_id=$ACCOUNT_ID&limit=20" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` ```json { "object": "MessageList", "items": [ { "object": "Message", "id": "2-_vptc2cwMTI5IQ", "provider_id": "2-_vptc2cwMTI5IQ", "account_id": "00000000-0000-4000-8000-0000000000a1", "chat_id": "2-QUFBQXRocmVhZPv_b25lMQ", "chat_provider_id": "2-QUFBQXRocmVhZPv_b25lMQ", "sender_id": "ACoAAAzyxwvutsrqponml", "sender_attendee_id": "ACoAAAzyxwvutsrqponml", "sender_urn": "urn:li:fsd_profile:ACoAAAzyxwvutsrqponml", "text": "Sounds good", "attachments": [], "timestamp": "2026-10-29T09:41:07.000Z", "is_sender": 0, "reactions": [], "seen": 0, "seen_by": {}, "hidden": 0, "deleted": 0, "edited": 0, "is_event": 0, "delivered": 1, "behavior": null, "original": "", "message_type": "MESSAGE", "attendee_type": "MEMBER", "attendee_distance": 2 } ], "cursor": "" } ``` - Newest first, back to the first message (LinkedIn gives 100 a call). `limit` 1 to 250 (default 20). - `before`, `after` (ISO 8601 UTC) and `sender_id` (a provider id) filter, as on Unipile. - `is_sender` is `1` for the account's own messages. `deleted: 1` (with `deleted_for: "everyone"`) when its sender took it back, `edited: 1` when edited, `is_event: 1` for an event LinkedIn writes in the conversation. - `reactions` holds the account's own reactions only; other people's reactions to a message aren't read. `seen` is always `0` and `seen_by` always `{}`. - `attachments`: images (`type: "img"`, with `size`), files (`type: "file"`, with `file_name`, `file_size`, `mimetype`) and voice notes (`type: "audio"`, `voice_note: true`, `duration` in milliseconds, `mimetype: "audio/mp4"`), each with a `url` (LinkedIn's signed link, which expires). An image LinkedIn hasn't processed yet comes with `unavailable: true` and no `url`. - `subject` on an InMail. `GET /messages/{message_id}?account_id=` answers one `Message` (with `account_type: "LINKEDIN"`), or `404` when LinkedIn doesn't know it. ## Attendees ```bash curl -sS "https://direct.lempile.com/api/v1/chats/$CHAT_ID/attendees?account_id=$ACCOUNT_ID" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` ```json { "object": "ChatAttendeeList", "items": [ { "object": "ChatAttendee", "id": "ACoAAAzyxwvutsrqponml", "account_id": "00000000-0000-4000-8000-0000000000a1", "provider_id": "ACoAAAzyxwvutsrqponml", "name": "Bob Buyer", "is_self": 0, "hidden": 0, "specifics": { "provider": "LINKEDIN", "member_urn": "urn:li:member:456", "occupation": "Head of Sales", "headline": "Head of Sales", "network_distance": "DISTANCE_2" }, "picture_url": "https://media.licdn.com/dms/image/x/400.jpg", "profile_url": "https://www.linkedin.com/in/ACoAAAzyxwvutsrqponml" } ], "cursor": null } ``` - The account itself is in the list with `is_self: 1` and `network_distance: "SELF"`. - `GET /chat_attendees?account_id=` lists everyone the account has a conversation with, newest conversation first, with a cursor (`limit` 1 to 250, default 100). With `chat_id`, that chat's attendees. - `GET /users?account_id=` without `provider_url` answers the same list. ## Start A Chat ```bash curl -sS -X POST "https://direct.lempile.com/api/v1/chats" \ -H "X-API-KEY: $DIRECT_API_KEY" \ -H "Idempotency-Key: first-message-bob" \ -H "Content-Type: application/json" \ -d '{ "account_id": "'"$ACCOUNT_ID"'", "attendees_ids": ["ACoAAAzyxwvutsrqponml"], "text": "Hi Bob, quick question about your post." }' ``` ```json { "object": "ChatStarted", "chat_id": "2-QUFBQXRocmVhZPv_b25lMQ", "message_id": "2-_vptc2cwMTMxIQ", "id": "2-QUFBQXRocmVhZPv_b25lMQ" } ``` Status `201`. Direct first reads the profile's "Message" option, as LinkedIn's profile page does (one call): | Case | Answer | | --- | --- | | The account can message the person for free (a connection, an open profile, a reply) | the message is sent | | It can't, and `linkedin[inmail]` isn't `true` | `422 errors/no_connection_with_recipient` | | `linkedin[inmail]=true`, and LinkedIn offers no InMail to this person | `422 errors/not_allowed_inmail` | | `linkedin[inmail]=true`, and the account has no InMail credit for them | `422 errors/insufficient_credits` | | `linkedin[inmail]=true`, and an InMail is offered | an InMail is sent, with `subject` | | The account itself | `422 errors/invalid_recipient` | - `attendees_ids` holds one person: a provider id, a public identifier or a profile URL. Several (a group conversation) answer `501`. - `linkedin[api]` is `classic` or absent; `recruiter` and `sales_navigator` answer `501`, as do `linkedin[topic]`, `linkedin[applicant_id]`, `linkedin[invitation_id]` and `linkedin[group_id]`. - `text` is 8,000 characters at most, and required unless a file or a voice note is sent. - A voice note (`voice_message`, see [Voice Notes](#voice-notes)) starts a chat the same way; never as an InMail (`501`). - InMail is built from LinkedIn's own web code and covered by tests, but hasn't been confirmed with a real InMail send yet. ## Send A Message ```bash curl -sS -X POST "https://direct.lempile.com/api/v1/chats/$CHAT_ID/messages" \ -H "X-API-KEY: $DIRECT_API_KEY" \ -H "Idempotency-Key: reply-42" \ -H "Content-Type: application/json" \ -d '{ "account_id": "'"$ACCOUNT_ID"'", "text": "Thanks, Tuesday works for me." }' ``` ```json { "object": "MessageSent", "message_id": "2-_vptc2cwMTMwIQ", "id": "2-_vptc2cwMTMwIQ" } ``` Status `201`. `id` and `message_id` are the same id, in the form `GET /chats/{chat_id}/messages` answers it. ## Files Both writes take files in Unipile's multipart form: ```bash curl -sS -X POST "https://direct.lempile.com/api/v1/chats/$CHAT_ID/messages" \ -H "X-API-KEY: $DIRECT_API_KEY" \ -F "account_id=$ACCOUNT_ID" \ -F "text=The deck we talked about" \ -F "attachments=@deck.pdf;type=application/pdf" ``` - File fields: `attachments`, `attachments[]` or `attachments[0]`, `attachments[1]`…, and `video_message` (sent as a video). - Other fields in Unipile's bracket form: `attendees_ids[0]`, `linkedin[api]`, `linkedin[inmail]`. - Each file is 20 MB at most (`400 errors/content_too_large` above). Videos go as videos; images and every other file go as files, as LinkedIn's web app sends them. - Files go through LinkedIn's own uploader first (two or three calls each), then the message. - `quote_id` (quoting a message) answers `501`. ## Voice Notes ```bash curl -sS -X POST "https://direct.lempile.com/api/v1/chats/$CHAT_ID/messages" \ -H "X-API-KEY: $DIRECT_API_KEY" \ -H "Idempotency-Key: voice-42" \ -F "account_id=$ACCOUNT_ID" \ -F "linkedin[api]=classic" \ -F "voice_message=@voice_message.m4a;type=audio/m4a" ``` ```json { "object": "MessageSent", "message_id": "2-_vptc2cwMTMyIQ", "id": "2-_vptc2cwMTMyIQ" } ``` Status `201`, as for any message; `POST /chats` takes `voice_message` too. - A voice note goes alone, as in LinkedIn's apps: with `text` or files it answers `501`. - Any audio works: m4a (AAC, as Looply records it), mp3, ogg, webm/opus (a browser's recorder), wav, aac or flac, 20 MB at most. Direct turns it into LinkedIn's format, AAC in an .m4a file (AAC audio is kept as it is), and measures it. - 60 seconds at most, LinkedIn's limit: longer answers `422 errors/invalid_message`. A file that isn't audio answers `415 errors/unsupported_media_type`. Nothing is sent in either case. - LinkedIn gets three calls: the upload's registration (`mediaUploadType: VOICE_MESSAGE`), the file, then the message with the voice note as its `audio` (its asset, size and length). `?dry_run=true` shows all three, with the note's length and what it came as, and sends nothing. - Read back, it's an attachment of `type: "audio"` with `voice_note: true` and its `duration` in milliseconds. ## Delete A Message ```bash curl -sS -X DELETE "https://direct.lempile.com/api/v1/messages/$MESSAGE_ID?account_id=$ACCOUNT_ID" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` ```json { "object": "MessageDeleted" } ``` Status `200`. As LinkedIn's "Delete": the message is taken back for everyone, and reads show it with `deleted: 1`. - Only the account's own messages (someone else's answers `403`), and only within 60 minutes of sending it, LinkedIn's limit (`422 errors/unprocessable_entity` after). One already deleted answers `422 errors/action_already_performed`. - `account_id` is required, as on every inbox call. ## React To A Message ```bash curl -sS -X POST "https://direct.lempile.com/api/v1/messages/2-QUFBQXRocmVhZPv_b25lMQ/reaction" \ -H "X-API-KEY: $DIRECT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "account_id": "'"$ACCOUNT_ID"'", "reaction": "👍" }' ``` ```json { "object": "MessageReactionAdded", "success": true } ``` `DELETE /messages/{message_id}/reaction` with the same body (or `?reaction=`) takes it off: `{"object": "MessageReactionRemoved", "success": true}`. `reaction` is a native emoji. The message is read first (one call): an unknown one answers `404`. ## Edit A Message ```bash curl -sS -X PATCH "https://direct.lempile.com/api/v1/messages/2-QUFBQXRocmVhZPv_b25lMQ" \ -H "X-API-KEY: $DIRECT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "account_id": "'"$ACCOUNT_ID"'", "text": "Hi Bob, see you at 3pm" }' ``` ```json { "object": "MessagePatched" } ``` Only the account's own messages, within 60 minutes of sending them, as LinkedIn allows (as a deletion): Direct reads the message first, and someone else's answers `403 errors/insufficient_permissions`, an older one `422 errors/unprocessable_entity`. ## Mark A Chat Read, Mute It, Delete It ```bash curl -sS -X PATCH "https://direct.lempile.com/api/v1/chats/2-QUFBQXRocmVhZPv_b25lMQ" \ -H "X-API-KEY: $DIRECT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "account_id": "'"$ACCOUNT_ID"'", "action": "setReadStatus", "value": true }' ``` ```json { "object": "ChatPatched" } ``` - `action`: `setReadStatus` (`value: false` marks it unread) or `setMuteStatus`. Unipile's other actions are WhatsApp's and Telegram's: `422 errors/not_supported_by_provider`. - `DELETE /chats/{chat_id}?account_id=` deletes the conversation from the account's inbox (`{"object": "ChatDeleted"}`); the other people keep theirs. - The chat is read first (an unknown one answers `404`). Every write here takes `?dry_run=true` and an `Idempotency-Key`. ## Not Done These Unipile messaging routes answer `501 errors/feature_not_implemented`: archiving or pinning a chat (WhatsApp's), a chat's sync, a message's attachment download, forwarding, `GET /messages` and the `/chat_attendees/{attendee_id}` routes. See [Unipile Compatibility](https://lempile.com/docs/direct/unipile-compatibility). --- # Lempile Direct: Posts > A member's or a company's posts, one post, creating a post with mentions, images or a video, and deleting one. ## A Profile's Or A Company's Posts ```bash curl -sS "https://direct.lempile.com/api/v1/users/me/posts?account_id=$ACCOUNT_ID&limit=10" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` ```json { "object": "PostList", "items": [ { "object": "Post", "provider": "LINKEDIN", "id": "7388000000000000000", "social_id": "urn:li:activity:7388000000000000000", "share_url": "https://www.linkedin.com/posts/ada-sender_hello-activity-7388000000000000000-abcd", "text": "Hello\nworld", "date": "2d", "parsed_datetime": "2025-10-25T23:54:22.402Z", "reaction_counter": 12, "comment_counter": 3, "repost_counter": 1, "impressions_counter": 0, "author": { "public_identifier": "ada-sender", "id": "ACoAAAbcdefghijklmnop", "name": "Ada Sender", "is_company": false, "headline": "Founder", "profile_picture_url": "https://media.licdn.com/dms/image/x/400.jpg" }, "permissions": { "can_react": true, "can_share": true, "can_post_comments": true }, "is_repost": false, "attachments": [ { "id": "D1", "type": "img", "url": "https://media.licdn.com/dms/image/x/1280.jpg", "url_expires_at": 1900000000000, "size": { "width": 1280, "height": 1280 }, "mimetype": "image/jpeg", "unavailable": false, "sticker": false } ], "mentions": [] } ], "paging": { "page_count": 1 }, "cursor": "" } ``` - `{identifier}`: `me` for the account's own posts, or any profile identifier (provider id, public identifier, profile URL). - `is_company=true`: `{identifier}` is a company page (its id or its universal name, e.g. `example-co`). - `limit`: 1 to 100 (default 10). LinkedIn gives 20 posts a call. - `social_id` (`urn:li:activity:…`) is what comments and reactions take as `post_id`. - `date` is LinkedIn's relative date (`2d`); `parsed_datetime` is the exact time, read from the post's id. - `impressions_counter` is `0` unless LinkedIn shows views to the account. - `user_reacted` holds the account's own reaction (`LIKE`, `PRAISE`…) when it reacted. - `mentions`: each person or page named in the text, as `{start, length, url}`. - Attachments: images (`type: "img"`) and videos (`type: "video"`, with `duration` in seconds and `file_size`). Their `url` expires at `url_expires_at` (milliseconds). - A plain repost (no words of its own) is the reposted post as LinkedIn shows it: its `id`, `social_id`, `text`, `author` and counts are the original's, `is_repost` is `true`, `reposted_by` is who reposted, `repost_id` the repost's own activity id (what `POST /posts` answered; `DELETE /posts/{repost_id}` undoes it), `repost_parsed_datetime` when it was reposted, and `repost_content` holds the original (`id`, `date`, `parsed_datetime`, `text`, `author`, `attachments`). - A repost with words is the reposter's own post (`is_repost: false`, its words and author), with `repost_content` the post it shares. ## One Post ```bash curl -sS "https://direct.lempile.com/api/v1/posts/urn:li:activity:7388000000000000000?account_id=$ACCOUNT_ID" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` `{post_id}` can be the post's id (digits), `urn:li:activity:…`, a `urn:li:ugcPost:…` or `urn:li:share:…`, or the post's URL (URL-encoded). One LinkedIn call. An unknown post answers `404`. ## Create A Post ```bash curl -sS -X POST "https://direct.lempile.com/api/v1/posts" \ -H "X-API-KEY: $DIRECT_API_KEY" \ -H "Idempotency-Key: post-2026-10-29-1" \ -H "Content-Type: application/json" \ -d '{ "account_id": "'"$ACCOUNT_ID"'", "text": "We shipped it today. Thanks {{0}} for the review!", "mentions": [{ "name": "Bob Buyer", "profile_id": "ACoAAAzyxwvutsrqponml" }] }' ``` ```json { "object": "PostCreated", "post_id": "7389000000000000000", "id": "7389000000000000000", "social_id": "urn:li:activity:7389000000000000000", "external_post_id": "urn:li:activity:7389000000000000000", "share_url": "https://www.linkedin.com/feed/update/urn:li:activity:7389000000000000000/" } ``` Status `201`. The post is public, with comments open to everyone. | Field | | | --- | --- | | `account_id` | The account that posts (or `?account_id=`). | | `text` | 3,000 characters at most, mentions' names and an added link included. | | `mentions` | `[{name, profile_id, is_company?}]`, placed in `text` with `{{0}}`, `{{1}}`… A person's `profile_id` is their provider id (`ACo…`); a page's is its id (digits). Every mention must be placed, and every placeholder must have its mention. | | `external_link` | An `http(s)` link, added at the end of the text unless it's already in it. | | `as_organization` | Post as this company page (its id, digits). The account must be an admin of the page. | | `attachments` | Up to 20 images (jpg, png, gif, webp; 36 MB each), or one video (75 KB to 5 GB). Not both. | | `video_thumbnail` | An image for the video. | Files go in Unipile's multipart form (`attachments`, `attachments[]` or `attachments[0]`…): ```bash curl -sS -X POST "https://direct.lempile.com/api/v1/posts" \ -H "X-API-KEY: $DIRECT_API_KEY" \ -H "Idempotency-Key: post-2026-10-29-2" \ -F "account_id=$ACCOUNT_ID" \ -F "text=Two pictures from the meetup" \ -F "attachments=@one.jpg;type=image/jpeg" \ -F "attachments=@two.jpg;type=image/jpeg" ``` - Each file goes through LinkedIn's own uploader first; several images are grouped (one more call), then the post is created. - A video post may take up to 30 seconds more: Direct waits for LinkedIn to give the post its activity id. If it never does, `post_id` is the post's `urn:li:ugcPost:…` (or `urn:li:share:…`) and `share_url` is left out; if LinkedIn's answer names neither, Direct answers `504` (unknown outcome: check the account's posts before posting again). - A refusal LinkedIn names in its answer is `422 errors/invalid_post`. - `repost`, `include_job_posting` and `targeted_audience` answer `501`. - Requests reach Direct through Cloudflare, which limits a request body's size (100 MB on most plans) and a request's time (100 seconds). A large video can be refused there (`413`) or cut (`524`) before Direct answers; use an `Idempotency-Key` and see [Errors And Limits](https://lempile.com/docs/direct/errors-and-limits). ## Delete A Post ```bash curl -sS -X DELETE "https://direct.lempile.com/api/v1/posts/urn:li:activity:7389000000000000000?account_id=$ACCOUNT_ID" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` `204` with an empty body, as Unipile. Direct reads the post first: it must be the account's own (or a page's, as an admin); anyone else's answers `403 errors/insufficient_permissions`. The account's own plain repost (its `repost_id`) is undone as LinkedIn's "Delete repost" does: the repost goes, the reposted post stays. A repost with words is the account's own post and is deleted as one. Both writes take `?dry_run=true` and an `Idempotency-Key`. ## Repost ```bash curl -sS -X POST "https://direct.lempile.com/api/v1/posts" \ -H "X-API-KEY: $DIRECT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "account_id": "'"$ACCOUNT_ID"'", "repost": "7388000000000000000", "text": "" }' ``` ```json { "object": "PostCreated", "post_id": "7401000000000000001", "id": "7401000000000000001", "share_url": "https://www.linkedin.com/feed/update/urn:li:activity:7401000000000000001/" } ``` - `repost` is the post's id; with no `text` (or `""`) it's LinkedIn's instant repost, as a page with `as_organization`. With `text`, a repost with those words (mentions and `external_link` as for a post; no files: `400`). - Direct reads the post first (one call) for the share LinkedIn reposts. `post_id` is the new post's activity id, never the reposted one's; when LinkedIn names a plain repost only by its repost urn, `post_id` is that urn. --- # Lempile Direct: Comments And Reactions > A post's comments, replies and reactions; commenting, reacting, and Direct's routes to delete a comment or remove a reaction. `{post_id}` takes the post's id (digits), `urn:li:activity:…`, `urn:li:ugcPost:…`, `urn:li:share:…` or its URL (URL-encoded). A comment's id is digits, as `GET /posts/{post_id}/comments` answers it. ## List Comments ```bash curl -sS "https://direct.lempile.com/api/v1/posts/urn:li:activity:7388000000000000000/comments?account_id=$ACCOUNT_ID&sort_by=MOST_RECENT" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` ```json { "object": "CommentList", "items": [ { "object": "Comment", "id": "7390000000000000001", "post_id": "7388000000000000000", "post_urn": "urn:li:activity:7388000000000000000", "author": "Bob Buyer", "author_details": { "id": "ACoAAAzyxwvutsrqponml", "headline": "Founder", "profile_url": "https://www.linkedin.com/in/bob-buyer", "profile_picture_url": "https://media.licdn.com/dms/image/x/400.jpg", "network_distance": "DISTANCE_2", "is_company": false }, "date": "2025-10-24T10:00:00.000Z", "text": "Great point", "reaction_counter": 4, "reply_counter": 1 } ], "cursor": "", "total_items": 5, "paging": { "start": 0, "page_count": 1, "total_count": 5 } } ``` - `limit`: 1 to 100 (default 10). - `sort_by`: `MOST_RELEVANT` (the default) or `MOST_RECENT` (newest first). - `comment_id`: that comment's replies instead, oldest first as LinkedIn's apps show them (newest first with `MOST_RECENT`; LinkedIn has no relevance order for replies). - `user_reacted` holds the account's own reaction to a comment, when it reacted. A page's comment has `is_company: true` in `author_details`. - As Unipile's: the author's name is `author` (`author_details` has no name or public identifier), and `network_distance` is LinkedIn's own word for the account itself and its 1st and 2nd degree (`SELF`, `DISTANCE_1`, `DISTANCE_2`), `DISTANCE_3` for anyone further, out of network, or a page. - A reply (with `comment_id`) has `thread_id`: its parent comment's id. Its list has `total_items: null` and `paging.total_count: null`, as Unipile's. Direct finds the post's comment thread by itself (most company and recent posts keep their comments under their `ugcPost`, others under their `activity`). ## Comment Or Reply ```bash curl -sS -X POST "https://direct.lempile.com/api/v1/posts/urn:li:activity:7388000000000000000/comments" \ -H "X-API-KEY: $DIRECT_API_KEY" \ -H "Idempotency-Key: comment-7388-1" \ -H "Content-Type: application/json" \ -d '{ "account_id": "'"$ACCOUNT_ID"'", "text": "Agreed, the second point is the one people miss." }' ``` ```json { "object": "CommentSent", "comment_id": "7390000000000000009" } ``` Status `201`. | Field | | | --- | --- | | `account_id` | The account that comments (or `?account_id=`). | | `text` | 1,250 characters at most, mentions' names and an added link included. | | `comment_id` | Reply to this comment. | | `mentions` | As on posts: `[{name, profile_id, is_company?}]`, placed with `{{0}}`… | | `external_link` | An `http(s)` link, added at the end of the text unless it's in it. | | `as_organization` | Comment as this company page (its id, digits). | | `attachments` | One image (jpg, png, gif or webp), multipart. | `comment_id` in the answer is empty when LinkedIn didn't name the new comment. ## Delete A Comment Direct's own route: Unipile has none. ```bash curl -sS -X DELETE "https://direct.lempile.com/api/v1/posts/urn:li:activity:7388000000000000000/comments/7390000000000000009?account_id=$ACCOUNT_ID" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` ```json { "object": "CommentDeleted" } ``` ## List Reactions ```bash curl -sS "https://direct.lempile.com/api/v1/posts/urn:li:activity:7388000000000000000/reactions?account_id=$ACCOUNT_ID" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` ```json { "object": "PostReactionList", "items": [ { "object": "PostReaction", "value": "PRAISE", "post_id": "7388000000000000000", "author": { "id": "ACoAAAzyxwvutsrqponml", "type": "INDIVIDUAL", "name": "Bob Buyer", "headline": "Head of Sales", "profile_url": "https://www.linkedin.com/in/bob-buyer/", "profile_picture_url": "https://media.licdn.com/dms/image/x/400.jpg", "public_identifier": "bob-buyer", "network_distance": "SECOND_DEGREE" } } ], "cursor": null, "paging": { "cursor": null, "start": 0, "page_count": 1, "total_count": 1 } } ``` - `limit`: 1 to 100 (default 10). `comment_id`: a comment's reactions instead (each item then has `comment_id`). - `value` is LinkedIn's name: `LIKE`, `PRAISE`, `APPRECIATION`, `EMPATHY`, `INTEREST`, `ENTERTAINMENT`. A page's reaction has `type: "COMPANY"`. ## React ```bash curl -sS -X POST "https://direct.lempile.com/api/v1/posts/reaction" \ -H "X-API-KEY: $DIRECT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "account_id": "'"$ACCOUNT_ID"'", "post_id": "urn:li:activity:7388000000000000000", "reaction_type": "like" }' ``` ```json { "object": "ReactionAdded" } ``` Status `201`. | `reaction_type` (Unipile's) | LinkedIn's | | --- | --- | | `like` (default) | `LIKE` | | `celebrate` | `PRAISE` | | `support` | `APPRECIATION` | | `love` | `EMPATHY` | | `insightful` | `INTEREST` | | `funny` | `ENTERTAINMENT` | `comment_id` reacts to one of the post's comments; `as_organization` reacts as a company page. ## Remove A Reaction Direct's own route: Unipile has none. The same fields as reacting, in the query or a JSON body: ```bash curl -sS -X DELETE "https://direct.lempile.com/api/v1/posts/reaction?account_id=$ACCOUNT_ID&post_id=urn%3Ali%3Aactivity%3A7388000000000000000" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` ```json { "object": "ReactionRemoved" } ``` Every write here takes `?dry_run=true` and an `Idempotency-Key`. --- # Lempile Direct: Company Search > LinkedIn's classic company search, by keywords. LinkedIn's classic company search, by keywords, in Unipile's `LinkedinSearch` shape. ```bash curl -sS -X POST "https://direct.lempile.com/api/v1/linkedin/search?account_id=$ACCOUNT_ID&limit=10" \ -H "X-API-KEY: $DIRECT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "api": "classic", "category": "companies", "keywords": "outbound software" }' ``` ```json { "object": "LinkedinSearch", "items": [ { "type": "COMPANY", "id": "1035", "name": "Example Co", "location": "Cambridge, MA", "profile_url": "https://www.linkedin.com/company/example-co", "industry": "Software Development", "summary": "Grow better", "logo": "https://media.licdn.com/dms/image/logo1035/100.jpg", "followers_count": 1200000 } ], "config": { "params": { "api": "classic", "category": "companies", "keywords": "outbound software" } }, "paging": { "start": 0, "page_count": 1, "total_count": 2 }, "cursor": "" } ``` | Body field | | | --- | --- | | `api` | `classic` (or absent). | | `category` | `companies`. | | `keywords` | Required. | | `limit` | 1 to 100 (default 10). The query's `limit` wins over it. | - `account_id` goes in the query, as on Unipile. - LinkedIn gives 10 results a call; a `limit` of 100 costs 10 calls. - `id` is the company's id: what `as_organization`, mentions and `GET /users/{id}/posts?is_company=true` take. - `logo` is the company's 100 px logo. `summary` is LinkedIn's own search snippet (Unipile's sometimes differs: a matched specialty, the tagline or the description) and `followers_count` LinkedIn's rounded count ("1.2M followers" → 1200000). - `cursor` (in the query) gives the next page. ## Not Done Answer `501 errors/feature_not_implemented`: - any other `category` (people, posts, jobs) or `api` (Sales Navigator, Recruiter); - any filter: `industry`, `location`, `has_job_offers`, `headcount`, `network_distance`; - `GET /linkedin/search/parameters`. --- # Lempile Direct: Search, Company Pages And Raw Data > LinkedIn's classic search for people, posts and jobs, the ids its filters take, company pages and their employees, and the raw route for reads. Everything here reads LinkedIn as the connected account, with Unipile's paths, bodies and answers. The company search itself (`category: companies`) is on [Company Search](https://lempile.com/docs/direct/company-search). ## Search People ```bash curl -sS -X POST "https://direct.lempile.com/api/v1/linkedin/search?account_id=$ACCOUNT_ID&limit=10" \ -H "X-API-KEY: $DIRECT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "api": "classic", "category": "people", "keywords": "founder", "network_distance": [2], "location": ["105015875"], "company": ["1035"] }' ``` ```json { "object": "LinkedinSearch", "items": [ { "object": "SearchResult", "type": "PEOPLE", "id": "ACoAAApeoplesearch01", "public_identifier": "ada-founder", "public_profile_url": "https://www.linkedin.com/in/ada-founder", "profile_url": "https://www.linkedin.com/in/ACoAAApeoplesearch01", "profile_picture_url": "https://media.licdn.com/dms/image/...", "profile_picture_url_large": "https://media.licdn.com/dms/image/...", "member_urn": "urn:li:member:1001", "name": "Ada Founder", "network_distance": "DISTANCE_2", "location": "Paris, Île-de-France, France", "industry": null, "headline": "Founder at Example" } ], "config": { "params": { "api": "classic", "category": "people", "keywords": "founder", "network_distance": [2], "location": ["105015875"], "company": ["1035"] } }, "paging": { "start": 0, "page_count": 10, "total_count": 1240 }, "cursor": "" } ``` - Filters, as Unipile's: `keywords`, `industry`, `location`, `profile_language`, `network_distance` (1, 2, 3), `company` (current), `past_company`, `school`, `service`, `connections_of`, `followers_of`, `open_to` (`proBono`, `boardMember`) and `advanced_keywords` (`first_name`, `last_name`, `title`, `company`, `school`). Ids are LinkedIn's (digits), from `GET /linkedin/search/parameters` below; `connections_of` and `followers_of` take members' provider ids. - `id` is the member's provider id (`ACo…`), what `GET /users/{identifier}`, `POST /users/invite` and `POST /chats` take. - LinkedIn answers 10 people a call; `limit` up to 100 reads up to 10 pages. The `cursor` keeps the filters: send it back alone (`{"cursor": ""}`, or `?cursor=`). - **A company's employees:** `{"category": "people", "company": ["1035"]}`. ## Search Posts ```bash curl -sS -X POST "https://direct.lempile.com/api/v1/linkedin/search?account_id=$ACCOUNT_ID" \ -H "X-API-KEY: $DIRECT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "api": "classic", "category": "posts", "keywords": "outbound", "sort_by": "date", "date_posted": "past_week" }' ``` Each item is a `SearchResult` of `type: "POST"`: the post's `id` (its activity id, what `GET /posts/{post_id}`, its comments and reactions take), `social_id`, `share_url`, `text`, `date`, `parsed_datetime`, the counters, `author`, `permissions`, `is_repost` (and `reposted_by`). Filters: `sort_by` (`relevance`, `date`), `date_posted` (`past_day`, `past_week`, `past_month`), `content_type`, `posted_by` (`member`, `company`, `me`, `first_connections`, `people_you_follow`), `mentioning` (`member`, `company`), `author` (`industry`, `company`, `keywords`). As on Unipile, 3 posts by default and 49 at most a page. ## Search Jobs ```bash curl -sS -X POST "https://direct.lempile.com/api/v1/linkedin/search?account_id=$ACCOUNT_ID&limit=25" \ -H "X-API-KEY: $DIRECT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "api": "classic", "category": "jobs", "keywords": "sales", "region": "105015875", "presence": ["remote"], "date_posted": 7 }' ``` Each item is a `SearchResult` of `type: "JOB"` (`id`, `title`, `location`, `posted_at`, `url`, `promoted`, `easy_apply`, `company`). Filters: `sort_by`, `date_posted` (days), `region`, `location`, `location_within_area`, `industry`, `seniority`, `function`, `role`, `job_type`, `company`, `presence`, `easy_apply`, `has_verifications`, `under_10_applicants`, `in_your_network`, `fair_chance_employer`. `benefits`, `commitments` and `minimum_salary` answer `501` for now. 25 jobs a LinkedIn call, 50 at most a page. ## By A LinkedIn Search Address Unipile's `{"url": "…"}` body: a LinkedIn search page's address (people, content, companies or jobs), read as the matching body. ```bash curl -sS -X POST "https://direct.lempile.com/api/v1/linkedin/search?account_id=$ACCOUNT_ID" \ -H "X-API-KEY: $DIRECT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "url": "https://www.linkedin.com/search/results/people/?keywords=cto&network=%5B%22S%22%5D" }' ``` Sales Navigator and Recruiter (`api: "sales_navigator"`, `api: "recruiter"`, or their addresses) answer `403` `errors/feature_not_subscribed`: Direct serves LinkedIn's classic API. ## Search Parameters The ids the filters take, from LinkedIn's own typeahead (one call): ```bash curl -sS "https://direct.lempile.com/api/v1/linkedin/search/parameters?account_id=$ACCOUNT_ID&type=LOCATION&keywords=paris" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` ```json { "object": "LinkedinSearchParametersList", "items": [{ "object": "LinkedinSearchParameter", "id": "105015875", "title": "Paris, Île-de-France, France" }], "paging": { "page_count": 1 } } ``` `type`: `LOCATION`, `REGION`, `PEOPLE`, `CONNECTIONS` (ids are provider ids), `COMPANY`, `SCHOOL`, `INDUSTRY`, `JOB_TITLE` (the jobs search's `role`) or `SKILL`. Other classic types answer `501`; Sales Navigator and Recruiter types answer `403` `errors/feature_not_subscribed`. ## A Company Page ```bash curl -sS "https://direct.lempile.com/api/v1/linkedin/company/example-co?account_id=$ACCOUNT_ID" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` ```json { "object": "CompanyProfile", "id": "1035", "name": "Example Co", "description": "We make outbound simple.", "entity_urn": "urn:li:fsd_company:1035", "public_identifier": "example-co", "profile_url": "https://www.linkedin.com/company/example-co/", "tagline": "Grow better", "followers_count": 5400, "is_following": true, "is_employee": false, "hashtags": [{ "title": "#outbound" }], "messaging": { "is_enabled": false }, "claimed": true, "viewer_permissions": { "canReadAdminDashboard": false }, "organization_type": "PRIVATELY_HELD", "locations": [{ "is_headquarter": true, "country": "US", "city": "Boston", "street": ["1 Main St"], "postalCode": "02110", "area": "MA" }], "industry": ["Software Development"], "employee_count": 120, "employee_count_range": { "from": 51, "to": 200 }, "website": "https://example.com", "foundation_date": "2015" } ``` - `{identifier}`: the public identifier, the id, a urn or the page's link. One LinkedIn call. - `viewer_permissions` are all `true` for the page's admins and all `false` otherwise (LinkedIn's answer names admin only). `messaging.is_enabled` is always `false`, and `insights` and `crunchbase_funding` aren't answered. - Its employees: search people with `company: [""]` (above). Its posts: `GET /users/{id}/posts?is_company=true` ([Posts](https://lempile.com/docs/direct/posts)). ## Raw Data (Reads) Unipile's raw route, for a LinkedIn read Direct has no route for yet: a GET of one of LinkedIn's API addresses, with the account's own session, paced and counted like every read. ```bash curl -sS -X POST "https://direct.lempile.com/api/v1/linkedin" \ -H "X-API-KEY: $DIRECT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "account_id": "'"$ACCOUNT_ID"'", "request_url": "https://www.linkedin.com/voyager/api/me" }' ``` ```json { "object": "LinkedinRawData", "data": { "data": { "plainId": 1 }, "included": [] } } ``` - `request_url` is on `https://www.linkedin.com/voyager/api/` (or that path); `query_params` are added to it (`encoding: false` adds them as given). `headers` and `body` are ignored. - Any other `method`, or an `action=` address, answers `501`: writes go through Direct's own routes, each checked first and tried with `?dry_run=true`. - Unipile's Sales Navigator and Recruiter routes (`/linkedin/projects`, `/linkedin/contracts`, `/linkedin/user/{user_id}`, `/linkedin/recruiter/sessions/…`) answer `403` `errors/feature_not_subscribed`. --- # Lempile Direct: Webhooks > Registering webhooks, every payload field by field, delivery and retries, authenticating deliveries, and timing. Direct sends Unipile's webhooks for three sources: `messaging` (`message_received`), `users` (`new_relation`) and `account_status`. You register them through the API (Unipile also lets you add them in its dashboard; Direct has only the API). A webhook belongs to the workspace of the key that created it: a key lists and deletes its own workspace's webhooks only, and only that workspace's accounts send to them. ## Register A Webhook ```bash curl -sS -X POST "https://direct.lempile.com/api/v1/webhooks" \ -H "X-API-KEY: $DIRECT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "request_url": "https://app.example.com/hooks/linkedin-messages", "source": "messaging", "name": "messages", "headers": [{ "key": "x-webhook-secret", "value": "your-own-secret" }] }' ``` ```json { "object": "WebhookCreated", "webhook_id": "a1B2c3D4e5F6g7H8i9J0kL" } ``` | Field | Required | | | --- | --- | --- | | `request_url` | yes | https. (http only to `127.0.0.1` or `localhost`, for a local test.) | | `source` | yes | `messaging`, `users` or `account_status`. Anything else answers `400`. | | `name` | no | 200 characters at most; sent as `webhook_name` in `messaging` and `users` payloads. | | `headers` | no | Up to 20 `{key, value}`, sent with every delivery. Values are kept encrypted and never shown again. | | `events` | no | Default: every event of the source (see below). | | `account_ids` | no | Only these accounts. Default: every account of your workspace. Another workspace's account named here never sends. | | `data` | no | `[{key, name}]`: send only these payload keys, renamed (`messaging` and `users` only). | | `format` | no | `json` (default) or `form` (`application/x-www-form-urlencoded`, each value a string or JSON-encoded). | | `enabled` | no | Default `true`. | `GET /api/v1/webhooks` lists your workspace's (header values as `********`), `DELETE /api/v1/webhooks/{hook_id}` deletes one (`hook_id` is the `webhook_id` it was created with) (its deliveries still waiting are dropped). There is no update: delete and create again. ### Events | Source | Sent | Accepted, never sent | | --- | --- | --- | | `messaging` | `message_received`, `message_read`, `message_reaction`, `message_edited`, `message_deleted` | `message_delivered` | | `users` | `new_relation` | | | `account_status` | `ok`, `credentials`, `error`, `connecting`, `creation_success`, `reconnected`, `sync_success`, `deleted` | `creation_fail`, `stopped`, `permissions` | The "accepted, never sent" events are taken at registration so a Unipile setup registers unchanged, but Direct never sends them: LinkedIn has no delivery receipt of its own, and the others aren't states a Lempile account goes through. `message_read`, `message_reaction`, `message_edited` and `message_deleted` come only from the live stream (see [Timing](#timing)). ## Authenticating Deliveries Direct doesn't sign payloads. Every delivery carries the `headers` you gave the webhook, exactly; put a secret there and check it on every request, comparing in constant time. That's how Unipile setups usually authenticate (for example a static `x-unipile-signature` header). Each delivery also has `user-agent: Lempile-Direct-Webhooks/1` and `content-type: application/json` (or the form type). ## Payloads ### messaging: message_received A new message in one of the account's chats: received, or sent by the account from anywhere (Direct, LinkedIn's website or apps), as Unipile does. ```json { "account_id": "00000000-0000-4000-8000-0000000000a1", "account_type": "LINKEDIN", "account_info": { "type": "LINKEDIN", "feature": "classic", "user_id": "ACoAAAbcdefghijklmnop" }, "event": "message_received", "chat_id": "2-QUFBQXRocmVhZPv_b25lMQ", "timestamp": "2026-10-29T09:41:07.000Z", "webhook_name": "messages", "message_id": "2-_vptc2cwMTMyIQ", "message": "Sounds good", "sender": { "attendee_id": "ACoAAAzyxwvutsrqponml", "attendee_name": "Bob Buyer", "attendee_provider_id": "ACoAAAzyxwvutsrqponml", "attendee_profile_url": "https://www.linkedin.com/in/ACoAAAzyxwvutsrqponml", "attendee_public_identifier": null, "attendee_specifics": { "provider": "LINKEDIN", "member_urn": "urn:li:member:123456789", "network_distance": "DISTANCE_1", "occupation": "Head of Sales at Example", "is_company": false } }, "attendees": [ { "attendee_id": "ACoAAAzyxwvutsrqponml", "attendee_name": "Bob Buyer", "attendee_provider_id": "ACoAAAzyxwvutsrqponml", "attendee_profile_url": "https://www.linkedin.com/in/ACoAAAzyxwvutsrqponml", "attendee_public_identifier": null, "attendee_specifics": { "provider": "LINKEDIN", "member_urn": "urn:li:member:123456789", "network_distance": "DISTANCE_1", "occupation": "Head of Sales at Example", "is_company": false } } ], "attachments": [], "is_sender": false, "subject": null, "provider_chat_id": "2-QUFBQXRocmVhZPv_b25lMQ", "provider_message_id": "2-_vptc2cwMTMyIQ", "is_event": 0, "chat_pinned": 0, "quoted": null, "reply_to": null, "is_forwarded": null, "is_view_once": null, "chat_content_type": null, "message_type": "MESSAGE", "is_group": false, "folder": ["INBOX", "INBOX_LINKEDIN_CLASSIC"], "event_type": null } ``` Every key and every type is as in Unipile's own deliveries (checked against real ones). The ids are LinkedIn's (see below), as every Direct route answers them. | Key | | | --- | --- | | `account_id`, `account_type` | The account (`LINKEDIN`). | | `account_info.user_id` | The account's own provider id. | | `chat_id`, `provider_chat_id` | The chat's id, as `GET /chats` answers it (both the same; Unipile's `chat_id` is its own id). | | `message_id`, `provider_message_id` | The message's id, as `GET /chats/{chat_id}/messages` answers it (both the same). | | `timestamp` | The message's time. | | `message` | Its text (empty for a file alone). | | `sender` | Who sent it (below). The account itself when it sent it. | | `attendees` | Everyone in the chat but the account, in the same shape. | | `attachments` | `[{attachment_id, attachment_name, attachment_size, attachment_type, attachment_unavailable, attachment_url}]`: `attachment_type` `img`, `file` or `audio` (a voice note); a file has its `attachment_name` and its size in bytes, an image or a voice note `attachment_size: null`. `attachment_url` is LinkedIn's own link (Unipile's is an `att://` reference to its attachments route, which Direct doesn't have). | | `is_sender` | `true` when the account sent it. | | `subject` | An InMail's subject, else `null`. | | `chat_content_type` | `inmail`, `sponsored`, `linkedin_offer` or `null`. | | `is_group` | A group conversation. | | `folder` | The chat's folders. | | `is_event`, `chat_pinned`, `quoted`, `reply_to`, `is_forwarded`, `is_view_once`, `message_type`, `event_type` | Always `0`, `0`, `null`, `null`, `null`, `null`, `"MESSAGE"`, `null`, as Unipile's LinkedIn ones. | A person (`sender`, each of `attendees`, `read_by`, `reaction_sender`): | Key | | | --- | --- | | `attendee_id`, `attendee_provider_id` | Their provider id (Unipile puts its own attendee id in `attendee_id`). | | `attendee_name` | Their name (a page's name for a page). | | `attendee_profile_url` | `https://www.linkedin.com/in/`, as LinkedIn's messaging links people; `null` for a page. | | `attendee_public_identifier` | Always `null`, as Unipile's. | | `attendee_specifics` | `provider` (`LINKEDIN`), `member_urn` (`urn:li:member:`; for a page `urn:li:msg_messagingParticipant:urn:li:fsd_company:`), `network_distance` (`SELF`, `DISTANCE_1`, `DISTANCE_2`, `DISTANCE_3`, `OUT_OF_NETWORK`; members only), `occupation` (their headline; members only), `is_company`. | ### messaging: message_read, message_reaction, message_edited, message_deleted The same payload as `message_received`, about the message concerned, with its own `event`: | `event` | When | Extra keys | | --- | --- | --- | | `message_read` | Someone else in the chat read it (LinkedIn's read receipt; the account reading its own inbox isn't one). | `read_by`: who read it, in the `sender` shape. | | `message_reaction` | Someone added a reaction to it. | `reaction`: the emoji. `reaction_sender`: who, in the `sender` shape. | | `message_edited` | Its text changed after it was sent (`message` is the new text). | | | `message_deleted` | Its sender deleted it (`message` is `null`, `attachments` empty, as Unipile's). | | Each is sent once (a receipt once per message and reader, a reaction once per message, emoji and person). ### users: new_relation A new connection: an invitation accepted, either way. ```json { "event": "new_relation", "account_id": "00000000-0000-4000-8000-0000000000a1", "account_type": "LINKEDIN", "webhook_name": "relations", "user_full_name": "Bob Buyer", "user_provider_id": "ACoAAAzyxwvutsrqponml", "user_public_identifier": "bob-buyer", "user_profile_url": "https://www.linkedin.com/in/bob-buyer/", "user_picture_url": "https://media.licdn.com/dms/image/x/400.jpg", "timestamp": 1793260931000 } ``` `timestamp` is when the connection was made, in milliseconds since 1970 (a number, to the second), as Unipile's. `user_picture_url` may be `null`. ### account_status ```json { "AccountStatus": { "account_id": "00000000-0000-4000-8000-0000000000a1", "account_type": "LINKEDIN", "message": "CREDENTIALS" } } ``` | `message` | When | | --- | --- | | `OK`, `CREDENTIALS`, `ERROR`, `CONNECTING` | The account's status changed (see [Authentication And Accounts](https://lempile.com/docs/direct/authentication-and-accounts)). | | `CREATION_SUCCESS` | A hosted auth link connected a new account. | | `RECONNECTED` | A hosted auth link reconnected an account. | | `SYNC_SUCCESS` | A resync worked. | | `DELETED` | `DELETE /accounts/{account_id}`. | The event names you filter on are the lowercase forms (`credentials`, `creation_success`…). A `SYNC_SUCCESS` also has `"Product": "classic"` beside `AccountStatus`, as every one of Unipile's does. ### Hosted auth notify_url Not a registered webhook: a hosted auth link's `notify_url` gets exactly `{"status": "CREATION_SUCCESS" | "RECONNECTED", "account_id", "account_type": "LINKEDIN", "name"}` when the account works, delivered and retried like a webhook, with no extra header. ## Delivery - A POST, 30 seconds at most per try. - Any `2xx` is delivered and never sent again. - A `5xx`, `408`, `425`, `429`, a timeout or a refused connection is tried again 30 seconds, 2 minutes, 10 minutes, 30 minutes and 2 hours later (5 more tries). Any other answer (a `4xx`, a redirect) is final. - Deliveries waiting for a retry are kept encrypted on Direct's disk: a restart of Direct sends them. - Each delivery is independent: a slow receiver holds no other. - A delivery that timed out on Direct's side may still have reached you, so you can receive one twice. Make your handler idempotent on `message_id` (or `user_provider_id`, or the status and account). ## Timing **Messages arrive in real time, day and night.** For each account some `messaging` or `users` webhook wants, Direct keeps LinkedIn's own live connection open (the one LinkedIn's messaging page keeps open), through the account's own session and proxy. A new message (received, or sent by the account from anywhere), a read receipt, a reaction, an edit or a deletion reaches your webhook within seconds of LinkedIn telling the account's browser. Behind it, Direct still reads each account's inbox and relations, through the account's own session and pacing, and only for what some webhook wants (no webhook, no read). It catches anything the live connection missed: | What | Awake (07:00 to 23:00, the account's timezone) | At night | | --- | --- | --- | | The inbox, while the live connection is up | every 15 to 25 minutes | every 45 to 75 minutes | | The inbox, while it's down | every 2 to 5 minutes | every 20 to 40 minutes | | Relations (newest 20) | every 30 to 60 minutes, and within seconds of a hint on the live connection (below) | every 2 to 3 hours, and the same | | Account status, when only `account_status` webhooks exist | every 15 to 30 minutes | every 30 to 60 minutes | - **New connections:** LinkedIn's live connection never names a new connection, but someone accepting an invitation is a notification. When it signals an invitation, the notifications or My Network badge going up, or an in-app alert, Direct reads the newest relations within seconds (one call; at most once every 90 seconds and 96 times a day an account): the new connection then reaches your `users` webhook within about a minute. Otherwise the regular read finds it. Unipile's own `new_relation` comes by polling, up to 8 hours after. - Every message is sent once, whichever path saw it first. - When the live connection drops, it reconnects within seconds, and the inbox is read within a minute after any gap of 30 seconds or more, as LinkedIn's own page re-syncs: messages from the gap arrive then, a minute or two late. While the connection stays down, the inbox is read every 2 to 5 minutes again. - A conversation whose last activity moved has its latest messages read: up to 8 conversations a read (the others next read), up to 20 new messages each, oldest first. - Status changes go out as soon as any call (yours, or a read) sees them. - The timezone is the account's own (America/New_York unless Lempile set another). - The first read for an account only remembers where things are: it sends nothing already there. An account whose reading was stopped for more than 6 hours starts again the same way, so messages from that gap aren't sent; read them with `GET /chats` and `GET /chats/{chat_id}/messages`. - The reads cost the account about 190 LinkedIn calls on a quiet day while the live connection is up (about 300 without it): one per read, one per conversation with new activity, one per (re)connection (LinkedIn closes its live connection every 12 to 14 minutes, as it does for its own page: about 100 a day), and for a message the live connection didn't fully describe, one or two to read it. They stop for the day at 450, and pause while the account has used 80% of its daily calls, so your own calls keep most of the budget. - A signed-out account (`CREDENTIALS`) isn't read until it's `OK` again; a rest after LinkedIn's "too many" is waited out. --- # Lempile Direct: Errors And Limits > Every error type Direct answers, pacing and daily caps, retries, dry runs, Idempotency-Key and unknown outcomes. Direct answers errors in Unipile's shape, with Unipile's status codes and error types, so code written for Unipile's errors keeps working. ```json { "title": "Too many requests", "detail": "LinkedIn asked this account to slow down.", "type": "errors/too_many_requests", "status": 429, "retry_after": 900 } ``` Branch on `status` and `type`. `detail` is for people: its words can change, and it never holds an account's data. ## Every Error Type | HTTP | `type` | Meaning | | --- | --- | --- | | `400` | `errors/invalid_parameters` | A parameter or body field is invalid: a value of the wrong type (`limit=abc`), a `limit` out of range, a cursor this API didn't give, an id that isn't LinkedIn's, a text too long, a body that isn't JSON or a form, an `Idempotency-Key` used for another write. | | `400` | `errors/invalid_url` | Hosted auth or webhooks: a URL that isn't https. | | `400` | `errors/content_too_large` | A file over LinkedIn's limit (a message's file over 20 MB, an image over 36 MB, a video under 75 KB or over 5 GB). | | `400` | `errors/missing_parameters` | A required parameter is missing: `account_id` on a read, `api_url` or `reconnect_account` on a hosted auth link. `detail` names it. | | `401` | `errors/missing_credentials` | The `X-API-KEY` header is missing, wrong or revoked. | | `401` | `errors/disconnected_account` | LinkedIn signed the account out, asks it for a security check, or its browser has no LinkedIn session. Reconnect it with a hosted auth link. | | `402` | `errors/subscription_required` | Your workspace has no active trial or subscription, so its API keys answer this on every route. Start the free trial or add a card at [lempile.com/dashboard/subscription](https://lempile.com/dashboard/subscription) and they work again right away. Your accounts stay connected and your webhooks keep coming meanwhile. | | `403` | `errors/insufficient_permissions` | The account doesn't write through Direct (title `Writes off`), the post isn't the account's to delete, LinkedIn says the account may not do this, or a workspace key called one of Direct's internal admin routes. | | `403` | `errors/resource_access_restricted` | LinkedIn refused this read or write for this account. | | `403` | `errors/account_restricted` | LinkedIn says the account is restricted. | | `403` | `errors/action_required` | LinkedIn asks the account to confirm its email address first. | | `403` | `errors/feature_not_subscribed` | A Sales Navigator or Recruiter search, parameter or route: Direct serves LinkedIn's classic API. | | `404` | `errors/resource_not_found` | An account Direct doesn't serve or that isn't your workspace's (title `Account not found`, the same answer for both), or nothing on LinkedIn with this id (a profile, a post, a chat, a message, an invitation, a webhook). | | `409` | `errors/conflict` | A write with this `Idempotency-Key` is still running. | | `415` | `errors/unsupported_media_type` | A voice note that isn't audio Direct can turn into LinkedIn's format. Nothing was sent. | | `422` | `errors/invalid_parameters` | LinkedIn refused the write's content (title `LinkedIn refused it`). | | `422` | `errors/already_connected` | Invitation: already a connection. | | `422` | `errors/already_invited_recently` | Invitation: one is already waiting. | | `422` | `errors/cannot_invite_attendee` | Invitation: the account itself, or someone whose invitation to the account is waiting. | | `422` | `errors/invalid_recipient` | No profile with this id, or the account itself as a chat's recipient. | | `422` | `errors/cannot_resend_yet` | LinkedIn's weekly invitation limit, or a withdrawn invitation sent again within about 3 weeks. The account's other calls go on. | | `422` | `errors/limit_exceeded` | Too many invitations waiting for an answer: withdraw some. | | `422` | `errors/connection_limit_reached` | The account reached LinkedIn's connection limit. | | `422` | `errors/no_connection_with_recipient` | The account can't message this person for free: only an InMail would reach them. | | `422` | `errors/not_allowed_inmail` | LinkedIn offers no InMail to this person from this account. | | `422` | `errors/insufficient_credits` | No InMail credit for this person. | | `422` | `errors/invalid_post` | LinkedIn refused the post. | | `422` | `errors/unprocessable_entity` | LinkedIn refused another write (for example a post's deletion), or a message sent more than 60 minutes ago can't be deleted or edited. | | `422` | `errors/not_supported_by_provider` | `PATCH /chats/{chat_id}` with one of Unipile's WhatsApp or Telegram actions. | | `422` | `errors/invalid_message` | A voice note over 60 seconds. Nothing was sent. | | `422` | `errors/action_already_performed` | The message is already deleted. | | `429` | `errors/too_many_requests` | The account is resting, used up its day, or is busy. See [Pacing](#pacing). Always with `retry_after`. | | `500` | `errors/provider_error` | LinkedIn answered something Direct couldn't read, or an error of its own. Nothing was written. | | `500` | `errors/unexpected_error` | Direct failed. | | `501` | `errors/feature_not_implemented` | Direct doesn't do this (yet): fall back to Unipile, or do without. | | `503` | `errors/network_down` | The account's proxy or Lempile's browser server didn't answer. Nothing was sent. | | `504` | `errors/request_timeout` | A read: LinkedIn didn't answer in time. A write: **unknown outcome** (see below). | ### Parameter Errors A required query parameter that's missing, or one of the wrong type, answers Unipile's `400` too, naming the parameter (never the value you sent): ```json { "title": "Missing parameters", "detail": "account_id is required.", "type": "errors/missing_parameters", "status": 400 } ``` ```json { "title": "Invalid parameters", "detail": "limit: Input should be a valid integer, unable to parse string as an integer.", "type": "errors/invalid_parameters", "status": 400 } ``` ### Cloudflare's Answers `direct.lempile.com` is behind Cloudflare. Two of its answers can reach you instead of Direct's: - `524`: the request took more than 100 seconds (a write waiting its turn, a large upload). For a write, it's an unknown outcome. - `413`: the request body is over Cloudflare's limit (100 MB on most plans): a large video. ## Pacing Every LinkedIn call of an account goes through that account's own pace: | Limit | Value | When reached | | --- | --- | --- | | One call at a time | | A call waits its turn up to 60 seconds, then `429` with `retry_after: 60`. | | Gap between calls | 1.5 to 3 seconds | Calls wait; nothing is refused. | | LinkedIn calls in any 24 hours | 1,500 | `429` until the oldest of them is 24 hours old (`retry_after` says when). | | Writes in any 24 hours | 150 | `429` until the oldest write is 24 hours old. | | Rest after LinkedIn's "too many" (`429` or `999`) | 15 minutes | Every call of the account answers `429` with the seconds left. | - The limits are per account, never per key: two apps using one account share its budget. - One request can cost several LinkedIn calls: a profile with sections, a long page, a write's checks and uploads. Each route's page says what it reads. - The webhook reads use the same budget (about 300 calls a quiet day, 450 at most; see [Webhooks](https://lempile.com/docs/direct/webhooks)). - A security check (`errors/disconnected_account`) is never retried. - The counters live in Direct's memory and start again when Direct restarts. ### Retrying | Answer | Retry? | | --- | --- | | `429` | Yes, after `retry_after` seconds (also in the `Retry-After` header). | | `503` | Yes: nothing was sent. | | `500 provider_error` | A read: yes, later. A write: nothing was written; retry once. | | `504` on a read | Yes. | | `504` on a write, `524`, a lost connection | Only with the same `Idempotency-Key` (below), or after checking the write didn't happen. | | `401 disconnected_account` | No: reconnect the account. | | Other `4xx`, `501` | No. | ## Writes ### Dry Runs Every write takes `?dry_run=true`. Direct does everything up to the write itself (it reads what it checks: the profile before an invitation, the "Message" option before a new chat, the post before its deletion) and answers the plan instead of sending it: ```json { "object": "DryRun", "route": "posts.react", "method": "POST", "path": "/voyager/api/voyagerSocialDashReactions?threadUrn=urn%3Ali%3Aactivity%3A7388000000000000000", "body": { "reactionType": "LIKE" }, "status": 201 } ``` - Status `200`. `status` is what the real write would answer. `uploads`, `multiphoto` and `checked` appear when the write has files or checks. - Nothing is sent to a LinkedIn write endpoint, and no file is uploaded. The checks' reads do happen and count in the account's calls. - Dry runs work for every served account, writes on or off, and don't use an `Idempotency-Key`. - A refusal found by the checks (`already_connected`, `no_connection_with_recipient`…) answers as the real write would. ### Idempotency-Key Send an `Idempotency-Key` header (1 to 200 characters, unique per write) on every real write: - The key is claimed (per account) before anything is sent. The same key on the same account never writes twice. - A repeat after the write finished answers the first answer again (same status, same body; an empty `204` stays empty), for 7 days. - A repeat while the first is still running answers `409 errors/conflict`. - A write that surely didn't happen (a refusal, `429`, `503`, `500 provider_error`) frees the key: the same key may try again. A refusal found by the checks before sending never takes the key at all. - A write whose outcome is unknown answers the same `504` to every repeat: it never writes again under that key. - The same key on another route answers `400`. With a key, retrying after a timeout, a `524` or a lost connection is safe: you get the first answer, `409` while it runs, or the write if it never started. ### Unknown Outcome A write is tried again by Direct only when nothing reached LinkedIn (the proxy refused the connection, or LinkedIn refused the session before reading it). When LinkedIn may have received it (a timeout after sending, or an answer that doesn't name what it made), Direct answers: ```json { "title": "Unknown outcome", "detail": "LinkedIn may have received this write; it isn't tried again. Check before sending it once more.", "type": "errors/request_timeout", "status": 504 } ``` Check before writing again: the chat's latest messages, the account's posts, the post's comments, the sent invitations. ## Other Limits | | | | --- | --- | | Page sizes | Each list's `limit` range is on its page (relations up to 1,000; chats, messages and attendees up to 250; most others up to 100). | | Cursors | Opaque; only the list that gave one takes it back. | | Texts | Message 8,000 characters, post 3,000, comment 1,250, invitation note 300, InMail subject 200. | | Files | Message: 20 MB each. Post: up to 20 images of 36 MB, or one video of 75 KB to 5 GB. Comment: one image. | | Webhooks | 20 headers each; one `request_url` and one source each. | --- # Lempile Direct: Migrating From Unipile > Moving a Unipile integration to Direct: base URL, key, account ids, chat ids, webhooks, hosted auth and fallback. Direct answers Unipile's LinkedIn routes with Unipile's paths, fields, status codes and error types. Moving a Unipile integration is mostly configuration, plus a few points below. ## 1. Base URL And Key | | Unipile | Direct | | --- | --- | --- | | Base URL | `https:///api/v1` | `https://direct.lempile.com/api/v1` | | Key header | `X-API-KEY: ` | `X-API-KEY: ` (one per workspace, made in Lempile's dashboard) | Paths stay the same: `GET /users/me`, `GET /chats`, `POST /chats/{chat_id}/messages`… If your code checks hostnames (for example that a hosted auth link starts with `https://account.unipile.com/`, or that the API host ends in `unipile.com`), accept `direct.lempile.com` too. ## 2. Account IDs Direct's account ids are Lempile account ids. A Unipile account id doesn't exist here. - Connect each LinkedIn account through Direct's hosted auth link (or have Lempile connect it), then store the new id. `GET /accounts` lists them; `connection_params.im.id` is the member's provider id, the same as on Unipile, so you can match accounts by it. - Every account starts with writes off. Ask Lempile to turn writes on per account, and use `?dry_run=true` meanwhile. ## 3. Chat And Message IDs - A chat id is LinkedIn's own conversation id (`2-…`) and a message id LinkedIn's own message id, answered URL-safe (`-` and `_`, no `=`). They are not Unipile's ids: chat and message ids stored from Unipile don't resolve. Read the chats from Direct to map them (match on the other attendee's provider id and the latest message's time). - **Every inbox call names its account**: `GET /chats/{chat_id}?account_id=`, `GET /chats/{chat_id}/messages?account_id=`, `GET /messages/{message_id}?account_id=`, and `account_id` in the body of `POST /chats/{chat_id}/messages`. Unipile finds the account from the chat id; Direct can't. - Profile provider ids (`ACo…`) and posts' `social_id` (`urn:li:activity:…`) are LinkedIn's own, as on Unipile, so stored ones keep working. Comment and invitation ids are LinkedIn's numbers; read them from Direct. ## 4. Webhooks - Register your webhooks again with `POST /webhooks` on Direct: webhooks set in Unipile's dashboard don't move. Same bodies, same payloads. - Messaging events come in real time from LinkedIn's own live connection, with polling as the backstop; `new_relation` from polling, 30 to 60 minutes after the connection. See [Webhooks](https://lempile.com/docs/direct/webhooks). - `message_received`, `message_read`, `message_reaction`, `message_edited`, `message_deleted`, `new_relation` and the account status events are sent. `message_delivered` is accepted but never sent. - Deliveries carry the headers you registered and are not signed: authenticate them with a secret header, as with Unipile. ## 5. Hosted Auth - `POST /hosted/accounts/link` takes Unipile's body and answers Unipile's `HostedAuthUrl` (`200`). The `url` is on `direct.lempile.com`. - `providers` takes Unipile's forms (`"LINKEDIN"`, `["LINKEDIN"]`, `"*"`, `"*:MESSAGING"`) and must take LinkedIn; a `reconnect` link needs none. - A new account joins your key's workspace; a reconnect link can only name your workspace's accounts. - `notify_url` receives exactly `{status, account_id, name}` (`CREATION_SUCCESS` or `RECONNECTED`), as on Unipile. - Unipile's options `disabled_features`, `disabled_options`, `proxy`, `sync_limit`, `google_scopes`, `microsoft_scopes` and `single_use` are ignored. The link lasts 24 hours at most. - Native authentication (`POST /accounts` with credentials or cookies), checkpoints (`POST /accounts/checkpoint`) and `PATCH /accounts/{id}` answer `501`: accounts connect only through Lempile's real-browser sign-in. ## 6. Errors And Fallback - Error bodies are Unipile's `{title, detail, type, status}`; types and statuses follow Unipile's. - Anything Direct doesn't do answers `501 errors/feature_not_implemented`. A client that keeps Unipile for some accounts or features can fall back to Unipile on `501`. For a write, fall back only on `501` (or `403` `Writes off`, or `404` `Account not found`): any other answer may mean the write went out. - `429 errors/too_many_requests` comes with `retry_after` and a `Retry-After` header: Direct's limits are per account (1,500 LinkedIn calls and 150 writes a day). See [Errors And Limits](https://lempile.com/docs/direct/errors-and-limits). - A missing `account_id` answers `400 errors/missing_parameters`, a parameter of the wrong type `400 errors/invalid_parameters`. ## 7. What You Gain - `?dry_run=true` on every write: the exact LinkedIn call, not sent. - `Idempotency-Key` on writes: the same key never writes twice, so retries are safe. - `DELETE /posts/{post_id}/comments/{comment_id}` and `DELETE /posts/reaction`, which Unipile doesn't have. - Every call goes out from the account's own browser session and its own proxy. ## 8. Checklist 1. Get a Direct key for your workspace; set the base URL and the key. 2. Connect the accounts through hosted auth; store the new account ids. 3. Add `account_id` to every inbox call that lacked it. 4. Re-read chats from Direct; don't reuse Unipile's chat and message ids. 5. Register the webhooks on Direct; authenticate them with a header secret. 6. Accept `direct.lempile.com` wherever your code checks Unipile's hostnames. 7. Try every write with `?dry_run=true`, then ask Lempile to turn writes on. 8. Handle `501` (fall back or skip) and `429` (wait `retry_after`). 9. Check the routes you use against [Unipile Compatibility](https://lempile.com/docs/direct/unipile-compatibility). --- # Lempile Direct: Unipile Compatibility > Every Unipile LinkedIn route and what Direct does with it: the same, the same with differences, or 501. Every Unipile route for LinkedIn, and what Direct does with it. - **Same**: Unipile's path, parameters, answer shape and status. The read answers are checked in Direct's tests against Unipile's published response schemas. - **Same, but**: answered, with the differences listed. - **501**: answers `501 errors/feature_not_implemented`, so a client can fall back. Every other path under `/api/v1` (email, calendars, other providers) answers `501` too. ## Accounts And Hosted Auth | Unipile route | Direct | Notes | | --- | --- | --- | | `GET /accounts` | Same, but | The key's workspace's Lempile accounts only. `status_counts` always has `STOPPED: 0`. | | `GET /accounts/{account_id}` | Same, but | Statuses `OK`, `CONNECTING`, `CREDENTIALS`, `ERROR`. `premiumId`, `premiumContractId` are `null`; `organizations`, `groups` are `[]`. | | `DELETE /accounts/{account_id}` | Same, but | Stops serving the account; never signs it out of LinkedIn. `provider_session_revoke=true`: 501. | | `GET /accounts/{account_id}/sync` | Same, but | Answers `{"object": "AccountResync", "status": "SYNC_DONE" \| "SYNC_ERROR"}`, or `401` when signed out. Also `POST /accounts/{account_id}/resync`. | | `POST /hosted/accounts/link` | Same, but | LinkedIn only (`providers` as a string or a list; none needed to reconnect). A new account joins the key's workspace. 24 hours at most. Options `disabled_features`, `disabled_options`, `proxy`, `sync_limit`, scopes, `single_use` ignored. | | `POST /accounts` (native authentication) | 501 | Accounts connect through hosted auth only. | | `POST /accounts/{account_id}` (reconnect) | 501 | Use a hosted auth link with `type: "reconnect"`. | | `POST /accounts/checkpoint`, `POST /accounts/checkpoint/resend` | 501 | Checkpoints are handled in Lempile's sign-in page. | | `POST /accounts/{account_id}/restart`, `PATCH /accounts/{account_id}` | 501 | | ## Webhooks | Unipile route | Direct | Notes | | --- | --- | --- | | `POST /webhooks` | Same, but | Sources `messaging`, `users`, `account_status` only. The webhook is the key's workspace's. | | `GET /webhooks` | Same, but | The key's workspace's webhooks; header values masked. | | `DELETE /webhooks/{webhook_id}` | Same | | | `messaging` events | Same, but | `message_received`, `message_read`, `message_reaction`, `message_edited` and `message_deleted` in real time (LinkedIn's own live connection), with polling as the backstop. `message_delivered` is accepted and never sent. | | `users` events | Same, but | `new_relation` within about a minute when LinkedIn's live connection hints at a new one (the relations are read at once), else within 30 to 60 minutes (polling). Unipile's: up to 8 hours. | | `account_status` events | Same, but | `OK`, `CREDENTIALS`, `ERROR`, `CONNECTING`, `CREATION_SUCCESS`, `RECONNECTED`, `SYNC_SUCCESS`, `DELETED`. Never `CREATION_FAIL`, `STOPPED`, `PERMISSIONS`. | ## Users | Unipile route | Direct | Notes | | --- | --- | --- | | `GET /users/me` | Same | `organizations: []`, `recruiter` and `sales_navigator` `null`. | | `GET /users/{identifier}` | Same, but | Three LinkedIn calls (top card, second card, contact info), as Unipile's fields. Someone from the account's recent conversations, by provider id: names, headline, picture, link and degree only, with no call. `linkedin_sections` all supported; skills carry no endorsements; `recruiting_activity` is `[]`. `linkedin_api` (Recruiter, Sales Navigator): 501. | | `GET /users/relations` | Same, but | `filter`: 501. | | `GET /users/invite/sent` | Same | | | `POST /users/invite` | Same | Checks the relationship first (`already_connected`, `already_invited_recently`, `cannot_invite_attendee`). | | `DELETE /users/invite/sent/{invitation_id}` | Same, but | The invitation must be among the account's latest 100 sent. | | `GET /users/{identifier}/posts` | Same | Also companies with `is_company=true`. | | `GET /users?provider_url=` | Same, but | Answers the `UserProfile` itself. | | `GET /users/invite/received` | Same, plus | Each item's `specifics.invitation_type`: `CONNECTION`, or LinkedIn's other kinds (`CONTENT_SERIES` for a newsletter, `ORGANIZATION` for a page, `EVENT`…). | | `POST /users/invite/received/{invitation_id}` | Same, but | The invitation must be among the account's latest 100 received, and an invitation to connect (others answer `422`). `decline` is LinkedIn's Ignore. | | `PATCH /users/me` | 501 | | | `GET /users/{identifier}/comments`, `GET /users/{identifier}/reactions` | Same, but | From the member's profile activity. A reaction's `value` is read from LinkedIn's header ("… celebrates this"). | | `GET /users/followers` | Same, but | The account's own followers; another member's `user_id`: an empty list (as Unipile); a company's: 501. | | `GET /users/following` | Same | Unipile answers 501 for LinkedIn; so does Direct. | ## Messaging | Unipile route | Direct | Notes | | --- | --- | --- | | `GET /chats` | Same, but | `account_id` required. Inbox and archive, not spam. `account_type` other than `LINKEDIN`: 400. | | `GET /chats/{chat_id}` | Same, but | `account_id` required. LinkedIn's thread ids, URL-safe. | | `GET /chats/{chat_id}/messages` | Same, but | `account_id` required. Other people's reactions to a message aren't read; `seen` is always `0`. | | `GET /chats/{chat_id}/attendees` | Same, but | `account_id` required. | | `GET /chat_attendees` | Same, but | Everyone the account has a chat with; also takes `chat_id`. | | `GET /messages/{message_id}` | Same, but | `account_id` required. | | `POST /chats` | Same, but | One attendee. InMail with `linkedin[inmail]=true`, sent as LinkedIn's Premium InMail (`premiumInMail`); no credit: `422` `errors/insufficient_credits` (not yet confirmed with a real InMail send). Voice notes (60 s at most, never as an InMail). Groups, `linkedin[api]` other than `classic`, `topic`, `applicant_id`, `invitation_id`, `group_id`: 501. | | `POST /chats/{chat_id}/messages` | Same, but | `account_id` required. Files 20 MB each. `voice_message`: any audio, turned into LinkedIn's AAC .m4a, 60 s at most, sent alone (with text or files: 501). `quote_id`: 501. | | `PATCH /chats/{chat_id}` | Same, but | `setReadStatus`, `setMuteStatus`. WhatsApp's and Telegram's actions: `422 errors/not_supported_by_provider`. | | `DELETE /chats/{chat_id}` | Same | | | `GET /chats/{chat_id}/sync` | 501 | | | `GET /messages` | 501 | | | `GET /messages/{message_id}/attachments/{attachment_id}` | 501 | Use the attachment's `url`. | | `DELETE /messages/{message_id}` | Same, but | `account_id` required. The account's own messages, within 60 minutes of sending them. | | `POST /messages/{message_id}/reaction`, `DELETE /messages/{message_id}/reaction` | Same, but | `account_id` required (body or query). | | `PATCH /messages/{message_id}` | Same, but | `account_id` required. The account's own messages, within 60 minutes (checked first). | | `POST /messages/{message_id}/forward` | 501 | WhatsApp only on Unipile. | | `GET /chat_attendees/{attendee_id}` and its `picture`, `chats`, `messages`, `sync` | 501 | | ## Posts, Comments And Reactions | Unipile route | Direct | Notes | | --- | --- | --- | | `GET /posts/{post_id}` | Same | | | `POST /posts` | Same, but | Text, mentions, link, page, up to 20 images or one video; `repost` (plain, as a page, or with words, no files). `include_job_posting`, `targeted_audience`: 501. | | `DELETE /posts/{post_id}` | Same | `204`, empty. | | `GET /posts/{post_id}/comments` | Same | Replies with `comment_id`. | | `POST /posts/{post_id}/comments` | Same | Replies, mentions, link, page, one image. | | `GET /posts/{post_id}/reactions` | Same | Also a comment's, with `comment_id`. | | `POST /posts/reaction` | Same | Also on a comment, and as a page. | | `DELETE /posts/{post_id}/comments/{comment_id}` | Direct only | Unipile has no such route. | | `DELETE /posts/reaction` | Direct only | Unipile has no such route. | ## LinkedIn Specific | Unipile route | Direct | Notes | | --- | --- | --- | | `POST /linkedin/search` | Same, but | Classic people (every filter), posts (every filter), jobs (`benefits`, `commitments`, `minimum_salary`: 501) and companies (keywords only); by body, `url` or `cursor`. Sales Navigator, Recruiter: `403 errors/feature_not_subscribed`. | | `GET /linkedin/search/parameters` | Same, but | `LOCATION`, `REGION`, `PEOPLE`, `CONNECTIONS`, `COMPANY`, `SCHOOL`, `INDUSTRY`, `JOB_TITLE`, `SKILL`. Other classic types: 501. Sales Navigator and Recruiter types: 403. | | `GET /linkedin/company/{identifier}` | Same, but | `messaging.is_enabled` always `false`; `viewer_permissions` all of an admin's or none; no `insights`, `crunchbase_funding`, `localized_*`. | | `GET /linkedin/inmail_balance` | 501 | | | `POST /linkedin` (raw data) | Same, but | Reads only: GET of `https://www.linkedin.com/voyager/api/…`. Other methods and actions: 501. | | Recruiter hiring projects, contracts, Recruiter sessions, `POST /linkedin/user/{user_id}` | 403 | `errors/feature_not_subscribed`: Sales Navigator and Recruiter only. | | Job postings and applicants, endorsements, target audience | 501 | | ## Direct's Own | Route | | | --- | --- | | `?dry_run=true` on every write | The exact LinkedIn call, not sent. | | `Idempotency-Key` on every write | Never writes twice; 7 days. | | `?lempile_light=true` on `GET /users/{identifier}` | The top card and the sections asked only: 1 LinkedIn call instead of 3 (2 instead of 4 with `experience`). The second card's counts and the contact details are left out. | | `GET /api/v1/openapi.json`, `GET /docs` | This API's OpenAPI document and reference page, public. | --- # Lempile Direct API reference Base URL: `https://direct.lempile.com`. Authentication: your API key in the `X-API-KEY` header. OpenAPI document: [direct.json](https://lempile.com/docs-assets/openapi/direct.json). ## Accounts - [List accounts](https://lempile.com/docs/direct/reference/list-accounts): `GET /api/v1/accounts` - [Connect an account (cookie)](https://lempile.com/docs/direct/reference/connect-account-cookie): `POST /api/v1/accounts` - [Retrieve an account](https://lempile.com/docs/direct/reference/get-account): `GET /api/v1/accounts/{account_id}` - [Reconnect an account (cookie)](https://lempile.com/docs/direct/reference/reconnect-account-cookie): `POST /api/v1/accounts/{account_id}` - [Delete an account](https://lempile.com/docs/direct/reference/delete-account): `DELETE /api/v1/accounts/{account_id}` - [Resync an account](https://lempile.com/docs/direct/reference/resync-account): `POST /api/v1/accounts/{account_id}/resync` - [Resync an account (Unipile's GET form)](https://lempile.com/docs/direct/reference/sync-account): `GET /api/v1/accounts/{account_id}/sync` ## Hosted auth - [Create a hosted auth link](https://lempile.com/docs/direct/reference/hosted-auth-link): `POST /api/v1/hosted/accounts/link` ## Webhooks - [List webhooks](https://lempile.com/docs/direct/reference/list-webhooks): `GET /api/v1/webhooks` - [Create a webhook](https://lempile.com/docs/direct/reference/create-webhook): `POST /api/v1/webhooks` - [Delete a webhook](https://lempile.com/docs/direct/reference/delete-webhook): `DELETE /api/v1/webhooks/{hook_id}` ## Users and profiles - [Look up a profile by URL, or list chat attendees](https://lempile.com/docs/direct/reference/list-users): `GET /api/v1/users` - [Retrieve the account's own profile](https://lempile.com/docs/direct/reference/get-own-profile): `GET /api/v1/users/me` - [Retrieve a profile](https://lempile.com/docs/direct/reference/get-profile): `GET /api/v1/users/{identifier}` - [List a member's comments](https://lempile.com/docs/direct/reference/list-user-comments): `GET /api/v1/users/{identifier}/comments` - [List a member's reactions](https://lempile.com/docs/direct/reference/list-user-reactions): `GET /api/v1/users/{identifier}/reactions` ## Relations and invitations - [List followers](https://lempile.com/docs/direct/reference/list-followers): `GET /api/v1/users/followers` - [Send an invitation](https://lempile.com/docs/direct/reference/send-invitation): `POST /api/v1/users/invite` - [List sent invitations](https://lempile.com/docs/direct/reference/list-sent-invitations): `GET /api/v1/users/invite/sent` - [Withdraw an invitation](https://lempile.com/docs/direct/reference/withdraw-invitation): `DELETE /api/v1/users/invite/sent/{invitation_id}` - [List relations](https://lempile.com/docs/direct/reference/list-relations): `GET /api/v1/users/relations` - [List received invitations](https://lempile.com/docs/direct/reference/list-received-invitations): `GET /api/v1/users/invite/received` - [Accept or decline a received invitation](https://lempile.com/docs/direct/reference/handle-invitation): `POST /api/v1/users/invite/received/{invitation_id}` ## Chats and messages - [List all attendees](https://lempile.com/docs/direct/reference/list-all-attendees): `GET /api/v1/chat_attendees` - [List chats](https://lempile.com/docs/direct/reference/list-chats): `GET /api/v1/chats` - [Start a chat](https://lempile.com/docs/direct/reference/start-chat): `POST /api/v1/chats` - [Retrieve a chat](https://lempile.com/docs/direct/reference/get-chat): `GET /api/v1/chats/{chat_id}` - [Mark a chat read or unread, mute it](https://lempile.com/docs/direct/reference/patch-chat): `PATCH /api/v1/chats/{chat_id}` - [Delete a chat](https://lempile.com/docs/direct/reference/delete-chat): `DELETE /api/v1/chats/{chat_id}` - [List a chat's attendees](https://lempile.com/docs/direct/reference/list-chat-attendees): `GET /api/v1/chats/{chat_id}/attendees` - [List a chat's messages](https://lempile.com/docs/direct/reference/list-messages): `GET /api/v1/chats/{chat_id}/messages` - [Send a message in a chat](https://lempile.com/docs/direct/reference/send-message): `POST /api/v1/chats/{chat_id}/messages` - [Retrieve a message](https://lempile.com/docs/direct/reference/get-message): `GET /api/v1/messages/{message_id}` - [Edit a message](https://lempile.com/docs/direct/reference/edit-message): `PATCH /api/v1/messages/{message_id}` - [Delete a message](https://lempile.com/docs/direct/reference/delete-message): `DELETE /api/v1/messages/{message_id}` - [React to a message](https://lempile.com/docs/direct/reference/add-message-reaction): `POST /api/v1/messages/{message_id}/reaction` - [Remove a message reaction](https://lempile.com/docs/direct/reference/remove-message-reaction): `DELETE /api/v1/messages/{message_id}/reaction` ## Posts - [Create a post](https://lempile.com/docs/direct/reference/create-post): `POST /api/v1/posts` - [Retrieve a post](https://lempile.com/docs/direct/reference/get-post): `GET /api/v1/posts/{post_id}` - [Delete a post](https://lempile.com/docs/direct/reference/delete-post): `DELETE /api/v1/posts/{post_id}` - [List a profile's or a company's posts](https://lempile.com/docs/direct/reference/list-user-posts): `GET /api/v1/users/{identifier}/posts` ## Comments and reactions - [React to a post or a comment](https://lempile.com/docs/direct/reference/add-reaction): `POST /api/v1/posts/reaction` - [Remove a reaction](https://lempile.com/docs/direct/reference/remove-reaction): `DELETE /api/v1/posts/reaction` - [List a post's comments](https://lempile.com/docs/direct/reference/list-comments): `GET /api/v1/posts/{post_id}/comments` - [Comment on a post](https://lempile.com/docs/direct/reference/comment-post): `POST /api/v1/posts/{post_id}/comments` - [Delete a comment](https://lempile.com/docs/direct/reference/delete-comment): `DELETE /api/v1/posts/{post_id}/comments/{comment_id}` - [List a post's reactions](https://lempile.com/docs/direct/reference/list-reactions): `GET /api/v1/posts/{post_id}/reactions` ## Search and companies - [Search people, companies, posts or jobs](https://lempile.com/docs/direct/reference/search-companies): `POST /api/v1/linkedin/search` - [Find search parameter ids](https://lempile.com/docs/direct/reference/search-parameters): `GET /api/v1/linkedin/search/parameters` - [Retrieve a company page](https://lempile.com/docs/direct/reference/get-company): `GET /api/v1/linkedin/company/{identifier}` - [Raw LinkedIn data (reads)](https://lempile.com/docs/direct/reference/raw-data): `POST /api/v1/linkedin` --- # Lempile Direct: List accounts `GET https://direct.lempile.com/api/v1/accounts` The LinkedIn accounts of this key's workspace, with their status (`total_count` and `status_counts` count those only). An account Direct never checked is checked once (one LinkedIn call). ## Authentication Send your Lempile Direct API key in the `X-API-KEY` header. ## Query parameters - `limit` (integer): Items per page: 1 to 250 (default 100). Default: `100`. - `cursor` (string): A cursor a previous page gave. ## Example request ```bash curl -sS "https://direct.lempile.com/api/v1/accounts" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` ## Responses ### 200 OK ```json { "object": "AccountList", "items": [ { "object": "Account", "type": "LINKEDIN", "id": "00000000-0000-4000-8000-0000000000a1", "name": "Ada Sender", "created_at": "2026-10-28T09:12:44.512Z", "connection_params": { "im": { "id": "ACoAAAbcdefghijklmnop", "publicIdentifier": "ada-sender", "username": "Ada Sender", "premiumId": null, "premiumContractId": null, "premiumFeatures": [ "premium" ], "organizations": [] } }, "groups": [], "sources": [ { "id": "00000000-0000-4000-8000-0000000000a1_MESSAGING", "status": "OK" } ] } ], "cursor": null, "total_count": 1, "status_counts": { "OK": 1, "CONNECTING": 0, "CREDENTIALS": 0, "STOPPED": 0, "ERROR": 0 } } ``` ### 400 A required parameter missing (`errors/missing_parameters`), or one that isn't valid (`errors/invalid_parameters`, `errors/invalid_url`, `errors/content_too_large`). ```json { "title": "Missing parameters", "detail": "account_id is required.", "type": "errors/missing_parameters", "status": 400 } ``` ### 401 `errors/missing_credentials`: the `X-API-KEY` header is missing, wrong or revoked. `errors/disconnected_account`: LinkedIn signed the account out (or asks it for a security check); reconnect it. ```json { "title": "Missing credentials", "detail": "The X-API-KEY header is missing or wrong.", "type": "errors/missing_credentials", "status": 401 } ``` --- # Lempile Direct: Connect an account (cookie) `POST https://direct.lempile.com/api/v1/accounts` Connects a LinkedIn account from its cookie, as Unipile's: no browser is ever opened for it. Lempile checks the cookie over HTTP with the browser's own user agent, language and timezone, through the account's own IP, keeps it encrypted and serves the account browserless. Keep using LinkedIn normally in that browser; signing out there ends the session (then connect again with a new cookie). Email and password go through hosted auth instead (POST /api/v1/hosted/accounts/link). ## Authentication Send your Lempile Direct API key in the `X-API-KEY` header. ## Request body `application/json` (required) - `provider` (string, required): One of: `LINKEDIN`. - `access_token` (string, required): The li_at cookie of the browser the person is signed in with. - `premium_token` (string): The li_a cookie (Sales Navigator / Recruiter), when there is one. - `user_agent` (string, required): The exact user agent of the browser the cookies come from. Lempile replays it on every call: a different one makes LinkedIn end the session. - `user_language` (string): That browser's language, e.g. fr-FR (or several, comma separated, in its order). - `user_timezone` (string): That browser's IANA timezone, e.g. Europe/Paris. - `cookies` (array of object, required): Lempile's own field (not Unipile's): every linkedin.com cookie of the browser li_at comes from, at least bcookie and JSESSIONID. li_at alone is refused (400 missing_browser_cookies): a new browser id for an existing session makes LinkedIn end it. - `name` (string, required) - `value` (string, required) - `domain` (string) - `path` (string) - `expires` (number) - `httpOnly` (boolean) - `secure` (boolean) ## Example request ```bash curl -sS -X POST "https://direct.lempile.com/api/v1/accounts" \ -H "X-API-KEY: $DIRECT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "provider": "LINKEDIN", "access_token": "AQEDAR…", "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36", "user_language": "fr-FR", "user_timezone": "Europe/Paris", "cookies": [ { "name": "JSESSIONID", "value": "\"ajax:1234567890123456789\"", "domain": ".www.linkedin.com" }, { "name": "bcookie", "value": "\"v=2&…\"", "domain": ".linkedin.com" } ] }' ``` ## Responses ### 201 Connected ```json { "object": "AccountCreated", "account_id": "00000000-0000-4000-8000-0000000000a1" } ``` ### 400 A required parameter missing (`errors/missing_parameters`), or one that isn't valid (`errors/invalid_parameters`, `errors/invalid_url`, `errors/content_too_large`). ```json { "title": "Missing parameters", "detail": "account_id is required.", "type": "errors/missing_parameters", "status": 400 } ``` ### 401 `errors/missing_credentials`: the `X-API-KEY` header is missing, wrong or revoked. `errors/disconnected_account`: LinkedIn signed the account out (or asks it for a security check); reconnect it. ```json { "title": "Missing credentials", "detail": "The X-API-KEY header is missing or wrong.", "type": "errors/missing_credentials", "status": 401 } ``` ### 403 LinkedIn refused it for this account (`errors/resource_access_restricted`, `errors/action_required`), or LinkedIn restricted the account (`errors/account_restricted`: every route answers it, with no LinkedIn call, until a person clears the restriction in Lempile), or the account doesn't write through Direct (`errors/insufficient_permissions`), or it needs Sales Navigator or Recruiter (`errors/feature_not_subscribed`). ```json { "title": "Access restricted", "detail": "LinkedIn refused this read for this account.", "type": "errors/resource_access_restricted", "status": 403 } ``` ### 409 `errors/conflict`: a write with this Idempotency-Key is still running. ```json { "title": "Write in progress", "detail": "A write with this key is still running.", "type": "errors/conflict", "status": 409 } ``` ### 501 `errors/feature_not_implemented`: Direct doesn't do this (yet). A Unipile client can fall back to Unipile. ```json { "title": "Missing feature", "detail": "Lempile Direct reads LinkedIn only (see /api/v1/users and /api/v1/posts).", "type": "errors/feature_not_implemented", "status": 501 } ``` ### 503 `errors/network_down`: the account's proxy or browser server didn't answer. Nothing was sent. ```json { "title": "Network down", "detail": "The account's proxy didn't connect.", "type": "errors/network_down", "status": 503 } ``` ### 504 `errors/request_timeout`: LinkedIn didn't answer in time. On a write: an unknown outcome (it may have been sent); it's never retried and its Idempotency-Key never writes again. ```json { "title": "Unknown outcome", "detail": "LinkedIn may have received this write; it isn't tried again. Check before sending it once more.", "type": "errors/request_timeout", "status": 504 } ``` --- # Lempile Direct: Retrieve an account `GET https://direct.lempile.com/api/v1/accounts/{account_id}` The account and its status. A status older than 10 minutes (15 while failing) is checked first: one `/voyager/api/me` through the account's own session. ## Authentication Send your Lempile Direct API key in the `X-API-KEY` header. ## Path parameters - `account_id` (string, required): The account id. Example: `00000000-0000-4000-8000-0000000000a1`. ## Example request ```bash curl -sS "https://direct.lempile.com/api/v1/accounts/00000000-0000-4000-8000-0000000000a1" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` ## Responses ### 200 OK ```json { "object": "Account", "type": "LINKEDIN", "id": "00000000-0000-4000-8000-0000000000a1", "name": "Ada Sender", "created_at": "2026-10-28T09:12:44.512Z", "connection_params": { "im": { "id": "ACoAAAbcdefghijklmnop", "publicIdentifier": "ada-sender", "username": "Ada Sender", "premiumId": null, "premiumContractId": null, "premiumFeatures": [ "premium" ], "organizations": [] } }, "groups": [], "sources": [ { "id": "00000000-0000-4000-8000-0000000000a1_MESSAGING", "status": "OK" } ] } ``` ### 401 `errors/missing_credentials`: the `X-API-KEY` header is missing, wrong or revoked. `errors/disconnected_account`: LinkedIn signed the account out (or asks it for a security check); reconnect it. ```json { "title": "Missing credentials", "detail": "The X-API-KEY header is missing or wrong.", "type": "errors/missing_credentials", "status": 401 } ``` ### 404 `errors/resource_not_found`: an unknown or removed account, an account of another workspace (answered exactly the same), or nothing on LinkedIn with this id. ```json { "title": "Account not found", "detail": "No account with this account_id is enabled here.", "type": "errors/resource_not_found", "status": 404 } ``` --- # Lempile Direct: Reconnect an account (cookie) `POST https://direct.lempile.com/api/v1/accounts/{account_id}` The same as Connect an account (cookie), for an account this key already has: the cookie must be the same LinkedIn member's (409 otherwise). ## Authentication Send your Lempile Direct API key in the `X-API-KEY` header. ## Path parameters - `account_id` (string, required): The account's id. ## Request body `application/json` (required) - `provider` (string, required): One of: `LINKEDIN`. - `access_token` (string, required): The li_at cookie of the browser the person is signed in with. - `premium_token` (string): The li_a cookie (Sales Navigator / Recruiter), when there is one. - `user_agent` (string, required): The exact user agent of the browser the cookies come from. Lempile replays it on every call: a different one makes LinkedIn end the session. - `user_language` (string): That browser's language, e.g. fr-FR (or several, comma separated, in its order). - `user_timezone` (string): That browser's IANA timezone, e.g. Europe/Paris. - `cookies` (array of object, required): Lempile's own field (not Unipile's): every linkedin.com cookie of the browser li_at comes from, at least bcookie and JSESSIONID. li_at alone is refused (400 missing_browser_cookies): a new browser id for an existing session makes LinkedIn end it. - `name` (string, required) - `value` (string, required) - `domain` (string) - `path` (string) - `expires` (number) - `httpOnly` (boolean) - `secure` (boolean) ## Example request ```bash curl -sS -X POST "https://direct.lempile.com/api/v1/accounts/{account_id}" \ -H "X-API-KEY: $DIRECT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "provider": "LINKEDIN", "access_token": "AQEDAR…", "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36", "user_language": "fr-FR", "user_timezone": "Europe/Paris", "cookies": [ { "name": "JSESSIONID", "value": "\"ajax:1234567890123456789\"", "domain": ".www.linkedin.com" }, { "name": "bcookie", "value": "\"v=2&…\"", "domain": ".linkedin.com" } ] }' ``` ## Responses ### 200 Reconnected ```json { "object": "AccountReconnected", "account_id": "00000000-0000-4000-8000-0000000000a1" } ``` ### 400 A required parameter missing (`errors/missing_parameters`), or one that isn't valid (`errors/invalid_parameters`, `errors/invalid_url`, `errors/content_too_large`). ```json { "title": "Missing parameters", "detail": "account_id is required.", "type": "errors/missing_parameters", "status": 400 } ``` ### 401 `errors/missing_credentials`: the `X-API-KEY` header is missing, wrong or revoked. `errors/disconnected_account`: LinkedIn signed the account out (or asks it for a security check); reconnect it. ```json { "title": "Missing credentials", "detail": "The X-API-KEY header is missing or wrong.", "type": "errors/missing_credentials", "status": 401 } ``` ### 403 LinkedIn refused it for this account (`errors/resource_access_restricted`, `errors/action_required`), or LinkedIn restricted the account (`errors/account_restricted`: every route answers it, with no LinkedIn call, until a person clears the restriction in Lempile), or the account doesn't write through Direct (`errors/insufficient_permissions`), or it needs Sales Navigator or Recruiter (`errors/feature_not_subscribed`). ```json { "title": "Access restricted", "detail": "LinkedIn refused this read for this account.", "type": "errors/resource_access_restricted", "status": 403 } ``` ### 404 `errors/resource_not_found`: an unknown or removed account, an account of another workspace (answered exactly the same), or nothing on LinkedIn with this id. ```json { "title": "Account not found", "detail": "No account with this account_id is enabled here.", "type": "errors/resource_not_found", "status": 404 } ``` ### 409 `errors/conflict`: a write with this Idempotency-Key is still running. ```json { "title": "Write in progress", "detail": "A write with this key is still running.", "type": "errors/conflict", "status": 409 } ``` ### 501 `errors/feature_not_implemented`: Direct doesn't do this (yet). A Unipile client can fall back to Unipile. ```json { "title": "Missing feature", "detail": "Lempile Direct reads LinkedIn only (see /api/v1/users and /api/v1/posts).", "type": "errors/feature_not_implemented", "status": 501 } ``` ### 503 `errors/network_down`: the account's proxy or browser server didn't answer. Nothing was sent. ```json { "title": "Network down", "detail": "The account's proxy didn't connect.", "type": "errors/network_down", "status": 503 } ``` ### 504 `errors/request_timeout`: LinkedIn didn't answer in time. On a write: an unknown outcome (it may have been sent); it's never retried and its Idempotency-Key never writes again. ```json { "title": "Unknown outcome", "detail": "LinkedIn may have received this write; it isn't tried again. Check before sending it once more.", "type": "errors/request_timeout", "status": 504 } ``` --- # Lempile Direct: Delete an account `DELETE https://direct.lempile.com/api/v1/accounts/{account_id}` Direct stops serving the account (it stays off across restarts), drops its kept session and sends the `account_status` webhook `DELETED`. The LinkedIn session and the Lempile account are untouched. Connect it again with a hosted auth link. ## Authentication Send your Lempile Direct API key in the `X-API-KEY` header. ## Path parameters - `account_id` (string, required): The account id. Example: `00000000-0000-4000-8000-0000000000a1`. ## Query parameters - `provider_session_revoke` (boolean): `true` answers 501: Direct never signs an account out of LinkedIn. Default: `false`. ## Example request ```bash curl -sS -X DELETE "https://direct.lempile.com/api/v1/accounts/00000000-0000-4000-8000-0000000000a1" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` ## Responses ### 200 OK ```json { "object": "AccountDeleted" } ``` ### 401 `errors/missing_credentials`: the `X-API-KEY` header is missing, wrong or revoked. `errors/disconnected_account`: LinkedIn signed the account out (or asks it for a security check); reconnect it. ```json { "title": "Missing credentials", "detail": "The X-API-KEY header is missing or wrong.", "type": "errors/missing_credentials", "status": 401 } ``` ### 404 `errors/resource_not_found`: an unknown or removed account, an account of another workspace (answered exactly the same), or nothing on LinkedIn with this id. ```json { "title": "Account not found", "detail": "No account with this account_id is enabled here.", "type": "errors/resource_not_found", "status": 404 } ``` ### 501 `errors/feature_not_implemented`: Direct doesn't do this (yet). A Unipile client can fall back to Unipile. ```json { "title": "Missing feature", "detail": "Lempile Direct reads LinkedIn only (see /api/v1/users and /api/v1/posts).", "type": "errors/feature_not_implemented", "status": 501 } ``` --- # Lempile Direct: Resync an account `POST https://direct.lempile.com/api/v1/accounts/{account_id}/resync` Drops the kept session, reads a fresh one from the account's browser and checks it with LinkedIn (one call). `SYNC_DONE` also sends the `account_status` webhook `SYNC_SUCCESS`. A signed-out account answers 401 `errors/disconnected_account`. Same as `GET /accounts/{account_id}/sync`. ## Authentication Send your Lempile Direct API key in the `X-API-KEY` header. ## Path parameters - `account_id` (string, required): The account id. Example: `00000000-0000-4000-8000-0000000000a1`. ## Example request ```bash curl -sS -X POST "https://direct.lempile.com/api/v1/accounts/00000000-0000-4000-8000-0000000000a1/resync" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` ## Responses ### 200 OK ```json { "object": "AccountResync", "status": "SYNC_DONE" } ``` ### 401 `errors/missing_credentials`: the `X-API-KEY` header is missing, wrong or revoked. `errors/disconnected_account`: LinkedIn signed the account out (or asks it for a security check); reconnect it. ```json { "title": "Missing credentials", "detail": "The X-API-KEY header is missing or wrong.", "type": "errors/missing_credentials", "status": 401 } ``` ### 404 `errors/resource_not_found`: an unknown or removed account, an account of another workspace (answered exactly the same), or nothing on LinkedIn with this id. ```json { "title": "Account not found", "detail": "No account with this account_id is enabled here.", "type": "errors/resource_not_found", "status": 404 } ``` --- # Lempile Direct: Resync an account (Unipile's GET form) `GET https://direct.lempile.com/api/v1/accounts/{account_id}/sync` Drops the kept session, reads a fresh one from the account's browser and checks it with LinkedIn (one call). `SYNC_DONE` also sends the `account_status` webhook `SYNC_SUCCESS`. A signed-out account answers 401 `errors/disconnected_account`. ## Authentication Send your Lempile Direct API key in the `X-API-KEY` header. ## Path parameters - `account_id` (string, required): The account id. Example: `00000000-0000-4000-8000-0000000000a1`. ## Example request ```bash curl -sS "https://direct.lempile.com/api/v1/accounts/00000000-0000-4000-8000-0000000000a1/sync" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` ## Responses ### 200 OK ```json { "object": "AccountResync", "status": "SYNC_DONE" } ``` ### 401 `errors/missing_credentials`: the `X-API-KEY` header is missing, wrong or revoked. `errors/disconnected_account`: LinkedIn signed the account out (or asks it for a security check); reconnect it. ```json { "title": "Missing credentials", "detail": "The X-API-KEY header is missing or wrong.", "type": "errors/missing_credentials", "status": 401 } ``` ### 404 `errors/resource_not_found`: an unknown or removed account, an account of another workspace (answered exactly the same), or nothing on LinkedIn with this id. ```json { "title": "Account not found", "detail": "No account with this account_id is enabled here.", "type": "errors/resource_not_found", "status": 404 } ``` --- # Lempile Direct: Create a hosted auth link `POST https://direct.lempile.com/api/v1/hosted/accounts/link` A link to a page where a person connects (or reconnects) their LinkedIn account through Lempile's own real-browser sign-in, checkpoints included. When they're back, Direct serves the account, checks it, POSTs `notify_url`, sends the `account_status` webhooks and redirects to `success_redirect_url`. A new account joins the key's workspace; a reconnect is for one of its accounts only. A new account's link is refused with 503 `errors/capacity_reached` when Lempile has no dedicated IP left for it (each account gets its own IP), so you can connect it another way at once; a reconnect is never refused for this. A new account's link is refused with 409 `errors/workspace_not_ready` when Lempile can't sign accounts in for the key's workspace at all, so no person is sent to a sign-in that would fail. ## Authentication Send your Lempile Direct API key in the `X-API-KEY` header. ## Request body `application/json` (required) - `type` (string, required): `create` connects a new LinkedIn account; `reconnect` signs an existing one in again. One of: `create`, `reconnect`. - `api_url` (string, required): Required, as on Unipile (any non-empty string; Direct doesn't use it). - `providers` (one of): Required for `create`: one provider, a category or a list, taking LinkedIn (`"LINKEDIN"`, `["LINKEDIN"]`, `"*"`, `"*:MESSAGING"`). Optional for `reconnect`; when given, it must take LinkedIn too. - Option 1: array of string - Option 2: string - `expiresOn` (string, required): ISO 8601 UTC time (`YYYY-MM-DDTHH:MM:SS.sssZ`), in the future. The link lasts 24 hours at most, whatever this says. - `name` (string): Your own reference (1 to 500 characters), sent back in `notify_url`'s body. - `reconnect_account` (string): The account id to reconnect (one of the key's workspace, served or removed). Required for `reconnect`. - `success_redirect_url` (string): Where the person lands once the account is connected and checked (https). - `failure_redirect_url` (string): Where the person lands after a cancel, a failure, or a session that doesn't work (https). - `notify_url` (string): Direct POSTs `{status, account_id, name}` here once the account works (https; put your own secret in it). - `bypass_success_screen` (boolean): Accepted; no effect (Direct redirects at once when `success_redirect_url` is set). ## Example request ```bash curl -sS -X POST "https://direct.lempile.com/api/v1/hosted/accounts/link" \ -H "X-API-KEY: $DIRECT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "type": "create", "api_url": "https://direct.lempile.com", "providers": [ "LINKEDIN" ], "expiresOn": "2026-11-01T12:00:00.000Z", "name": "user_42", "success_redirect_url": "https://app.example.com/linkedin/connected", "failure_redirect_url": "https://app.example.com/linkedin/failed", "notify_url": "https://app.example.com/hooks/direct-connected?secret=your-own-secret" }' ``` ## Responses ### 200 OK ```json { "object": "HostedAuthUrl", "url": "https://direct.lempile.com/connect/q1w2e3r4t5y6u7i8o9p0a1s2d3f4g5h6.j7k8l9z0x1c2v3b4n5m6" } ``` ### 400 A required parameter missing (`errors/missing_parameters`), or one that isn't valid (`errors/invalid_parameters`, `errors/invalid_url`, `errors/content_too_large`). ```json { "title": "Missing parameters", "detail": "account_id is required.", "type": "errors/missing_parameters", "status": 400 } ``` ### 401 `errors/missing_credentials`: the `X-API-KEY` header is missing, wrong or revoked. `errors/disconnected_account`: LinkedIn signed the account out (or asks it for a security check); reconnect it. ```json { "title": "Missing credentials", "detail": "The X-API-KEY header is missing or wrong.", "type": "errors/missing_credentials", "status": 401 } ``` ### 404 `errors/resource_not_found`: an unknown or removed account, an account of another workspace (answered exactly the same), or nothing on LinkedIn with this id. ```json { "title": "Account not found", "detail": "No account with this account_id is enabled here.", "type": "errors/resource_not_found", "status": 404 } ``` ### 503 No dedicated IP is free for a new account right now (`errors/capacity_reached`): the sign-in would fail, so no link is made. Try again later or connect the account another way. ```json { "title": "Capacity reached", "detail": "No dedicated IP is free for a new LinkedIn account right now, so this sign-in would fail. Try again later, or connect the account another way.", "type": "errors/capacity_reached", "status": 503 } ``` --- # Lempile Direct: List webhooks `GET https://direct.lempile.com/api/v1/webhooks` This key's workspace's webhooks, header values masked. ## Authentication Send your Lempile Direct API key in the `X-API-KEY` header. ## Query parameters - `limit` (integer): Items per page: 1 to 250 (default 100). Default: `100`. - `cursor` (string): A cursor a previous page gave. ## Example request ```bash curl -sS "https://direct.lempile.com/api/v1/webhooks" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` ## Responses ### 200 OK ```json { "object": "WebhookList", "items": [ { "object": "Webhook", "id": "a1B2c3D4e5F6g7H8i9J0kL", "account_ids": [], "enabled": true, "name": "messages", "request_url": "https://app.example.com/hooks/linkedin-messages", "format": "json", "headers": [ { "key": "x-webhook-secret", "value": "********" } ], "data": [], "events": [ "message_received", "message_read", "message_reaction", "message_edited", "message_deleted", "message_delivered" ], "type": "AUTO", "source": "messaging" } ], "cursor": null } ``` ### 400 A required parameter missing (`errors/missing_parameters`), or one that isn't valid (`errors/invalid_parameters`, `errors/invalid_url`, `errors/content_too_large`). ```json { "title": "Missing parameters", "detail": "account_id is required.", "type": "errors/missing_parameters", "status": 400 } ``` ### 401 `errors/missing_credentials`: the `X-API-KEY` header is missing, wrong or revoked. `errors/disconnected_account`: LinkedIn signed the account out (or asks it for a security check); reconnect it. ```json { "title": "Missing credentials", "detail": "The X-API-KEY header is missing or wrong.", "type": "errors/missing_credentials", "status": 401 } ``` --- # Lempile Direct: Create a webhook `POST https://direct.lempile.com/api/v1/webhooks` Registers a URL for one source's events. The webhook belongs to the key's workspace: only that workspace's accounts send to it. The poller starts reading the accounts it covers within a minute. ## Authentication Send your Lempile Direct API key in the `X-API-KEY` header. ## Request body `application/json` (required) - `request_url` (string, required): Where events are POSTed: https (http only to 127.0.0.1 or localhost). - `source` (string, required): One of: `messaging`, `users`, `account_status`. - `name` (string): 200 characters at most; sent as `webhook_name` in messaging and users payloads. - `format` (string): One of: `json`, `form`. Default: `"json"`. - `headers` (array of WebhookHeader): Up to 20 headers sent with every delivery (your secret goes here). Values are kept encrypted and never shown again. - `key` (string, required) - `value` (string, required) - `events` (array of string): Default: every Unipile v1 event of the source. - `account_ids` (array of string): Only these accounts. Default (empty): every account of the key's workspace. Another workspace's account named here never sends. - `data` (array of WebhookDataKey): Send only these keys, renamed (messaging and users only). - `key` (string, required): A key of the payload (see each source's payload). - `name` (string, required): The name it's sent under. - `enabled` (boolean): Default: `true`. ## Example request ```bash curl -sS -X POST "https://direct.lempile.com/api/v1/webhooks" \ -H "X-API-KEY: $DIRECT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "request_url": "https://app.example.com/hooks/linkedin-messages", "source": "messaging", "name": "messages", "headers": [ { "key": "x-webhook-secret", "value": "your-own-secret" } ] }' ``` ## Responses ### 201 Created ```json { "object": "WebhookCreated", "webhook_id": "a1B2c3D4e5F6g7H8i9J0kL" } ``` ### 400 A required parameter missing (`errors/missing_parameters`), or one that isn't valid (`errors/invalid_parameters`, `errors/invalid_url`, `errors/content_too_large`). ```json { "title": "Missing parameters", "detail": "account_id is required.", "type": "errors/missing_parameters", "status": 400 } ``` ### 401 `errors/missing_credentials`: the `X-API-KEY` header is missing, wrong or revoked. `errors/disconnected_account`: LinkedIn signed the account out (or asks it for a security check); reconnect it. ```json { "title": "Missing credentials", "detail": "The X-API-KEY header is missing or wrong.", "type": "errors/missing_credentials", "status": 401 } ``` --- # Lempile Direct: Delete a webhook `DELETE https://direct.lempile.com/api/v1/webhooks/{hook_id}` Deletes one of this key's workspace's webhooks (another workspace's answers 404); its deliveries still pending are dropped. ## Authentication Send your Lempile Direct API key in the `X-API-KEY` header. ## Path parameters - `hook_id` (string, required): The webhook's id. Example: `a1B2c3D4e5F6g7H8i9J0kL`. ## Example request ```bash curl -sS -X DELETE "https://direct.lempile.com/api/v1/webhooks/a1B2c3D4e5F6g7H8i9J0kL" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` ## Responses ### 200 OK ```json { "object": "WebhookDeleted" } ``` ### 401 `errors/missing_credentials`: the `X-API-KEY` header is missing, wrong or revoked. `errors/disconnected_account`: LinkedIn signed the account out (or asks it for a security check); reconnect it. ```json { "title": "Missing credentials", "detail": "The X-API-KEY header is missing or wrong.", "type": "errors/missing_credentials", "status": 401 } ``` ### 404 `errors/resource_not_found`: an unknown or removed account, an account of another workspace (answered exactly the same), or nothing on LinkedIn with this id. ```json { "title": "Account not found", "detail": "No account with this account_id is enabled here.", "type": "errors/resource_not_found", "status": 404 } ``` --- # Lempile Direct: Look up a profile by URL, or list chat attendees `GET https://direct.lempile.com/api/v1/users` With `provider_url`: that profile (`UserProfile`), as `GET /users/{identifier}`. Without: everyone the account has a conversation with, newest conversation first (`ChatAttendeeList`), as `GET /chat_attendees`. ## Authentication Send your Lempile Direct API key in the `X-API-KEY` header. ## Query parameters - `account_id` (string, required): The account that reads: a Lempile LinkedIn account id (`GET /accounts` lists them). Example: `00000000-0000-4000-8000-0000000000a1`. - `provider_url` (string): A LinkedIn profile URL (`https://www.linkedin.com/in/…`). - `limit` (integer): Items per page: 1 to 250 (default 100). Default: `100`. - `cursor` (string): A cursor a previous page gave. ## Example request ```bash curl -sS "https://direct.lempile.com/api/v1/users?account_id=00000000-0000-4000-8000-0000000000a1" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` ## Responses ### 200 OK ```json { "object": "UserProfile", "provider": "LINKEDIN", "provider_id": "ACoAAAbcdefghijklmnop", "public_identifier": "ada-sender", "first_name": "Ada", "last_name": "Sender", "headline": "Founder at Example", "websites": [], "is_premium": false, "is_influencer": false, "is_creator": true, "is_open_profile": true, "is_relationship": false, "is_self": true, "public_profile_url": "https://www.linkedin.com/in/ada-sender/", "member_urn": "123", "location": "Paris, Île-de-France, France", "primary_locale": { "country": "US", "language": "en" }, "profile_picture_url": "https://media.licdn.com/dms/image/x/400.jpg", "profile_picture_url_large": "https://media.licdn.com/dms/image/x/800.jpg", "background_picture_url": "https://media.licdn.com/dms/image/x/1584.jpg" } ``` ### 400 A required parameter missing (`errors/missing_parameters`), or one that isn't valid (`errors/invalid_parameters`, `errors/invalid_url`, `errors/content_too_large`). ```json { "title": "Missing parameters", "detail": "account_id is required.", "type": "errors/missing_parameters", "status": 400 } ``` ### 401 `errors/missing_credentials`: the `X-API-KEY` header is missing, wrong or revoked. `errors/disconnected_account`: LinkedIn signed the account out (or asks it for a security check); reconnect it. ```json { "title": "Missing credentials", "detail": "The X-API-KEY header is missing or wrong.", "type": "errors/missing_credentials", "status": 401 } ``` ### 404 `errors/resource_not_found`: an unknown or removed account, an account of another workspace (answered exactly the same), or nothing on LinkedIn with this id. ```json { "title": "Account not found", "detail": "No account with this account_id is enabled here.", "type": "errors/resource_not_found", "status": 404 } ``` ### 429 `errors/too_many_requests`: LinkedIn asked the account to slow down (it rests 15 minutes), its daily calls or writes are used up, or it's busy with other calls. Wait `retry_after` seconds. ```json { "title": "Too many requests", "detail": "LinkedIn asked this account to slow down.", "type": "errors/too_many_requests", "status": 429, "retry_after": 900 } ``` ### 500 `errors/provider_error`: LinkedIn answered something Direct couldn't read (nothing was written). `errors/unexpected_error`: Direct failed. ```json { "title": "Provider error", "detail": "LinkedIn answered 500.", "type": "errors/provider_error", "status": 500 } ``` ### 503 `errors/network_down`: the account's proxy or browser server didn't answer. Nothing was sent. ```json { "title": "Network down", "detail": "The account's proxy didn't connect.", "type": "errors/network_down", "status": 503 } ``` ### 504 `errors/request_timeout`: LinkedIn didn't answer in time. On a write: an unknown outcome (it may have been sent); it's never retried and its Idempotency-Key never writes again. ```json { "title": "Unknown outcome", "detail": "LinkedIn may have received this write; it isn't tried again. Check before sending it once more.", "type": "errors/request_timeout", "status": 504 } ``` --- # Lempile Direct: Retrieve the account's own profile `GET https://direct.lempile.com/api/v1/users/me` The connected member: three LinkedIn calls the first time, then kept an hour. Its `profile_picture_url` is Direct's permanent copy of the member's own picture (see the field). ## Authentication Send your Lempile Direct API key in the `X-API-KEY` header. ## Query parameters - `account_id` (string, required): The account that reads: a Lempile LinkedIn account id (`GET /accounts` lists them). Example: `00000000-0000-4000-8000-0000000000a1`. ## Example request ```bash curl -sS "https://direct.lempile.com/api/v1/users/me?account_id=00000000-0000-4000-8000-0000000000a1" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` ## Responses ### 200 OK ```json { "object": "AccountOwnerProfile", "provider": "LINKEDIN", "provider_id": "ACoAAAbcdefghijklmnop", "entity_urn": "urn:li:fsd_profile:ACoAAAbcdefghijklmnop", "object_urn": "urn:li:member:123", "first_name": "Ada", "last_name": "Sender", "profile_picture_url": "https://media.licdn.com/dms/image/x/400.jpg", "public_profile_url": "https://www.linkedin.com/in/ada-sender/", "public_identifier": "ada-sender", "email": "ada@example.com", "premium": true, "open_profile": true, "organizations": [], "recruiter": null, "sales_navigator": null, "headline": "Founder", "occupation": "Founder", "location": "Paris, Île-de-France, France" } ``` ### 400 A required parameter missing (`errors/missing_parameters`), or one that isn't valid (`errors/invalid_parameters`, `errors/invalid_url`, `errors/content_too_large`). ```json { "title": "Missing parameters", "detail": "account_id is required.", "type": "errors/missing_parameters", "status": 400 } ``` ### 401 `errors/missing_credentials`: the `X-API-KEY` header is missing, wrong or revoked. `errors/disconnected_account`: LinkedIn signed the account out (or asks it for a security check); reconnect it. ```json { "title": "Missing credentials", "detail": "The X-API-KEY header is missing or wrong.", "type": "errors/missing_credentials", "status": 401 } ``` ### 404 `errors/resource_not_found`: an unknown or removed account, an account of another workspace (answered exactly the same), or nothing on LinkedIn with this id. ```json { "title": "Account not found", "detail": "No account with this account_id is enabled here.", "type": "errors/resource_not_found", "status": 404 } ``` ### 429 `errors/too_many_requests`: LinkedIn asked the account to slow down (it rests 15 minutes), its daily calls or writes are used up, or it's busy with other calls. Wait `retry_after` seconds. ```json { "title": "Too many requests", "detail": "LinkedIn asked this account to slow down.", "type": "errors/too_many_requests", "status": 429, "retry_after": 900 } ``` ### 500 `errors/provider_error`: LinkedIn answered something Direct couldn't read (nothing was written). `errors/unexpected_error`: Direct failed. ```json { "title": "Provider error", "detail": "LinkedIn answered 500.", "type": "errors/provider_error", "status": 500 } ``` ### 503 `errors/network_down`: the account's proxy or browser server didn't answer. Nothing was sent. ```json { "title": "Network down", "detail": "The account's proxy didn't connect.", "type": "errors/network_down", "status": 503 } ``` ### 504 `errors/request_timeout`: LinkedIn didn't answer in time. On a write: an unknown outcome (it may have been sent); it's never retried and its Idempotency-Key never writes again. ```json { "title": "Unknown outcome", "detail": "LinkedIn may have received this write; it isn't tried again. Check before sending it once more.", "type": "errors/request_timeout", "status": 504 } ``` --- # Lempile Direct: Retrieve a profile `GET https://direct.lempile.com/api/v1/users/{identifier}` A member's profile, as Unipile answers it: its top card, the profile page's second card (followers, connections, mutual connections, verification) and its contact info (websites, emails, phones): three LinkedIn calls. `linkedin_sections` adds the sections. Lempile only, not on Unipile: `lempile_light=true` reads the top card and the sections asked, nothing else: one LinkedIn call, two with `linkedin_sections=experience` (instead of three and four). Someone from the account's recent conversations, read by provider id without sections, is answered from what the conversation showed, with no LinkedIn call (names, headline, picture, link, degree). ## Authentication Send your Lempile Direct API key in the `X-API-KEY` header. ## Path parameters - `identifier` (string, required): The person: provider id (`ACo…`), public identifier, `urn:li:fsd_profile:…`, a profile URL (URL-encoded) or `me`. Example: `ada-sender`. ## Query parameters - `account_id` (string, required): The account that reads: a Lempile LinkedIn account id (`GET /accounts` lists them). Example: `00000000-0000-4000-8000-0000000000a1`. - `linkedin_sections` (array of string): Sections to add: `*` (all, in full), `*_preview`, or any of `about`, `experience`, `education`, `skills`, `languages`, `certifications`, `volunteering_experience`, `projects`, `recommendations_received`, `recommendations_given`, `recruiting_activity`, each also `_preview`. Repeat the parameter or separate with commas. `skills_preview` keeps the skills the profile shows; the other `_preview` values equal the full ones. Sections cost 1 to 6 more LinkedIn calls in all. - `linkedin_api` (string): Any value (`recruiter`, `sales_navigator`) answers 501. - `lempile_light` (boolean): Lempile only: Unipile has no such parameter, and without it (or with `false`) the answer is Unipile's, unchanged. `true` reads the top card and the sections `linkedin_sections` asks, and skips the profile page's second card and the contact info: two LinkedIn calls fewer, so fewer calls against the account's daily cap (no section: 1 call instead of 3; `experience`: 2 instead of 4). The keys only those two reads give are left out, never answered empty: `follower_count`, `connections_count`, `shared_connections_count`, `is_verified`, `websites`, `contact_info` and `birthdate`. Default: `false`. Example: `true`. ## Example request ```bash curl -sS "https://direct.lempile.com/api/v1/users/ada-sender?account_id=00000000-0000-4000-8000-0000000000a1" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` ## Responses ### 200 OK ```json { "object": "UserProfile", "provider": "LINKEDIN", "provider_id": "ACoAAAbcdefghijklmnop", "public_identifier": "ada-sender", "first_name": "Ada", "last_name": "Sender", "headline": "Founder at Example", "websites": [], "is_premium": false, "is_influencer": false, "is_creator": true, "is_open_profile": true, "is_relationship": false, "is_self": true, "public_profile_url": "https://www.linkedin.com/in/ada-sender/", "member_urn": "123", "location": "Paris, Île-de-France, France", "primary_locale": { "country": "US", "language": "en" }, "profile_picture_url": "https://media.licdn.com/dms/image/x/100.jpg", "profile_picture_url_large": "https://media.licdn.com/dms/image/x/800.jpg", "background_picture_url": "https://media.licdn.com/dms/image/x/800.jpg", "follower_count": 973, "connections_count": 970, "is_verified": false } ``` ### 400 A required parameter missing (`errors/missing_parameters`), or one that isn't valid (`errors/invalid_parameters`, `errors/invalid_url`, `errors/content_too_large`). ```json { "title": "Missing parameters", "detail": "account_id is required.", "type": "errors/missing_parameters", "status": 400 } ``` ### 401 `errors/missing_credentials`: the `X-API-KEY` header is missing, wrong or revoked. `errors/disconnected_account`: LinkedIn signed the account out (or asks it for a security check); reconnect it. ```json { "title": "Missing credentials", "detail": "The X-API-KEY header is missing or wrong.", "type": "errors/missing_credentials", "status": 401 } ``` ### 404 `errors/resource_not_found`: an unknown or removed account, an account of another workspace (answered exactly the same), or nothing on LinkedIn with this id. ```json { "title": "Account not found", "detail": "No account with this account_id is enabled here.", "type": "errors/resource_not_found", "status": 404 } ``` ### 429 `errors/too_many_requests`: LinkedIn asked the account to slow down (it rests 15 minutes), its daily calls or writes are used up, or it's busy with other calls. Wait `retry_after` seconds. ```json { "title": "Too many requests", "detail": "LinkedIn asked this account to slow down.", "type": "errors/too_many_requests", "status": 429, "retry_after": 900 } ``` ### 500 `errors/provider_error`: LinkedIn answered something Direct couldn't read (nothing was written). `errors/unexpected_error`: Direct failed. ```json { "title": "Provider error", "detail": "LinkedIn answered 500.", "type": "errors/provider_error", "status": 500 } ``` ### 501 `errors/feature_not_implemented`: Direct doesn't do this (yet). A Unipile client can fall back to Unipile. ```json { "title": "Missing feature", "detail": "Lempile Direct reads LinkedIn only (see /api/v1/users and /api/v1/posts).", "type": "errors/feature_not_implemented", "status": 501 } ``` ### 503 `errors/network_down`: the account's proxy or browser server didn't answer. Nothing was sent. ```json { "title": "Network down", "detail": "The account's proxy didn't connect.", "type": "errors/network_down", "status": 503 } ``` ### 504 `errors/request_timeout`: LinkedIn didn't answer in time. On a write: an unknown outcome (it may have been sent); it's never retried and its Idempotency-Key never writes again. ```json { "title": "Unknown outcome", "detail": "LinkedIn may have received this write; it isn't tried again. Check before sending it once more.", "type": "errors/request_timeout", "status": 504 } ``` --- # Lempile Direct: List a member's comments `GET https://direct.lempile.com/api/v1/users/{identifier}/comments` The comments the member wrote, from their profile's activity (20 posts a LinkedIn call), newest first. ## Authentication Send your Lempile Direct API key in the `X-API-KEY` header. ## Path parameters - `identifier` (string, required): The member's provider id (ACo…), public identifier, or `me`. ## Query parameters - `account_id` (string, required): The account that reads: a Lempile LinkedIn account id (`GET /accounts` lists them). Example: `00000000-0000-4000-8000-0000000000a1`. - `limit` (integer): Items per page: 1 to 100 (default 10). Default: `10`. - `cursor` (string): A cursor a previous page gave. ## Example request ```bash curl -sS "https://direct.lempile.com/api/v1/users/{identifier}/comments?account_id=00000000-0000-4000-8000-0000000000a1" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` ## Responses ### 200 OK ```json { "object": "CommentList", "items": [ { "object": "Comment", "id": "7391000000000000001", "post_id": "7390000000000000004", "post_urn": "urn:li:activity:7390000000000000004", "author": "Ada Sender", "author_details": { "id": "ACoAAAbcdefghijklmnop", "headline": "Founder", "profile_url": "https://www.linkedin.com/in/ada-sender", "profile_picture_url": null, "network_distance": null }, "date": "2025-10-24T10:00:00.000Z", "text": "Great point", "reaction_counter": 3, "reply_counter": 1 } ], "cursor": null, "paging": { "page_count": 1 } } ``` ### 400 A required parameter missing (`errors/missing_parameters`), or one that isn't valid (`errors/invalid_parameters`, `errors/invalid_url`, `errors/content_too_large`). ```json { "title": "Missing parameters", "detail": "account_id is required.", "type": "errors/missing_parameters", "status": 400 } ``` ### 401 `errors/missing_credentials`: the `X-API-KEY` header is missing, wrong or revoked. `errors/disconnected_account`: LinkedIn signed the account out (or asks it for a security check); reconnect it. ```json { "title": "Missing credentials", "detail": "The X-API-KEY header is missing or wrong.", "type": "errors/missing_credentials", "status": 401 } ``` ### 403 LinkedIn refused it for this account (`errors/resource_access_restricted`, `errors/action_required`), or LinkedIn restricted the account (`errors/account_restricted`: every route answers it, with no LinkedIn call, until a person clears the restriction in Lempile), or the account doesn't write through Direct (`errors/insufficient_permissions`), or it needs Sales Navigator or Recruiter (`errors/feature_not_subscribed`). ```json { "title": "Access restricted", "detail": "LinkedIn refused this read for this account.", "type": "errors/resource_access_restricted", "status": 403 } ``` ### 404 `errors/resource_not_found`: an unknown or removed account, an account of another workspace (answered exactly the same), or nothing on LinkedIn with this id. ```json { "title": "Account not found", "detail": "No account with this account_id is enabled here.", "type": "errors/resource_not_found", "status": 404 } ``` ### 429 `errors/too_many_requests`: LinkedIn asked the account to slow down (it rests 15 minutes), its daily calls or writes are used up, or it's busy with other calls. Wait `retry_after` seconds. ```json { "title": "Too many requests", "detail": "LinkedIn asked this account to slow down.", "type": "errors/too_many_requests", "status": 429, "retry_after": 900 } ``` ### 500 `errors/provider_error`: LinkedIn answered something Direct couldn't read (nothing was written). `errors/unexpected_error`: Direct failed. ```json { "title": "Provider error", "detail": "LinkedIn answered 500.", "type": "errors/provider_error", "status": 500 } ``` ### 501 `errors/feature_not_implemented`: Direct doesn't do this (yet). A Unipile client can fall back to Unipile. ```json { "title": "Missing feature", "detail": "Lempile Direct reads LinkedIn only (see /api/v1/users and /api/v1/posts).", "type": "errors/feature_not_implemented", "status": 501 } ``` ### 503 `errors/network_down`: the account's proxy or browser server didn't answer. Nothing was sent. ```json { "title": "Network down", "detail": "The account's proxy didn't connect.", "type": "errors/network_down", "status": 503 } ``` ### 504 `errors/request_timeout`: LinkedIn didn't answer in time. On a write: an unknown outcome (it may have been sent); it's never retried and its Idempotency-Key never writes again. ```json { "title": "Unknown outcome", "detail": "LinkedIn may have received this write; it isn't tried again. Check before sending it once more.", "type": "errors/request_timeout", "status": 504 } ``` --- # Lempile Direct: List a member's reactions `GET https://direct.lempile.com/api/v1/users/{identifier}/reactions` The posts the member reacted to, from their profile's activity (20 a LinkedIn call), newest first, with the reaction LinkedIn shows. ## Authentication Send your Lempile Direct API key in the `X-API-KEY` header. ## Path parameters - `identifier` (string, required): The member's provider id (ACo…), public identifier, or `me`. ## Query parameters - `account_id` (string, required): The account that reads: a Lempile LinkedIn account id (`GET /accounts` lists them). Example: `00000000-0000-4000-8000-0000000000a1`. - `limit` (integer): Items per page: 1 to 100 (default 10). Default: `10`. - `cursor` (string): A cursor a previous page gave. ## Example request ```bash curl -sS "https://direct.lempile.com/api/v1/users/{identifier}/reactions?account_id=00000000-0000-4000-8000-0000000000a1" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` ## Responses ### 200 OK ```json { "object": "PostReactionList", "items": [ { "object": "PostReaction", "value": "PRAISE", "post_id": "7390000000000000005", "author": { "id": "ACoAAAbcdefghijklmnop", "type": "INDIVIDUAL", "name": "Ada Sender", "headline": null, "profile_url": "https://www.linkedin.com/in/ada-sender/", "profile_picture_url": null } } ], "cursor": null, "paging": { "page_count": 1 } } ``` ### 400 A required parameter missing (`errors/missing_parameters`), or one that isn't valid (`errors/invalid_parameters`, `errors/invalid_url`, `errors/content_too_large`). ```json { "title": "Missing parameters", "detail": "account_id is required.", "type": "errors/missing_parameters", "status": 400 } ``` ### 401 `errors/missing_credentials`: the `X-API-KEY` header is missing, wrong or revoked. `errors/disconnected_account`: LinkedIn signed the account out (or asks it for a security check); reconnect it. ```json { "title": "Missing credentials", "detail": "The X-API-KEY header is missing or wrong.", "type": "errors/missing_credentials", "status": 401 } ``` ### 403 LinkedIn refused it for this account (`errors/resource_access_restricted`, `errors/action_required`), or LinkedIn restricted the account (`errors/account_restricted`: every route answers it, with no LinkedIn call, until a person clears the restriction in Lempile), or the account doesn't write through Direct (`errors/insufficient_permissions`), or it needs Sales Navigator or Recruiter (`errors/feature_not_subscribed`). ```json { "title": "Access restricted", "detail": "LinkedIn refused this read for this account.", "type": "errors/resource_access_restricted", "status": 403 } ``` ### 404 `errors/resource_not_found`: an unknown or removed account, an account of another workspace (answered exactly the same), or nothing on LinkedIn with this id. ```json { "title": "Account not found", "detail": "No account with this account_id is enabled here.", "type": "errors/resource_not_found", "status": 404 } ``` ### 429 `errors/too_many_requests`: LinkedIn asked the account to slow down (it rests 15 minutes), its daily calls or writes are used up, or it's busy with other calls. Wait `retry_after` seconds. ```json { "title": "Too many requests", "detail": "LinkedIn asked this account to slow down.", "type": "errors/too_many_requests", "status": 429, "retry_after": 900 } ``` ### 500 `errors/provider_error`: LinkedIn answered something Direct couldn't read (nothing was written). `errors/unexpected_error`: Direct failed. ```json { "title": "Provider error", "detail": "LinkedIn answered 500.", "type": "errors/provider_error", "status": 500 } ``` ### 501 `errors/feature_not_implemented`: Direct doesn't do this (yet). A Unipile client can fall back to Unipile. ```json { "title": "Missing feature", "detail": "Lempile Direct reads LinkedIn only (see /api/v1/users and /api/v1/posts).", "type": "errors/feature_not_implemented", "status": 501 } ``` ### 503 `errors/network_down`: the account's proxy or browser server didn't answer. Nothing was sent. ```json { "title": "Network down", "detail": "The account's proxy didn't connect.", "type": "errors/network_down", "status": 503 } ``` ### 504 `errors/request_timeout`: LinkedIn didn't answer in time. On a write: an unknown outcome (it may have been sent); it's never retried and its Idempotency-Key never writes again. ```json { "title": "Unknown outcome", "detail": "LinkedIn may have received this write; it isn't tried again. Check before sending it once more.", "type": "errors/request_timeout", "status": 504 } ``` --- # Lempile Direct: List followers `GET https://direct.lempile.com/api/v1/users/followers` The account's followers, newest first, as My Network → Followers lists them (one LinkedIn call a page; LinkedIn may answer a few less than `limit`, and the next page starts after the ones asked, as Unipile). `user_id` of another member answers an empty list (LinkedIn shows a member's follower count, never the list, to another account; Unipile answers the same); a company's answers 501. `GET /api/v1/users/following` answers Unipile's own 501 for LinkedIn. ## Authentication Send your Lempile Direct API key in the `X-API-KEY` header. ## Query parameters - `account_id` (string, required): The account that reads: a Lempile LinkedIn account id (`GET /accounts` lists them). Example: `00000000-0000-4000-8000-0000000000a1`. - `user_id` (string): A member's provider id: the account's own (the default), or another member's (an empty list). - `limit` (integer): Items per page: 1 to 100 (default 100). Default: `100`. - `cursor` (string): A cursor a previous page gave. ## Example request ```bash curl -sS "https://direct.lempile.com/api/v1/users/followers?account_id=00000000-0000-4000-8000-0000000000a1" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` ## Responses ### 200 OK ```json { "object": "UserFollowersList", "items": [ { "object": "UserFollower", "id": "ACoAAAfollower00000000", "urn": "urn:li:fsd_profile:ACoAAAfollower00000000", "name": "Follower 0", "headline": "Founder at Example 0", "profile_url": "https://www.linkedin.com/in/ACoAAAfollower00000000", "profile_picture_url": "https://media.licdn.com/dms/image/f0/100.jpg", "profile_picture_url_large": "https://media.licdn.com/dms/image/f0/800.jpg" } ], "cursor": "eyJrIjoiZm9sbG93ZXJzIiwicyI6MX0" } ``` ### 400 A required parameter missing (`errors/missing_parameters`), or one that isn't valid (`errors/invalid_parameters`, `errors/invalid_url`, `errors/content_too_large`). ```json { "title": "Missing parameters", "detail": "account_id is required.", "type": "errors/missing_parameters", "status": 400 } ``` ### 401 `errors/missing_credentials`: the `X-API-KEY` header is missing, wrong or revoked. `errors/disconnected_account`: LinkedIn signed the account out (or asks it for a security check); reconnect it. ```json { "title": "Missing credentials", "detail": "The X-API-KEY header is missing or wrong.", "type": "errors/missing_credentials", "status": 401 } ``` ### 404 `errors/resource_not_found`: an unknown or removed account, an account of another workspace (answered exactly the same), or nothing on LinkedIn with this id. ```json { "title": "Account not found", "detail": "No account with this account_id is enabled here.", "type": "errors/resource_not_found", "status": 404 } ``` ### 429 `errors/too_many_requests`: LinkedIn asked the account to slow down (it rests 15 minutes), its daily calls or writes are used up, or it's busy with other calls. Wait `retry_after` seconds. ```json { "title": "Too many requests", "detail": "LinkedIn asked this account to slow down.", "type": "errors/too_many_requests", "status": 429, "retry_after": 900 } ``` ### 500 `errors/provider_error`: LinkedIn answered something Direct couldn't read (nothing was written). `errors/unexpected_error`: Direct failed. ```json { "title": "Provider error", "detail": "LinkedIn answered 500.", "type": "errors/provider_error", "status": 500 } ``` ### 501 `errors/feature_not_implemented`: Direct doesn't do this (yet). A Unipile client can fall back to Unipile. ```json { "title": "Missing feature", "detail": "Lempile Direct reads LinkedIn only (see /api/v1/users and /api/v1/posts).", "type": "errors/feature_not_implemented", "status": 501 } ``` ### 503 `errors/network_down`: the account's proxy or browser server didn't answer. Nothing was sent. ```json { "title": "Network down", "detail": "The account's proxy didn't connect.", "type": "errors/network_down", "status": 503 } ``` ### 504 `errors/request_timeout`: LinkedIn didn't answer in time. On a write: an unknown outcome (it may have been sent); it's never retried and its Idempotency-Key never writes again. ```json { "title": "Unknown outcome", "detail": "LinkedIn may have received this write; it isn't tried again. Check before sending it once more.", "type": "errors/request_timeout", "status": 504 } ``` --- # Lempile Direct: Send an invitation `POST https://direct.lempile.com/api/v1/users/invite` Reads the person's top card first: a connection answers 422 `errors/already_connected`, an invitation already waiting `errors/already_invited_recently`, the account itself or someone who invited it `errors/cannot_invite_attendee`, an unknown profile `errors/invalid_recipient`. Then sends the invitation (one write). ## Authentication Send your Lempile Direct API key in the `X-API-KEY` header. ## Query parameters - `account_id` (string): The account that writes, when the body doesn't name it. - `dry_run` (boolean): `true`: answer the write's plan (`DryRun`, 200) and send nothing to LinkedIn. Default: `false`. ## Headers - `Idempotency-Key` (string): The same key (per account) never writes twice: a repeat answers the first answer for 7 days; a repeat while the first runs answers 409. ## Request body `application/json` (required) - `account_id` (string, required): The account that writes (or `?account_id=`). Required. - `provider_id` (string, required): The person: their provider id (`ACo…`), public identifier or profile URL. - `message` (string): The note, 300 characters at most. - `user_email` (string): The person's email address, when LinkedIn asks for it to connect. `multipart/form-data` (required) - `account_id` (string, required): The account that writes (or `?account_id=`). Required. - `provider_id` (string, required): The person: their provider id (`ACo…`), public identifier or profile URL. - `message` (string): The note, 300 characters at most. - `user_email` (string): The person's email address, when LinkedIn asks for it to connect. ## Example request ```bash curl -sS -X POST "https://direct.lempile.com/api/v1/users/invite?dry_run=true" \ -H "X-API-KEY: $DIRECT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "account_id": "00000000-0000-4000-8000-0000000000a1", "provider_id": "ACoAAAzyxwvutsrqponml", "message": "Hi Bob, good to meet you at the meetup." }' ``` ## Responses ### 200 Sent, or with `?dry_run=true` the plan. ```json { "object": "UserInvitationSent", "invitation_id": "7300000000000000002" } ``` ### 400 A required parameter missing (`errors/missing_parameters`), or one that isn't valid (`errors/invalid_parameters`, `errors/invalid_url`, `errors/content_too_large`). ```json { "title": "Missing parameters", "detail": "account_id is required.", "type": "errors/missing_parameters", "status": 400 } ``` ### 401 `errors/missing_credentials`: the `X-API-KEY` header is missing, wrong or revoked. `errors/disconnected_account`: LinkedIn signed the account out (or asks it for a security check); reconnect it. ```json { "title": "Missing credentials", "detail": "The X-API-KEY header is missing or wrong.", "type": "errors/missing_credentials", "status": 401 } ``` ### 403 LinkedIn refused it for this account (`errors/resource_access_restricted`, `errors/action_required`), or LinkedIn restricted the account (`errors/account_restricted`: every route answers it, with no LinkedIn call, until a person clears the restriction in Lempile), or the account doesn't write through Direct (`errors/insufficient_permissions`), or it needs Sales Navigator or Recruiter (`errors/feature_not_subscribed`). ```json { "title": "Access restricted", "detail": "LinkedIn refused this read for this account.", "type": "errors/resource_access_restricted", "status": 403 } ``` ### 404 `errors/resource_not_found`: an unknown or removed account, an account of another workspace (answered exactly the same), or nothing on LinkedIn with this id. ```json { "title": "Account not found", "detail": "No account with this account_id is enabled here.", "type": "errors/resource_not_found", "status": 404 } ``` ### 409 `errors/conflict`: a write with this Idempotency-Key is still running. ```json { "title": "Write in progress", "detail": "A write with this key is still running.", "type": "errors/conflict", "status": 409 } ``` ### 422 A write LinkedIn refuses, or that the checks before it refuse: `errors/already_connected`, `errors/already_invited_recently`, `errors/cannot_invite_attendee`, `errors/invalid_recipient`, `errors/cannot_resend_yet`, `errors/limit_exceeded`, `errors/connection_limit_reached`, `errors/no_connection_with_recipient`, `errors/not_allowed_inmail`, `errors/insufficient_credits`, `errors/invalid_post`, `errors/unprocessable_entity`, `errors/invalid_parameters`, `errors/invalid_message` (a voice note over 60 seconds), `errors/action_already_performed` (a message already deleted), `errors/not_supported_by_provider`. ```json { "title": "Already connected", "detail": "This person is already a connection of the account.", "type": "errors/already_connected", "status": 422 } ``` ### 429 `errors/too_many_requests`: LinkedIn asked the account to slow down (it rests 15 minutes), its daily calls or writes are used up, or it's busy with other calls. Wait `retry_after` seconds. ```json { "title": "Too many requests", "detail": "LinkedIn asked this account to slow down.", "type": "errors/too_many_requests", "status": 429, "retry_after": 900 } ``` ### 500 `errors/provider_error`: LinkedIn answered something Direct couldn't read (nothing was written). `errors/unexpected_error`: Direct failed. ```json { "title": "Provider error", "detail": "LinkedIn answered 500.", "type": "errors/provider_error", "status": 500 } ``` ### 501 `errors/feature_not_implemented`: Direct doesn't do this (yet). A Unipile client can fall back to Unipile. ```json { "title": "Missing feature", "detail": "Lempile Direct reads LinkedIn only (see /api/v1/users and /api/v1/posts).", "type": "errors/feature_not_implemented", "status": 501 } ``` ### 503 `errors/network_down`: the account's proxy or browser server didn't answer. Nothing was sent. ```json { "title": "Network down", "detail": "The account's proxy didn't connect.", "type": "errors/network_down", "status": 503 } ``` ### 504 `errors/request_timeout`: LinkedIn didn't answer in time. On a write: an unknown outcome (it may have been sent); it's never retried and its Idempotency-Key never writes again. ```json { "title": "Unknown outcome", "detail": "LinkedIn may have received this write; it isn't tried again. Check before sending it once more.", "type": "errors/request_timeout", "status": 504 } ``` --- # Lempile Direct: List sent invitations `GET https://direct.lempile.com/api/v1/users/invite/sent` Invitations the account sent that are still waiting, newest first. ## Authentication Send your Lempile Direct API key in the `X-API-KEY` header. ## Query parameters - `account_id` (string, required): The account that reads: a Lempile LinkedIn account id (`GET /accounts` lists them). Example: `00000000-0000-4000-8000-0000000000a1`. - `limit` (integer): Items per page: 1 to 100 (default 10). Default: `10`. - `cursor` (string): A cursor a previous page gave. ## Example request ```bash curl -sS "https://direct.lempile.com/api/v1/users/invite/sent?account_id=00000000-0000-4000-8000-0000000000a1" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` ## Responses ### 200 OK ```json { "object": "InvitationList", "items": [ { "object": "InvitationSent", "id": "7300000000000000001", "invited_user": "Bob Buyer", "invited_user_id": "ACoAAAzyxwvutsrqponml", "invited_user_public_id": "bob-buyer", "invited_user_description": "Founder", "date": "2025-10-24T10:00:00.000Z", "parsed_datetime": "2025-10-24T10:00:00.000Z", "invitation_text": "Hi Bob", "specifics": { "provider": "LINKEDIN", "shared_secret": "secret-1" }, "inviter": { "inviter_name": "Ada Sender", "inviter_id": "ACoAAAbcdefghijklmnop", "inviter_public_identifier": "ada-sender", "inviter_description": "Founder" } } ], "cursor": null } ``` ### 400 A required parameter missing (`errors/missing_parameters`), or one that isn't valid (`errors/invalid_parameters`, `errors/invalid_url`, `errors/content_too_large`). ```json { "title": "Missing parameters", "detail": "account_id is required.", "type": "errors/missing_parameters", "status": 400 } ``` ### 401 `errors/missing_credentials`: the `X-API-KEY` header is missing, wrong or revoked. `errors/disconnected_account`: LinkedIn signed the account out (or asks it for a security check); reconnect it. ```json { "title": "Missing credentials", "detail": "The X-API-KEY header is missing or wrong.", "type": "errors/missing_credentials", "status": 401 } ``` ### 404 `errors/resource_not_found`: an unknown or removed account, an account of another workspace (answered exactly the same), or nothing on LinkedIn with this id. ```json { "title": "Account not found", "detail": "No account with this account_id is enabled here.", "type": "errors/resource_not_found", "status": 404 } ``` ### 429 `errors/too_many_requests`: LinkedIn asked the account to slow down (it rests 15 minutes), its daily calls or writes are used up, or it's busy with other calls. Wait `retry_after` seconds. ```json { "title": "Too many requests", "detail": "LinkedIn asked this account to slow down.", "type": "errors/too_many_requests", "status": 429, "retry_after": 900 } ``` ### 500 `errors/provider_error`: LinkedIn answered something Direct couldn't read (nothing was written). `errors/unexpected_error`: Direct failed. ```json { "title": "Provider error", "detail": "LinkedIn answered 500.", "type": "errors/provider_error", "status": 500 } ``` ### 503 `errors/network_down`: the account's proxy or browser server didn't answer. Nothing was sent. ```json { "title": "Network down", "detail": "The account's proxy didn't connect.", "type": "errors/network_down", "status": 503 } ``` ### 504 `errors/request_timeout`: LinkedIn didn't answer in time. On a write: an unknown outcome (it may have been sent); it's never retried and its Idempotency-Key never writes again. ```json { "title": "Unknown outcome", "detail": "LinkedIn may have received this write; it isn't tried again. Check before sending it once more.", "type": "errors/request_timeout", "status": 504 } ``` --- # Lempile Direct: Withdraw an invitation `DELETE https://direct.lempile.com/api/v1/users/invite/sent/{invitation_id}` Finds the invitation among the account's latest 100 sent (one read), then withdraws it. LinkedIn then blocks a new invitation to that person for about 3 weeks. ## Authentication Send your Lempile Direct API key in the `X-API-KEY` header. ## Path parameters - `invitation_id` (string, required): The invitation's id (digits), from `GET /users/invite/sent`. Example: `7300000000000000001`. ## Query parameters - `account_id` (string, required): The account that writes. - `dry_run` (boolean): `true`: answer the write's plan (`DryRun`, 200) and send nothing to LinkedIn. Default: `false`. ## Headers - `Idempotency-Key` (string): The same key (per account) never writes twice: a repeat answers the first answer for 7 days; a repeat while the first runs answers 409. ## Example request ```bash curl -sS -X DELETE "https://direct.lempile.com/api/v1/users/invite/sent/7300000000000000001?dry_run=true" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` ## Responses ### 200 Withdrawn, or with `?dry_run=true` the plan. ```json { "object": "InvitationCanceled" } ``` ### 400 A required parameter missing (`errors/missing_parameters`), or one that isn't valid (`errors/invalid_parameters`, `errors/invalid_url`, `errors/content_too_large`). ```json { "title": "Missing parameters", "detail": "account_id is required.", "type": "errors/missing_parameters", "status": 400 } ``` ### 401 `errors/missing_credentials`: the `X-API-KEY` header is missing, wrong or revoked. `errors/disconnected_account`: LinkedIn signed the account out (or asks it for a security check); reconnect it. ```json { "title": "Missing credentials", "detail": "The X-API-KEY header is missing or wrong.", "type": "errors/missing_credentials", "status": 401 } ``` ### 403 LinkedIn refused it for this account (`errors/resource_access_restricted`, `errors/action_required`), or LinkedIn restricted the account (`errors/account_restricted`: every route answers it, with no LinkedIn call, until a person clears the restriction in Lempile), or the account doesn't write through Direct (`errors/insufficient_permissions`), or it needs Sales Navigator or Recruiter (`errors/feature_not_subscribed`). ```json { "title": "Access restricted", "detail": "LinkedIn refused this read for this account.", "type": "errors/resource_access_restricted", "status": 403 } ``` ### 404 `errors/resource_not_found`: an unknown or removed account, an account of another workspace (answered exactly the same), or nothing on LinkedIn with this id. ```json { "title": "Account not found", "detail": "No account with this account_id is enabled here.", "type": "errors/resource_not_found", "status": 404 } ``` ### 409 `errors/conflict`: a write with this Idempotency-Key is still running. ```json { "title": "Write in progress", "detail": "A write with this key is still running.", "type": "errors/conflict", "status": 409 } ``` ### 422 A write LinkedIn refuses, or that the checks before it refuse: `errors/already_connected`, `errors/already_invited_recently`, `errors/cannot_invite_attendee`, `errors/invalid_recipient`, `errors/cannot_resend_yet`, `errors/limit_exceeded`, `errors/connection_limit_reached`, `errors/no_connection_with_recipient`, `errors/not_allowed_inmail`, `errors/insufficient_credits`, `errors/invalid_post`, `errors/unprocessable_entity`, `errors/invalid_parameters`, `errors/invalid_message` (a voice note over 60 seconds), `errors/action_already_performed` (a message already deleted), `errors/not_supported_by_provider`. ```json { "title": "Already connected", "detail": "This person is already a connection of the account.", "type": "errors/already_connected", "status": 422 } ``` ### 429 `errors/too_many_requests`: LinkedIn asked the account to slow down (it rests 15 minutes), its daily calls or writes are used up, or it's busy with other calls. Wait `retry_after` seconds. ```json { "title": "Too many requests", "detail": "LinkedIn asked this account to slow down.", "type": "errors/too_many_requests", "status": 429, "retry_after": 900 } ``` ### 500 `errors/provider_error`: LinkedIn answered something Direct couldn't read (nothing was written). `errors/unexpected_error`: Direct failed. ```json { "title": "Provider error", "detail": "LinkedIn answered 500.", "type": "errors/provider_error", "status": 500 } ``` ### 501 `errors/feature_not_implemented`: Direct doesn't do this (yet). A Unipile client can fall back to Unipile. ```json { "title": "Missing feature", "detail": "Lempile Direct reads LinkedIn only (see /api/v1/users and /api/v1/posts).", "type": "errors/feature_not_implemented", "status": 501 } ``` ### 503 `errors/network_down`: the account's proxy or browser server didn't answer. Nothing was sent. ```json { "title": "Network down", "detail": "The account's proxy didn't connect.", "type": "errors/network_down", "status": 503 } ``` ### 504 `errors/request_timeout`: LinkedIn didn't answer in time. On a write: an unknown outcome (it may have been sent); it's never retried and its Idempotency-Key never writes again. ```json { "title": "Unknown outcome", "detail": "LinkedIn may have received this write; it isn't tried again. Check before sending it once more.", "type": "errors/request_timeout", "status": 504 } ``` --- # Lempile Direct: List relations `GET https://direct.lempile.com/api/v1/users/relations` The account's connections, newest first (100 a LinkedIn call). ## Authentication Send your Lempile Direct API key in the `X-API-KEY` header. ## Query parameters - `account_id` (string, required): The account that reads: a Lempile LinkedIn account id (`GET /accounts` lists them). Example: `00000000-0000-4000-8000-0000000000a1`. - `limit` (integer): Items per page: 1 to 1000 (default 100). Default: `100`. - `cursor` (string): A cursor a previous page gave. - `filter` (string): Answers 501: filtering by name isn't done yet. ## Example request ```bash curl -sS "https://direct.lempile.com/api/v1/users/relations?account_id=00000000-0000-4000-8000-0000000000a1" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` ## Responses ### 200 OK ```json { "object": "UserRelationsList", "items": [ { "object": "UserRelation", "first_name": "First0", "last_name": "Last0", "headline": "Sales", "public_identifier": "person-0", "public_profile_url": "https://www.linkedin.com/in/person-0/", "created_at": 1761000000000, "member_id": "ACoAAAmember0000000000", "member_urn": "urn:li:fsd_profile:ACoAAAmember0000000000", "connection_urn": "urn:li:fsd_connection:ACoAAAmember0000000000", "profile_picture_url": "https://media.licdn.com/dms/image/x/400.jpg" }, { "object": "UserRelation", "first_name": "First1", "last_name": "Last1", "headline": "Sales", "public_identifier": "person-1", "public_profile_url": "https://www.linkedin.com/in/person-1/", "created_at": 1761000000001, "member_id": "ACoAAAmember0000000001", "member_urn": "urn:li:fsd_profile:ACoAAAmember0000000001", "connection_urn": "urn:li:fsd_connection:ACoAAAmember0000000001", "profile_picture_url": "https://media.licdn.com/dms/image/x/400.jpg" } ], "cursor": null } ``` ### 400 A required parameter missing (`errors/missing_parameters`), or one that isn't valid (`errors/invalid_parameters`, `errors/invalid_url`, `errors/content_too_large`). ```json { "title": "Missing parameters", "detail": "account_id is required.", "type": "errors/missing_parameters", "status": 400 } ``` ### 401 `errors/missing_credentials`: the `X-API-KEY` header is missing, wrong or revoked. `errors/disconnected_account`: LinkedIn signed the account out (or asks it for a security check); reconnect it. ```json { "title": "Missing credentials", "detail": "The X-API-KEY header is missing or wrong.", "type": "errors/missing_credentials", "status": 401 } ``` ### 404 `errors/resource_not_found`: an unknown or removed account, an account of another workspace (answered exactly the same), or nothing on LinkedIn with this id. ```json { "title": "Account not found", "detail": "No account with this account_id is enabled here.", "type": "errors/resource_not_found", "status": 404 } ``` ### 429 `errors/too_many_requests`: LinkedIn asked the account to slow down (it rests 15 minutes), its daily calls or writes are used up, or it's busy with other calls. Wait `retry_after` seconds. ```json { "title": "Too many requests", "detail": "LinkedIn asked this account to slow down.", "type": "errors/too_many_requests", "status": 429, "retry_after": 900 } ``` ### 500 `errors/provider_error`: LinkedIn answered something Direct couldn't read (nothing was written). `errors/unexpected_error`: Direct failed. ```json { "title": "Provider error", "detail": "LinkedIn answered 500.", "type": "errors/provider_error", "status": 500 } ``` ### 501 `errors/feature_not_implemented`: Direct doesn't do this (yet). A Unipile client can fall back to Unipile. ```json { "title": "Missing feature", "detail": "Lempile Direct reads LinkedIn only (see /api/v1/users and /api/v1/posts).", "type": "errors/feature_not_implemented", "status": 501 } ``` ### 503 `errors/network_down`: the account's proxy or browser server didn't answer. Nothing was sent. ```json { "title": "Network down", "detail": "The account's proxy didn't connect.", "type": "errors/network_down", "status": 503 } ``` ### 504 `errors/request_timeout`: LinkedIn didn't answer in time. On a write: an unknown outcome (it may have been sent); it's never retried and its Idempotency-Key never writes again. ```json { "title": "Unknown outcome", "detail": "LinkedIn may have received this write; it isn't tried again. Check before sending it once more.", "type": "errors/request_timeout", "status": 504 } ``` --- # Lempile Direct: List received invitations `GET https://direct.lempile.com/api/v1/users/invite/received` Invitations the account received that wait for its answer, newest first, each with the `shared_secret` accepting or declining it takes. ## Authentication Send your Lempile Direct API key in the `X-API-KEY` header. ## Query parameters - `account_id` (string, required): The account that reads: a Lempile LinkedIn account id (`GET /accounts` lists them). Example: `00000000-0000-4000-8000-0000000000a1`. - `limit` (integer): Items per page: 1 to 100 (default 10). Default: `10`. - `cursor` (string): A cursor a previous page gave. ## Example request ```bash curl -sS "https://direct.lempile.com/api/v1/users/invite/received?account_id=00000000-0000-4000-8000-0000000000a1" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` ## Responses ### 200 OK ```json { "object": "InvitationList", "items": [ { "object": "InvitationReceived", "id": "7400000000000000000", "invited_user": "Ada Sender", "invited_user_id": "ACoAAAbcdefghijklmnop", "invited_user_public_id": "ada-sender", "invited_user_description": "Founder", "date": "2025-10-24T10:00:00.000Z", "parsed_datetime": "2025-10-24T10:00:00.000Z", "invitation_text": "Hi Ada, let's connect", "inviter": { "inviter_name": "Bob Buyer", "inviter_id": "ACoAAAzyxwvutsrqponml", "inviter_public_identifier": "bob-buyer", "inviter_description": "CTO" }, "specifics": { "provider": "LINKEDIN", "shared_secret": "s3cret0" } } ], "cursor": null } ``` ### 400 A required parameter missing (`errors/missing_parameters`), or one that isn't valid (`errors/invalid_parameters`, `errors/invalid_url`, `errors/content_too_large`). ```json { "title": "Missing parameters", "detail": "account_id is required.", "type": "errors/missing_parameters", "status": 400 } ``` ### 401 `errors/missing_credentials`: the `X-API-KEY` header is missing, wrong or revoked. `errors/disconnected_account`: LinkedIn signed the account out (or asks it for a security check); reconnect it. ```json { "title": "Missing credentials", "detail": "The X-API-KEY header is missing or wrong.", "type": "errors/missing_credentials", "status": 401 } ``` ### 403 LinkedIn refused it for this account (`errors/resource_access_restricted`, `errors/action_required`), or LinkedIn restricted the account (`errors/account_restricted`: every route answers it, with no LinkedIn call, until a person clears the restriction in Lempile), or the account doesn't write through Direct (`errors/insufficient_permissions`), or it needs Sales Navigator or Recruiter (`errors/feature_not_subscribed`). ```json { "title": "Access restricted", "detail": "LinkedIn refused this read for this account.", "type": "errors/resource_access_restricted", "status": 403 } ``` ### 404 `errors/resource_not_found`: an unknown or removed account, an account of another workspace (answered exactly the same), or nothing on LinkedIn with this id. ```json { "title": "Account not found", "detail": "No account with this account_id is enabled here.", "type": "errors/resource_not_found", "status": 404 } ``` ### 429 `errors/too_many_requests`: LinkedIn asked the account to slow down (it rests 15 minutes), its daily calls or writes are used up, or it's busy with other calls. Wait `retry_after` seconds. ```json { "title": "Too many requests", "detail": "LinkedIn asked this account to slow down.", "type": "errors/too_many_requests", "status": 429, "retry_after": 900 } ``` ### 500 `errors/provider_error`: LinkedIn answered something Direct couldn't read (nothing was written). `errors/unexpected_error`: Direct failed. ```json { "title": "Provider error", "detail": "LinkedIn answered 500.", "type": "errors/provider_error", "status": 500 } ``` ### 501 `errors/feature_not_implemented`: Direct doesn't do this (yet). A Unipile client can fall back to Unipile. ```json { "title": "Missing feature", "detail": "Lempile Direct reads LinkedIn only (see /api/v1/users and /api/v1/posts).", "type": "errors/feature_not_implemented", "status": 501 } ``` ### 503 `errors/network_down`: the account's proxy or browser server didn't answer. Nothing was sent. ```json { "title": "Network down", "detail": "The account's proxy didn't connect.", "type": "errors/network_down", "status": 503 } ``` ### 504 `errors/request_timeout`: LinkedIn didn't answer in time. On a write: an unknown outcome (it may have been sent); it's never retried and its Idempotency-Key never writes again. ```json { "title": "Unknown outcome", "detail": "LinkedIn may have received this write; it isn't tried again. Check before sending it once more.", "type": "errors/request_timeout", "status": 504 } ``` --- # Lempile Direct: Accept or decline a received invitation `POST https://direct.lempile.com/api/v1/users/invite/received/{invitation_id}` Accepts the invitation, or declines it (LinkedIn's Ignore). Reads the account's latest 100 received invitations first: an unknown id answers 404, a wrong `shared_secret` 400, and an invitation that isn't an invitation to connect (its `specifics.invitation_type` isn't `CONNECTION`: a newsletter, page or event invitation) 422 `errors/unprocessable_entity`, with nothing sent to LinkedIn. ## Authentication Send your Lempile Direct API key in the `X-API-KEY` header. ## Path parameters - `invitation_id` (string, required): The invitation's id (digits). ## Query parameters - `account_id` (string): The account that writes, when the body doesn't name it. - `dry_run` (boolean): `true`: answer the write's plan (`DryRun`, 200) and send nothing to LinkedIn. Default: `false`. ## Headers - `Idempotency-Key` (string): The same key (per account) never writes twice: a repeat answers the first answer for 7 days; a repeat while the first runs answers 409. ## Request body `application/json` (required) - `provider` (string) - `account_id` (string, required) - `action` (string, required): `decline` is LinkedIn's Ignore. One of: `accept`, `decline`. - `shared_secret` (string, required): The invitation's `specifics.shared_secret` from `GET /users/invite/received`. ## Example request ```bash curl -sS -X POST "https://direct.lempile.com/api/v1/users/invite/received/{invitation_id}?dry_run=true" \ -H "X-API-KEY: $DIRECT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "provider": "LINKEDIN", "account_id": "00000000-0000-4000-8000-0000000000a1", "action": "accept", "shared_secret": "s3cret0" }' ``` ## Responses ### 200 Handled, or with `?dry_run=true` the plan. ```json { "object": "UserInvitationHandled", "status": "ACCEPTED" } ``` ### 400 A required parameter missing (`errors/missing_parameters`), or one that isn't valid (`errors/invalid_parameters`, `errors/invalid_url`, `errors/content_too_large`). ```json { "title": "Missing parameters", "detail": "account_id is required.", "type": "errors/missing_parameters", "status": 400 } ``` ### 401 `errors/missing_credentials`: the `X-API-KEY` header is missing, wrong or revoked. `errors/disconnected_account`: LinkedIn signed the account out (or asks it for a security check); reconnect it. ```json { "title": "Missing credentials", "detail": "The X-API-KEY header is missing or wrong.", "type": "errors/missing_credentials", "status": 401 } ``` ### 403 LinkedIn refused it for this account (`errors/resource_access_restricted`, `errors/action_required`), or LinkedIn restricted the account (`errors/account_restricted`: every route answers it, with no LinkedIn call, until a person clears the restriction in Lempile), or the account doesn't write through Direct (`errors/insufficient_permissions`), or it needs Sales Navigator or Recruiter (`errors/feature_not_subscribed`). ```json { "title": "Access restricted", "detail": "LinkedIn refused this read for this account.", "type": "errors/resource_access_restricted", "status": 403 } ``` ### 404 `errors/resource_not_found`: an unknown or removed account, an account of another workspace (answered exactly the same), or nothing on LinkedIn with this id. ```json { "title": "Account not found", "detail": "No account with this account_id is enabled here.", "type": "errors/resource_not_found", "status": 404 } ``` ### 409 `errors/conflict`: a write with this Idempotency-Key is still running. ```json { "title": "Write in progress", "detail": "A write with this key is still running.", "type": "errors/conflict", "status": 409 } ``` ### 422 A write LinkedIn refuses, or that the checks before it refuse: `errors/already_connected`, `errors/already_invited_recently`, `errors/cannot_invite_attendee`, `errors/invalid_recipient`, `errors/cannot_resend_yet`, `errors/limit_exceeded`, `errors/connection_limit_reached`, `errors/no_connection_with_recipient`, `errors/not_allowed_inmail`, `errors/insufficient_credits`, `errors/invalid_post`, `errors/unprocessable_entity`, `errors/invalid_parameters`, `errors/invalid_message` (a voice note over 60 seconds), `errors/action_already_performed` (a message already deleted), `errors/not_supported_by_provider`. ```json { "title": "Already connected", "detail": "This person is already a connection of the account.", "type": "errors/already_connected", "status": 422 } ``` ### 429 `errors/too_many_requests`: LinkedIn asked the account to slow down (it rests 15 minutes), its daily calls or writes are used up, or it's busy with other calls. Wait `retry_after` seconds. ```json { "title": "Too many requests", "detail": "LinkedIn asked this account to slow down.", "type": "errors/too_many_requests", "status": 429, "retry_after": 900 } ``` ### 500 `errors/provider_error`: LinkedIn answered something Direct couldn't read (nothing was written). `errors/unexpected_error`: Direct failed. ```json { "title": "Provider error", "detail": "LinkedIn answered 500.", "type": "errors/provider_error", "status": 500 } ``` ### 501 `errors/feature_not_implemented`: Direct doesn't do this (yet). A Unipile client can fall back to Unipile. ```json { "title": "Missing feature", "detail": "Lempile Direct reads LinkedIn only (see /api/v1/users and /api/v1/posts).", "type": "errors/feature_not_implemented", "status": 501 } ``` ### 503 `errors/network_down`: the account's proxy or browser server didn't answer. Nothing was sent. ```json { "title": "Network down", "detail": "The account's proxy didn't connect.", "type": "errors/network_down", "status": 503 } ``` ### 504 `errors/request_timeout`: LinkedIn didn't answer in time. On a write: an unknown outcome (it may have been sent); it's never retried and its Idempotency-Key never writes again. ```json { "title": "Unknown outcome", "detail": "LinkedIn may have received this write; it isn't tried again. Check before sending it once more.", "type": "errors/request_timeout", "status": 504 } ``` --- # Lempile Direct: List all attendees `GET https://direct.lempile.com/api/v1/chat_attendees` Everyone the account has a conversation with, newest conversation first. With `chat_id`: that chat's attendees. ## Authentication Send your Lempile Direct API key in the `X-API-KEY` header. ## Query parameters - `account_id` (string, required): The account that reads: a Lempile LinkedIn account id (`GET /accounts` lists them). Example: `00000000-0000-4000-8000-0000000000a1`. - `limit` (integer): Items per page: 1 to 250 (default 100). Default: `100`. - `cursor` (string): A cursor a previous page gave. - `chat_id` (string): Only this chat's attendees. ## Example request ```bash curl -sS "https://direct.lempile.com/api/v1/chat_attendees?account_id=00000000-0000-4000-8000-0000000000a1" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` ## Responses ### 200 OK ```json { "object": "ChatAttendeeList", "items": [ { "object": "ChatAttendee", "id": "ACoAAAperson0000xyz", "account_id": "00000000-0000-4000-8000-0000000000a1", "provider_id": "ACoAAAperson0000xyz", "name": "P0 Person", "is_self": 0, "hidden": 0, "specifics": { "provider": "LINKEDIN", "member_urn": "urn:li:member:930446784", "occupation": "Founder", "headline": "Founder", "network_distance": "DISTANCE_2" }, "picture_url": "https://media.licdn.com/dms/image/x/400.jpg", "profile_url": "https://www.linkedin.com/in/ACoAAAperson0000xyz" }, { "object": "ChatAttendee", "id": "ACoAAAperson0001xyz", "account_id": "00000000-0000-4000-8000-0000000000a1", "provider_id": "ACoAAAperson0001xyz", "name": "P1 Person", "is_self": 0, "hidden": 0, "specifics": { "provider": "LINKEDIN", "member_urn": "urn:li:member:199989907", "occupation": "Founder", "headline": "Founder", "network_distance": "DISTANCE_2" }, "picture_url": "https://media.licdn.com/dms/image/x/400.jpg", "profile_url": "https://www.linkedin.com/in/ACoAAAperson0001xyz" } ], "cursor": "eyJrIjoiYXR0ZW5kZWVzIiwiYiI6MTc2MTI5OTg4MDAwMCwieCI6WyIyLSsvOTBhSEpsWVdRd01EQXlJUT09Il19" } ``` ### 400 A required parameter missing (`errors/missing_parameters`), or one that isn't valid (`errors/invalid_parameters`, `errors/invalid_url`, `errors/content_too_large`). ```json { "title": "Missing parameters", "detail": "account_id is required.", "type": "errors/missing_parameters", "status": 400 } ``` ### 401 `errors/missing_credentials`: the `X-API-KEY` header is missing, wrong or revoked. `errors/disconnected_account`: LinkedIn signed the account out (or asks it for a security check); reconnect it. ```json { "title": "Missing credentials", "detail": "The X-API-KEY header is missing or wrong.", "type": "errors/missing_credentials", "status": 401 } ``` ### 404 `errors/resource_not_found`: an unknown or removed account, an account of another workspace (answered exactly the same), or nothing on LinkedIn with this id. ```json { "title": "Account not found", "detail": "No account with this account_id is enabled here.", "type": "errors/resource_not_found", "status": 404 } ``` ### 429 `errors/too_many_requests`: LinkedIn asked the account to slow down (it rests 15 minutes), its daily calls or writes are used up, or it's busy with other calls. Wait `retry_after` seconds. ```json { "title": "Too many requests", "detail": "LinkedIn asked this account to slow down.", "type": "errors/too_many_requests", "status": 429, "retry_after": 900 } ``` ### 500 `errors/provider_error`: LinkedIn answered something Direct couldn't read (nothing was written). `errors/unexpected_error`: Direct failed. ```json { "title": "Provider error", "detail": "LinkedIn answered 500.", "type": "errors/provider_error", "status": 500 } ``` ### 503 `errors/network_down`: the account's proxy or browser server didn't answer. Nothing was sent. ```json { "title": "Network down", "detail": "The account's proxy didn't connect.", "type": "errors/network_down", "status": 503 } ``` ### 504 `errors/request_timeout`: LinkedIn didn't answer in time. On a write: an unknown outcome (it may have been sent); it's never retried and its Idempotency-Key never writes again. ```json { "title": "Unknown outcome", "detail": "LinkedIn may have received this write; it isn't tried again. Check before sending it once more.", "type": "errors/request_timeout", "status": 504 } ``` --- # Lempile Direct: List chats `GET https://direct.lempile.com/api/v1/chats` The account's conversations, newest activity first: the inbox and the archive (not spam). The newest 20 come from LinkedIn's inbox sync (kept a minute), or, when it holds a conversation in no box, from the newest page of the inbox and of the archive (kept a minute too); further pages, `before`, `after`, `unread` or a `limit` over 20 walk the inbox and the archive by last activity (25 a LinkedIn call). ## Authentication Send your Lempile Direct API key in the `X-API-KEY` header. ## Query parameters - `account_id` (string, required): The account that reads: a Lempile LinkedIn account id (`GET /accounts` lists them). Example: `00000000-0000-4000-8000-0000000000a1`. - `limit` (integer): Items per page: 1 to 250 (default 10). Default: `10`. - `cursor` (string): A cursor a previous page gave. - `unread` (boolean): Only chats with unread messages. Default: `false`. - `before` (string): Only chats last active before this time (ISO 8601 UTC). - `after` (string): Only chats last active after this time (ISO 8601 UTC). - `account_type` (string): Anything but `LINKEDIN` answers 400. One of: `LINKEDIN`. ## Example request ```bash curl -sS "https://direct.lempile.com/api/v1/chats?account_id=00000000-0000-4000-8000-0000000000a1" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` ## Responses ### 200 OK ```json { "object": "ChatList", "items": [ { "object": "Chat", "id": "2--_90aHJlYWQwMDAwIQ", "account_id": "00000000-0000-4000-8000-0000000000a1", "account_type": "LINKEDIN", "provider_id": "2--_90aHJlYWQwMDAwIQ", "name": null, "type": 0, "timestamp": "2025-10-24T10:00:00.000Z", "unread_count": 1, "archived": 0, "muted_until": null, "read_only": 0, "folder": [ "INBOX", "INBOX_LINKEDIN_CLASSIC" ], "pinned": 0, "attendee_provider_id": "ACoAAAperson0000xyz" }, { "object": "Chat", "id": "2--_90aHJlYWQwMDAxIQ", "account_id": "00000000-0000-4000-8000-0000000000a1", "account_type": "LINKEDIN", "provider_id": "2--_90aHJlYWQwMDAxIQ", "name": null, "type": 0, "timestamp": "2025-10-24T09:59:00.000Z", "unread_count": 0, "archived": 0, "muted_until": null, "read_only": 0, "folder": [ "INBOX", "INBOX_LINKEDIN_CLASSIC" ], "pinned": 0, "attendee_provider_id": "ACoAAAperson0001xyz" } ], "cursor": "eyJrIjoiY2hhdHMiLCJiIjoxNzYxMjk5ODgwMDAwLCJ4IjpbIjItKy85MGFISmxZV1F3TURBeUlRPT0iXX0" } ``` ### 400 A required parameter missing (`errors/missing_parameters`), or one that isn't valid (`errors/invalid_parameters`, `errors/invalid_url`, `errors/content_too_large`). ```json { "title": "Missing parameters", "detail": "account_id is required.", "type": "errors/missing_parameters", "status": 400 } ``` ### 401 `errors/missing_credentials`: the `X-API-KEY` header is missing, wrong or revoked. `errors/disconnected_account`: LinkedIn signed the account out (or asks it for a security check); reconnect it. ```json { "title": "Missing credentials", "detail": "The X-API-KEY header is missing or wrong.", "type": "errors/missing_credentials", "status": 401 } ``` ### 404 `errors/resource_not_found`: an unknown or removed account, an account of another workspace (answered exactly the same), or nothing on LinkedIn with this id. ```json { "title": "Account not found", "detail": "No account with this account_id is enabled here.", "type": "errors/resource_not_found", "status": 404 } ``` ### 429 `errors/too_many_requests`: LinkedIn asked the account to slow down (it rests 15 minutes), its daily calls or writes are used up, or it's busy with other calls. Wait `retry_after` seconds. ```json { "title": "Too many requests", "detail": "LinkedIn asked this account to slow down.", "type": "errors/too_many_requests", "status": 429, "retry_after": 900 } ``` ### 500 `errors/provider_error`: LinkedIn answered something Direct couldn't read (nothing was written). `errors/unexpected_error`: Direct failed. ```json { "title": "Provider error", "detail": "LinkedIn answered 500.", "type": "errors/provider_error", "status": 500 } ``` ### 503 `errors/network_down`: the account's proxy or browser server didn't answer. Nothing was sent. ```json { "title": "Network down", "detail": "The account's proxy didn't connect.", "type": "errors/network_down", "status": 503 } ``` ### 504 `errors/request_timeout`: LinkedIn didn't answer in time. On a write: an unknown outcome (it may have been sent); it's never retried and its Idempotency-Key never writes again. ```json { "title": "Unknown outcome", "detail": "LinkedIn may have received this write; it isn't tried again. Check before sending it once more.", "type": "errors/request_timeout", "status": 504 } ``` --- # Lempile Direct: Start a chat `POST https://direct.lempile.com/api/v1/chats` A first message to one person. Reads the profile's "Message" option first: someone the account can't message for free answers 422 `errors/no_connection_with_recipient` (with `linkedin[inmail]=true`: an InMail, or `errors/not_allowed_inmail` / `errors/insufficient_credits`). A voice note (`voice_message`) starts the chat the same way; never as an InMail (501). ## Authentication Send your Lempile Direct API key in the `X-API-KEY` header. ## Query parameters - `account_id` (string): The account that writes, when the body doesn't name it. - `dry_run` (boolean): `true`: answer the write's plan (`DryRun`, 200) and send nothing to LinkedIn. Default: `false`. ## Headers - `Idempotency-Key` (string): The same key (per account) never writes twice: a repeat answers the first answer for 7 days; a repeat while the first runs answers 409. ## Request body `application/json` (required) - `account_id` (string, required): The account that writes (or `?account_id=`). Required. - `attendees_ids` (array of string, required): One person: their provider id, public identifier or profile URL. Several (a group) answers 501. In a form: `attendees_ids[0]`. - `text` (string): 8,000 characters at most. Required unless a file or a voice note is sent. - `subject` (string): An InMail's subject (200 characters at most). - `linkedin` (object): In a form: `linkedin[api]`, `linkedin[inmail]`. `topic`, `applicant_id`, `invitation_id` and `group_id` answer 501. - `api` (string): Only `classic`; `recruiter` or `sales_navigator` answers 501. One of: `classic`. - `inmail` (boolean): Send an InMail when the person isn't reachable by a free message. - `attachments` (array of string (binary)): Files, 20 MB each at most (multipart: `attachments`, `attachments[]` or `attachments[0]`…). - `video_message` (string (binary)): A video, sent as a file. - `voice_message` (string (binary)): A voice note (multipart): sent alone (no `text` or files with it), as LinkedIn's apps send one. Any audio (m4a/AAC as Looply records it, mp3, ogg, webm/opus, wav, aac, flac; 20 MB at most) is turned into LinkedIn's AAC .m4a on the server; 60 seconds at most (422 `errors/invalid_message` over it, 415 `errors/unsupported_media_type` when it isn't audio). `multipart/form-data` (required) - `account_id` (string, required): The account that writes (or `?account_id=`). Required. - `attendees_ids` (array of string, required): One person: their provider id, public identifier or profile URL. Several (a group) answers 501. In a form: `attendees_ids[0]`. - `text` (string): 8,000 characters at most. Required unless a file or a voice note is sent. - `subject` (string): An InMail's subject (200 characters at most). - `linkedin` (object): In a form: `linkedin[api]`, `linkedin[inmail]`. `topic`, `applicant_id`, `invitation_id` and `group_id` answer 501. - `api` (string): Only `classic`; `recruiter` or `sales_navigator` answers 501. One of: `classic`. - `inmail` (boolean): Send an InMail when the person isn't reachable by a free message. - `attachments` (array of string (binary)): Files, 20 MB each at most (multipart: `attachments`, `attachments[]` or `attachments[0]`…). - `video_message` (string (binary)): A video, sent as a file. - `voice_message` (string (binary)): A voice note (multipart): sent alone (no `text` or files with it), as LinkedIn's apps send one. Any audio (m4a/AAC as Looply records it, mp3, ogg, webm/opus, wav, aac, flac; 20 MB at most) is turned into LinkedIn's AAC .m4a on the server; 60 seconds at most (422 `errors/invalid_message` over it, 415 `errors/unsupported_media_type` when it isn't audio). ## Example request ```bash curl -sS -X POST "https://direct.lempile.com/api/v1/chats?dry_run=true" \ -H "X-API-KEY: $DIRECT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "account_id": "00000000-0000-4000-8000-0000000000a1", "attendees_ids": [ "ACoAAAzyxwvutsrqponml" ], "text": "Hi Bob, quick question about your post." }' ``` ## Responses ### 200 With `?dry_run=true`: the write's plan. Nothing is sent. ```json { "object": "DryRun", "route": "string", "method": "string", "path": "string", "body": {}, "status": 0, "uploads": [ { "method": "string", "path": "string", "body": {}, "then": "string", "content_type": "string", "file": {} } ], "multiphoto": { "method": "string", "path": "string", "body": {} }, "checked": [ "string" ] } ``` ### 201 Created ```json { "object": "ChatStarted", "chat_id": "2-QUFBQXRocmVhZPv_b25lMQ", "message_id": "2-_vptc2cwMTMxIQ", "id": "2-QUFBQXRocmVhZPv_b25lMQ" } ``` ### 400 A required parameter missing (`errors/missing_parameters`), or one that isn't valid (`errors/invalid_parameters`, `errors/invalid_url`, `errors/content_too_large`). ```json { "title": "Missing parameters", "detail": "account_id is required.", "type": "errors/missing_parameters", "status": 400 } ``` ### 401 `errors/missing_credentials`: the `X-API-KEY` header is missing, wrong or revoked. `errors/disconnected_account`: LinkedIn signed the account out (or asks it for a security check); reconnect it. ```json { "title": "Missing credentials", "detail": "The X-API-KEY header is missing or wrong.", "type": "errors/missing_credentials", "status": 401 } ``` ### 403 LinkedIn refused it for this account (`errors/resource_access_restricted`, `errors/action_required`), or LinkedIn restricted the account (`errors/account_restricted`: every route answers it, with no LinkedIn call, until a person clears the restriction in Lempile), or the account doesn't write through Direct (`errors/insufficient_permissions`), or it needs Sales Navigator or Recruiter (`errors/feature_not_subscribed`). ```json { "title": "Access restricted", "detail": "LinkedIn refused this read for this account.", "type": "errors/resource_access_restricted", "status": 403 } ``` ### 404 `errors/resource_not_found`: an unknown or removed account, an account of another workspace (answered exactly the same), or nothing on LinkedIn with this id. ```json { "title": "Account not found", "detail": "No account with this account_id is enabled here.", "type": "errors/resource_not_found", "status": 404 } ``` ### 409 `errors/conflict`: a write with this Idempotency-Key is still running. ```json { "title": "Write in progress", "detail": "A write with this key is still running.", "type": "errors/conflict", "status": 409 } ``` ### 415 `errors/unsupported_media_type`: a voice note that isn't audio Direct can turn into LinkedIn's format (AAC .m4a). Nothing was sent. ```json { "title": "Unsupported media type", "detail": "This voice note isn't an audio file LinkedIn can take (m4a, mp3, ogg, webm, wav, aac or flac).", "type": "errors/unsupported_media_type", "status": 415 } ``` ### 422 A write LinkedIn refuses, or that the checks before it refuse: `errors/already_connected`, `errors/already_invited_recently`, `errors/cannot_invite_attendee`, `errors/invalid_recipient`, `errors/cannot_resend_yet`, `errors/limit_exceeded`, `errors/connection_limit_reached`, `errors/no_connection_with_recipient`, `errors/not_allowed_inmail`, `errors/insufficient_credits`, `errors/invalid_post`, `errors/unprocessable_entity`, `errors/invalid_parameters`, `errors/invalid_message` (a voice note over 60 seconds), `errors/action_already_performed` (a message already deleted), `errors/not_supported_by_provider`. ```json { "title": "Already connected", "detail": "This person is already a connection of the account.", "type": "errors/already_connected", "status": 422 } ``` ### 429 `errors/too_many_requests`: LinkedIn asked the account to slow down (it rests 15 minutes), its daily calls or writes are used up, or it's busy with other calls. Wait `retry_after` seconds. ```json { "title": "Too many requests", "detail": "LinkedIn asked this account to slow down.", "type": "errors/too_many_requests", "status": 429, "retry_after": 900 } ``` ### 500 `errors/provider_error`: LinkedIn answered something Direct couldn't read (nothing was written). `errors/unexpected_error`: Direct failed. ```json { "title": "Provider error", "detail": "LinkedIn answered 500.", "type": "errors/provider_error", "status": 500 } ``` ### 501 `errors/feature_not_implemented`: Direct doesn't do this (yet). A Unipile client can fall back to Unipile. ```json { "title": "Missing feature", "detail": "Lempile Direct reads LinkedIn only (see /api/v1/users and /api/v1/posts).", "type": "errors/feature_not_implemented", "status": 501 } ``` ### 503 `errors/network_down`: the account's proxy or browser server didn't answer. Nothing was sent. ```json { "title": "Network down", "detail": "The account's proxy didn't connect.", "type": "errors/network_down", "status": 503 } ``` ### 504 `errors/request_timeout`: LinkedIn didn't answer in time. On a write: an unknown outcome (it may have been sent); it's never retried and its Idempotency-Key never writes again. ```json { "title": "Unknown outcome", "detail": "LinkedIn may have received this write; it isn't tried again. Check before sending it once more.", "type": "errors/request_timeout", "status": 504 } ``` --- # Lempile Direct: Retrieve a chat `GET https://direct.lempile.com/api/v1/chats/{chat_id}` One conversation with its `lastMessage`: from the newest conversations, else LinkedIn's conversation by its id. ## Authentication Send your Lempile Direct API key in the `X-API-KEY` header. ## Path parameters - `chat_id` (string, required): The chat's id as Direct answers it (LinkedIn's own `2-…` form, URL-encoded, works too). Example: `2--_90aHJlYWQwMDAwIQ`. ## Query parameters - `account_id` (string, required): The account that reads: a Lempile LinkedIn account id (`GET /accounts` lists them). Example: `00000000-0000-4000-8000-0000000000a1`. ## Example request ```bash curl -sS "https://direct.lempile.com/api/v1/chats/2--_90aHJlYWQwMDAwIQ?account_id=00000000-0000-4000-8000-0000000000a1" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` ## Responses ### 200 OK ```json { "object": "Chat", "id": "2--_90aHJlYWQwMDAwIQ", "account_id": "00000000-0000-4000-8000-0000000000a1", "account_type": "LINKEDIN", "provider_id": "2--_90aHJlYWQwMDAwIQ", "name": null, "type": 0, "timestamp": "2025-10-24T10:00:00.000Z", "unread_count": 1, "archived": 0, "muted_until": null, "read_only": 0, "folder": [ "INBOX", "INBOX_LINKEDIN_CLASSIC" ], "pinned": 0, "attendee_provider_id": "ACoAAAperson0000xyz", "lastMessage": { "object": "Message", "id": "2-_vptc2cwMTI5IQ", "provider_id": "2-_vptc2cwMTI5IQ", "account_id": "00000000-0000-4000-8000-0000000000a1", "chat_id": "2--_90aHJlYWQwMDAwIQ", "chat_provider_id": "2--_90aHJlYWQwMDAwIQ", "sender_id": "ACoAAAbcdefghijklmnop", "sender_attendee_id": "ACoAAAbcdefghijklmnop", "sender_urn": "urn:li:fsd_profile:ACoAAAbcdefghijklmnop", "text": "message 129", "attachments": [], "timestamp": "2025-10-24T09:59:59.000Z", "is_sender": 1, "reactions": [], "seen": 0, "seen_by": {}, "hidden": 0, "deleted": 0, "edited": 0, "is_event": 0, "delivered": 1, "behavior": null, "original": "", "message_type": "MESSAGE", "attendee_type": "MEMBER" } } ``` ### 400 A required parameter missing (`errors/missing_parameters`), or one that isn't valid (`errors/invalid_parameters`, `errors/invalid_url`, `errors/content_too_large`). ```json { "title": "Missing parameters", "detail": "account_id is required.", "type": "errors/missing_parameters", "status": 400 } ``` ### 401 `errors/missing_credentials`: the `X-API-KEY` header is missing, wrong or revoked. `errors/disconnected_account`: LinkedIn signed the account out (or asks it for a security check); reconnect it. ```json { "title": "Missing credentials", "detail": "The X-API-KEY header is missing or wrong.", "type": "errors/missing_credentials", "status": 401 } ``` ### 404 `errors/resource_not_found`: an unknown or removed account, an account of another workspace (answered exactly the same), or nothing on LinkedIn with this id. ```json { "title": "Account not found", "detail": "No account with this account_id is enabled here.", "type": "errors/resource_not_found", "status": 404 } ``` ### 429 `errors/too_many_requests`: LinkedIn asked the account to slow down (it rests 15 minutes), its daily calls or writes are used up, or it's busy with other calls. Wait `retry_after` seconds. ```json { "title": "Too many requests", "detail": "LinkedIn asked this account to slow down.", "type": "errors/too_many_requests", "status": 429, "retry_after": 900 } ``` ### 500 `errors/provider_error`: LinkedIn answered something Direct couldn't read (nothing was written). `errors/unexpected_error`: Direct failed. ```json { "title": "Provider error", "detail": "LinkedIn answered 500.", "type": "errors/provider_error", "status": 500 } ``` ### 503 `errors/network_down`: the account's proxy or browser server didn't answer. Nothing was sent. ```json { "title": "Network down", "detail": "The account's proxy didn't connect.", "type": "errors/network_down", "status": 503 } ``` ### 504 `errors/request_timeout`: LinkedIn didn't answer in time. On a write: an unknown outcome (it may have been sent); it's never retried and its Idempotency-Key never writes again. ```json { "title": "Unknown outcome", "detail": "LinkedIn may have received this write; it isn't tried again. Check before sending it once more.", "type": "errors/request_timeout", "status": 504 } ``` --- # Lempile Direct: Mark a chat read or unread, mute it `PATCH https://direct.lempile.com/api/v1/chats/{chat_id}` `setReadStatus` (`value: true` marks it read) or `setMuteStatus`. The chat is read first (unknown answers 404). Unipile's WhatsApp and Telegram actions answer 422 `errors/not_supported_by_provider`. ## Authentication Send your Lempile Direct API key in the `X-API-KEY` header. ## Path parameters - `chat_id` (string, required): LinkedIn's thread id (`2-…`, as Direct answers it). ## Query parameters - `account_id` (string): The account that writes, when the body doesn't name it. - `dry_run` (boolean): `true`: answer the write's plan (`DryRun`, 200) and send nothing to LinkedIn. Default: `false`. ## Headers - `Idempotency-Key` (string): The same key (per account) never writes twice: a repeat answers the first answer for 7 days; a repeat while the first runs answers 409. ## Request body `application/json` (required) - `account_id` (string) - `action` (string, required): LinkedIn has `setReadStatus` and `setMuteStatus`; the others (WhatsApp's and Telegram's) answer 422 `errors/not_supported_by_provider`. One of: `setReadStatus`, `setMuteStatus`, `setArchiveStatus`, `setPinnedStatus`, `addParticipant`, `removeParticipant`, `setLabel`, `getInviteLink`. - `value` (boolean, required) ## Example request ```bash curl -sS -X PATCH "https://direct.lempile.com/api/v1/chats/{chat_id}?dry_run=true" \ -H "X-API-KEY: $DIRECT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "account_id": "00000000-0000-4000-8000-0000000000a1", "action": "setReadStatus", "value": true }' ``` ## Responses ### 200 Done, or with `?dry_run=true` the plan. ```json { "object": "ChatPatched" } ``` ### 400 A required parameter missing (`errors/missing_parameters`), or one that isn't valid (`errors/invalid_parameters`, `errors/invalid_url`, `errors/content_too_large`). ```json { "title": "Missing parameters", "detail": "account_id is required.", "type": "errors/missing_parameters", "status": 400 } ``` ### 401 `errors/missing_credentials`: the `X-API-KEY` header is missing, wrong or revoked. `errors/disconnected_account`: LinkedIn signed the account out (or asks it for a security check); reconnect it. ```json { "title": "Missing credentials", "detail": "The X-API-KEY header is missing or wrong.", "type": "errors/missing_credentials", "status": 401 } ``` ### 403 LinkedIn refused it for this account (`errors/resource_access_restricted`, `errors/action_required`), or LinkedIn restricted the account (`errors/account_restricted`: every route answers it, with no LinkedIn call, until a person clears the restriction in Lempile), or the account doesn't write through Direct (`errors/insufficient_permissions`), or it needs Sales Navigator or Recruiter (`errors/feature_not_subscribed`). ```json { "title": "Access restricted", "detail": "LinkedIn refused this read for this account.", "type": "errors/resource_access_restricted", "status": 403 } ``` ### 404 `errors/resource_not_found`: an unknown or removed account, an account of another workspace (answered exactly the same), or nothing on LinkedIn with this id. ```json { "title": "Account not found", "detail": "No account with this account_id is enabled here.", "type": "errors/resource_not_found", "status": 404 } ``` ### 409 `errors/conflict`: a write with this Idempotency-Key is still running. ```json { "title": "Write in progress", "detail": "A write with this key is still running.", "type": "errors/conflict", "status": 409 } ``` ### 422 A write LinkedIn refuses, or that the checks before it refuse: `errors/already_connected`, `errors/already_invited_recently`, `errors/cannot_invite_attendee`, `errors/invalid_recipient`, `errors/cannot_resend_yet`, `errors/limit_exceeded`, `errors/connection_limit_reached`, `errors/no_connection_with_recipient`, `errors/not_allowed_inmail`, `errors/insufficient_credits`, `errors/invalid_post`, `errors/unprocessable_entity`, `errors/invalid_parameters`, `errors/invalid_message` (a voice note over 60 seconds), `errors/action_already_performed` (a message already deleted), `errors/not_supported_by_provider`. ```json { "title": "Already connected", "detail": "This person is already a connection of the account.", "type": "errors/already_connected", "status": 422 } ``` ### 429 `errors/too_many_requests`: LinkedIn asked the account to slow down (it rests 15 minutes), its daily calls or writes are used up, or it's busy with other calls. Wait `retry_after` seconds. ```json { "title": "Too many requests", "detail": "LinkedIn asked this account to slow down.", "type": "errors/too_many_requests", "status": 429, "retry_after": 900 } ``` ### 500 `errors/provider_error`: LinkedIn answered something Direct couldn't read (nothing was written). `errors/unexpected_error`: Direct failed. ```json { "title": "Provider error", "detail": "LinkedIn answered 500.", "type": "errors/provider_error", "status": 500 } ``` ### 501 `errors/feature_not_implemented`: Direct doesn't do this (yet). A Unipile client can fall back to Unipile. ```json { "title": "Missing feature", "detail": "Lempile Direct reads LinkedIn only (see /api/v1/users and /api/v1/posts).", "type": "errors/feature_not_implemented", "status": 501 } ``` ### 503 `errors/network_down`: the account's proxy or browser server didn't answer. Nothing was sent. ```json { "title": "Network down", "detail": "The account's proxy didn't connect.", "type": "errors/network_down", "status": 503 } ``` ### 504 `errors/request_timeout`: LinkedIn didn't answer in time. On a write: an unknown outcome (it may have been sent); it's never retried and its Idempotency-Key never writes again. ```json { "title": "Unknown outcome", "detail": "LinkedIn may have received this write; it isn't tried again. Check before sending it once more.", "type": "errors/request_timeout", "status": 504 } ``` --- # Lempile Direct: Delete a chat `DELETE https://direct.lempile.com/api/v1/chats/{chat_id}` Deletes the conversation from the account's inbox (LinkedIn's Delete conversation; the other people keep theirs). ## Authentication Send your Lempile Direct API key in the `X-API-KEY` header. ## Path parameters - `chat_id` (string, required): LinkedIn's thread id (`2-…`, as Direct answers it). ## Query parameters - `account_id` (string, required): The account that writes. - `dry_run` (boolean): `true`: answer the write's plan (`DryRun`, 200) and send nothing to LinkedIn. Default: `false`. ## Headers - `Idempotency-Key` (string): The same key (per account) never writes twice: a repeat answers the first answer for 7 days; a repeat while the first runs answers 409. ## Example request ```bash curl -sS -X DELETE "https://direct.lempile.com/api/v1/chats/{chat_id}?dry_run=true" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` ## Responses ### 200 Deleted, or with `?dry_run=true` the plan. ```json { "object": "ChatDeleted" } ``` ### 400 A required parameter missing (`errors/missing_parameters`), or one that isn't valid (`errors/invalid_parameters`, `errors/invalid_url`, `errors/content_too_large`). ```json { "title": "Missing parameters", "detail": "account_id is required.", "type": "errors/missing_parameters", "status": 400 } ``` ### 401 `errors/missing_credentials`: the `X-API-KEY` header is missing, wrong or revoked. `errors/disconnected_account`: LinkedIn signed the account out (or asks it for a security check); reconnect it. ```json { "title": "Missing credentials", "detail": "The X-API-KEY header is missing or wrong.", "type": "errors/missing_credentials", "status": 401 } ``` ### 403 LinkedIn refused it for this account (`errors/resource_access_restricted`, `errors/action_required`), or LinkedIn restricted the account (`errors/account_restricted`: every route answers it, with no LinkedIn call, until a person clears the restriction in Lempile), or the account doesn't write through Direct (`errors/insufficient_permissions`), or it needs Sales Navigator or Recruiter (`errors/feature_not_subscribed`). ```json { "title": "Access restricted", "detail": "LinkedIn refused this read for this account.", "type": "errors/resource_access_restricted", "status": 403 } ``` ### 404 `errors/resource_not_found`: an unknown or removed account, an account of another workspace (answered exactly the same), or nothing on LinkedIn with this id. ```json { "title": "Account not found", "detail": "No account with this account_id is enabled here.", "type": "errors/resource_not_found", "status": 404 } ``` ### 409 `errors/conflict`: a write with this Idempotency-Key is still running. ```json { "title": "Write in progress", "detail": "A write with this key is still running.", "type": "errors/conflict", "status": 409 } ``` ### 422 A write LinkedIn refuses, or that the checks before it refuse: `errors/already_connected`, `errors/already_invited_recently`, `errors/cannot_invite_attendee`, `errors/invalid_recipient`, `errors/cannot_resend_yet`, `errors/limit_exceeded`, `errors/connection_limit_reached`, `errors/no_connection_with_recipient`, `errors/not_allowed_inmail`, `errors/insufficient_credits`, `errors/invalid_post`, `errors/unprocessable_entity`, `errors/invalid_parameters`, `errors/invalid_message` (a voice note over 60 seconds), `errors/action_already_performed` (a message already deleted), `errors/not_supported_by_provider`. ```json { "title": "Already connected", "detail": "This person is already a connection of the account.", "type": "errors/already_connected", "status": 422 } ``` ### 429 `errors/too_many_requests`: LinkedIn asked the account to slow down (it rests 15 minutes), its daily calls or writes are used up, or it's busy with other calls. Wait `retry_after` seconds. ```json { "title": "Too many requests", "detail": "LinkedIn asked this account to slow down.", "type": "errors/too_many_requests", "status": 429, "retry_after": 900 } ``` ### 500 `errors/provider_error`: LinkedIn answered something Direct couldn't read (nothing was written). `errors/unexpected_error`: Direct failed. ```json { "title": "Provider error", "detail": "LinkedIn answered 500.", "type": "errors/provider_error", "status": 500 } ``` ### 501 `errors/feature_not_implemented`: Direct doesn't do this (yet). A Unipile client can fall back to Unipile. ```json { "title": "Missing feature", "detail": "Lempile Direct reads LinkedIn only (see /api/v1/users and /api/v1/posts).", "type": "errors/feature_not_implemented", "status": 501 } ``` ### 503 `errors/network_down`: the account's proxy or browser server didn't answer. Nothing was sent. ```json { "title": "Network down", "detail": "The account's proxy didn't connect.", "type": "errors/network_down", "status": 503 } ``` ### 504 `errors/request_timeout`: LinkedIn didn't answer in time. On a write: an unknown outcome (it may have been sent); it's never retried and its Idempotency-Key never writes again. ```json { "title": "Unknown outcome", "detail": "LinkedIn may have received this write; it isn't tried again. Check before sending it once more.", "type": "errors/request_timeout", "status": 504 } ``` --- # Lempile Direct: List a chat's attendees `GET https://direct.lempile.com/api/v1/chats/{chat_id}/attendees` Everyone in the conversation, the account included (`is_self: 1`). ## Authentication Send your Lempile Direct API key in the `X-API-KEY` header. ## Path parameters - `chat_id` (string, required): The chat's id as Direct answers it (LinkedIn's own `2-…` form, URL-encoded, works too). Example: `2--_90aHJlYWQwMDAwIQ`. ## Query parameters - `account_id` (string, required): The account that reads: a Lempile LinkedIn account id (`GET /accounts` lists them). Example: `00000000-0000-4000-8000-0000000000a1`. ## Example request ```bash curl -sS "https://direct.lempile.com/api/v1/chats/2--_90aHJlYWQwMDAwIQ/attendees?account_id=00000000-0000-4000-8000-0000000000a1" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` ## Responses ### 200 OK ```json { "object": "ChatAttendeeList", "items": [ { "object": "ChatAttendee", "id": "ACoAAAbcdefghijklmnop", "account_id": "00000000-0000-4000-8000-0000000000a1", "provider_id": "ACoAAAbcdefghijklmnop", "name": "Ada Sender", "is_self": 1, "hidden": 0, "specifics": { "provider": "LINKEDIN", "member_urn": "urn:li:member:946529289", "occupation": "Founder", "headline": "Founder", "network_distance": "SELF" }, "picture_url": "https://media.licdn.com/dms/image/x/400.jpg", "profile_url": "https://www.linkedin.com/in/ACoAAAbcdefghijklmnop" }, { "object": "ChatAttendee", "id": "ACoAAAperson0005xyz", "account_id": "00000000-0000-4000-8000-0000000000a1", "provider_id": "ACoAAAperson0005xyz", "name": "P5 Person", "is_self": 0, "hidden": 0, "specifics": { "provider": "LINKEDIN", "member_urn": "urn:li:member:618293495", "occupation": "Founder", "headline": "Founder", "network_distance": "DISTANCE_2" }, "picture_url": "https://media.licdn.com/dms/image/x/400.jpg", "profile_url": "https://www.linkedin.com/in/ACoAAAperson0005xyz" } ], "cursor": null } ``` ### 400 A required parameter missing (`errors/missing_parameters`), or one that isn't valid (`errors/invalid_parameters`, `errors/invalid_url`, `errors/content_too_large`). ```json { "title": "Missing parameters", "detail": "account_id is required.", "type": "errors/missing_parameters", "status": 400 } ``` ### 401 `errors/missing_credentials`: the `X-API-KEY` header is missing, wrong or revoked. `errors/disconnected_account`: LinkedIn signed the account out (or asks it for a security check); reconnect it. ```json { "title": "Missing credentials", "detail": "The X-API-KEY header is missing or wrong.", "type": "errors/missing_credentials", "status": 401 } ``` ### 404 `errors/resource_not_found`: an unknown or removed account, an account of another workspace (answered exactly the same), or nothing on LinkedIn with this id. ```json { "title": "Account not found", "detail": "No account with this account_id is enabled here.", "type": "errors/resource_not_found", "status": 404 } ``` ### 429 `errors/too_many_requests`: LinkedIn asked the account to slow down (it rests 15 minutes), its daily calls or writes are used up, or it's busy with other calls. Wait `retry_after` seconds. ```json { "title": "Too many requests", "detail": "LinkedIn asked this account to slow down.", "type": "errors/too_many_requests", "status": 429, "retry_after": 900 } ``` ### 500 `errors/provider_error`: LinkedIn answered something Direct couldn't read (nothing was written). `errors/unexpected_error`: Direct failed. ```json { "title": "Provider error", "detail": "LinkedIn answered 500.", "type": "errors/provider_error", "status": 500 } ``` ### 503 `errors/network_down`: the account's proxy or browser server didn't answer. Nothing was sent. ```json { "title": "Network down", "detail": "The account's proxy didn't connect.", "type": "errors/network_down", "status": 503 } ``` ### 504 `errors/request_timeout`: LinkedIn didn't answer in time. On a write: an unknown outcome (it may have been sent); it's never retried and its Idempotency-Key never writes again. ```json { "title": "Unknown outcome", "detail": "LinkedIn may have received this write; it isn't tried again. Check before sending it once more.", "type": "errors/request_timeout", "status": 504 } ``` --- # Lempile Direct: List a chat's messages `GET https://direct.lempile.com/api/v1/chats/{chat_id}/messages` Newest first, back to the first message (100 a LinkedIn call). ## Authentication Send your Lempile Direct API key in the `X-API-KEY` header. ## Path parameters - `chat_id` (string, required): The chat's id as Direct answers it (LinkedIn's own `2-…` form, URL-encoded, works too). Example: `2--_90aHJlYWQwMDAwIQ`. ## Query parameters - `account_id` (string, required): The account that reads: a Lempile LinkedIn account id (`GET /accounts` lists them). Example: `00000000-0000-4000-8000-0000000000a1`. - `limit` (integer): Items per page: 1 to 250 (default 20). Default: `20`. - `cursor` (string): A cursor a previous page gave. - `before` (string): Only messages before this time (ISO 8601 UTC). - `after` (string): Only messages after this time (ISO 8601 UTC). - `sender_id` (string): Only this sender's messages (a provider id). ## Example request ```bash curl -sS "https://direct.lempile.com/api/v1/chats/2--_90aHJlYWQwMDAwIQ/messages?account_id=00000000-0000-4000-8000-0000000000a1" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` ## Responses ### 200 OK ```json { "object": "MessageList", "items": [ { "object": "Message", "id": "2-_vptc2cwMTI5IQ", "provider_id": "2-_vptc2cwMTI5IQ", "account_id": "00000000-0000-4000-8000-0000000000a1", "chat_id": "2--_90aHJlYWQwMDAwIQ", "chat_provider_id": "2--_90aHJlYWQwMDAwIQ", "sender_id": "ACoAAAbcdefghijklmnop", "sender_attendee_id": "ACoAAAbcdefghijklmnop", "sender_urn": "urn:li:fsd_profile:ACoAAAbcdefghijklmnop", "text": "message 129", "attachments": [], "timestamp": "2025-10-24T09:59:59.000Z", "is_sender": 1, "reactions": [], "seen": 0, "seen_by": {}, "hidden": 0, "deleted": 0, "edited": 0, "is_event": 0, "delivered": 1, "behavior": null, "original": "", "message_type": "MESSAGE", "attendee_type": "MEMBER" }, { "object": "Message", "id": "2-_vptc2cwMTI4IQ", "provider_id": "2-_vptc2cwMTI4IQ", "account_id": "00000000-0000-4000-8000-0000000000a1", "chat_id": "2--_90aHJlYWQwMDAwIQ", "chat_provider_id": "2--_90aHJlYWQwMDAwIQ", "sender_id": "ACoAAAperson0000xyz", "sender_attendee_id": "ACoAAAperson0000xyz", "sender_urn": "urn:li:fsd_profile:ACoAAAperson0000xyz", "text": "message 128", "attachments": [], "timestamp": "2025-10-24T09:59:58.000Z", "is_sender": 0, "reactions": [], "seen": 0, "seen_by": {}, "hidden": 0, "deleted": 0, "edited": 0, "is_event": 0, "delivered": 1, "behavior": null, "original": "", "message_type": "MESSAGE", "attendee_type": "MEMBER", "attendee_distance": 2 } ], "cursor": "eyJrIjoibWVzc2FnZXMiLCJiIjoxNzYxMjk5OTk3MDAwLCJ4IjpbIjItX3ZwdGMyY3dNVEkzSVEiXSwiYyI6IjItKy85MGFISmxZV1F3TURBd0lRPT0ifQ" } ``` ### 400 A required parameter missing (`errors/missing_parameters`), or one that isn't valid (`errors/invalid_parameters`, `errors/invalid_url`, `errors/content_too_large`). ```json { "title": "Missing parameters", "detail": "account_id is required.", "type": "errors/missing_parameters", "status": 400 } ``` ### 401 `errors/missing_credentials`: the `X-API-KEY` header is missing, wrong or revoked. `errors/disconnected_account`: LinkedIn signed the account out (or asks it for a security check); reconnect it. ```json { "title": "Missing credentials", "detail": "The X-API-KEY header is missing or wrong.", "type": "errors/missing_credentials", "status": 401 } ``` ### 404 `errors/resource_not_found`: an unknown or removed account, an account of another workspace (answered exactly the same), or nothing on LinkedIn with this id. ```json { "title": "Account not found", "detail": "No account with this account_id is enabled here.", "type": "errors/resource_not_found", "status": 404 } ``` ### 429 `errors/too_many_requests`: LinkedIn asked the account to slow down (it rests 15 minutes), its daily calls or writes are used up, or it's busy with other calls. Wait `retry_after` seconds. ```json { "title": "Too many requests", "detail": "LinkedIn asked this account to slow down.", "type": "errors/too_many_requests", "status": 429, "retry_after": 900 } ``` ### 500 `errors/provider_error`: LinkedIn answered something Direct couldn't read (nothing was written). `errors/unexpected_error`: Direct failed. ```json { "title": "Provider error", "detail": "LinkedIn answered 500.", "type": "errors/provider_error", "status": 500 } ``` ### 503 `errors/network_down`: the account's proxy or browser server didn't answer. Nothing was sent. ```json { "title": "Network down", "detail": "The account's proxy didn't connect.", "type": "errors/network_down", "status": 503 } ``` ### 504 `errors/request_timeout`: LinkedIn didn't answer in time. On a write: an unknown outcome (it may have been sent); it's never retried and its Idempotency-Key never writes again. ```json { "title": "Unknown outcome", "detail": "LinkedIn may have received this write; it isn't tried again. Check before sending it once more.", "type": "errors/request_timeout", "status": 504 } ``` --- # Lempile Direct: Send a message in a chat `POST https://direct.lempile.com/api/v1/chats/{chat_id}/messages` A message in an existing conversation: text and files, or a voice note (multipart `voice_message`). A voice note is uploaded to LinkedIn as a `VOICE_MESSAGE` and sent as the message's `audio` (its asset, size and length), with no text. ## Authentication Send your Lempile Direct API key in the `X-API-KEY` header. ## Path parameters - `chat_id` (string, required): The chat's id as Direct answers it (LinkedIn's own `2-…` form, URL-encoded, works too). Example: `2--_90aHJlYWQwMDAwIQ`. ## Query parameters - `account_id` (string): The account that writes, when the body doesn't name it. - `dry_run` (boolean): `true`: answer the write's plan (`DryRun`, 200) and send nothing to LinkedIn. Default: `false`. ## Headers - `Idempotency-Key` (string): The same key (per account) never writes twice: a repeat answers the first answer for 7 days; a repeat while the first runs answers 409. ## Request body `application/json` (required) - `account_id` (string, required): The account that writes (or `?account_id=`). Required. - `text` (string): 8,000 characters at most. Required unless a file or a voice note is sent. - `attachments` (array of string (binary)): Files, 20 MB each at most. - `video_message` (string (binary)): A video, sent as a file. - `voice_message` (string (binary)): A voice note (multipart): sent alone (no `text` or files with it), as LinkedIn's apps send one. Any audio (m4a/AAC as Looply records it, mp3, ogg, webm/opus, wav, aac, flac; 20 MB at most) is turned into LinkedIn's AAC .m4a on the server; 60 seconds at most (422 `errors/invalid_message` over it, 415 `errors/unsupported_media_type` when it isn't audio). - `quote_id` (string): Answers 501: quoting a message isn't sent yet. `multipart/form-data` (required) - `account_id` (string, required): The account that writes (or `?account_id=`). Required. - `text` (string): 8,000 characters at most. Required unless a file or a voice note is sent. - `attachments` (array of string (binary)): Files, 20 MB each at most. - `video_message` (string (binary)): A video, sent as a file. - `voice_message` (string (binary)): A voice note (multipart): sent alone (no `text` or files with it), as LinkedIn's apps send one. Any audio (m4a/AAC as Looply records it, mp3, ogg, webm/opus, wav, aac, flac; 20 MB at most) is turned into LinkedIn's AAC .m4a on the server; 60 seconds at most (422 `errors/invalid_message` over it, 415 `errors/unsupported_media_type` when it isn't audio). - `quote_id` (string): Answers 501: quoting a message isn't sent yet. ## Example request ```bash curl -sS -X POST "https://direct.lempile.com/api/v1/chats/2--_90aHJlYWQwMDAwIQ/messages?dry_run=true" \ -H "X-API-KEY: $DIRECT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "account_id": "00000000-0000-4000-8000-0000000000a1", "text": "Thanks, Tuesday works for me." }' ``` ## Responses ### 200 With `?dry_run=true`: the write's plan. Nothing is sent. ```json { "object": "DryRun", "route": "string", "method": "string", "path": "string", "body": {}, "status": 0, "uploads": [ { "method": "string", "path": "string", "body": {}, "then": "string", "content_type": "string", "file": {} } ], "multiphoto": { "method": "string", "path": "string", "body": {} }, "checked": [ "string" ] } ``` ### 201 Created ```json { "object": "MessageSent", "message_id": "2-_vptc2cwMTMwIQ", "id": "2-_vptc2cwMTMwIQ" } ``` ### 400 A required parameter missing (`errors/missing_parameters`), or one that isn't valid (`errors/invalid_parameters`, `errors/invalid_url`, `errors/content_too_large`). ```json { "title": "Missing parameters", "detail": "account_id is required.", "type": "errors/missing_parameters", "status": 400 } ``` ### 401 `errors/missing_credentials`: the `X-API-KEY` header is missing, wrong or revoked. `errors/disconnected_account`: LinkedIn signed the account out (or asks it for a security check); reconnect it. ```json { "title": "Missing credentials", "detail": "The X-API-KEY header is missing or wrong.", "type": "errors/missing_credentials", "status": 401 } ``` ### 403 LinkedIn refused it for this account (`errors/resource_access_restricted`, `errors/action_required`), or LinkedIn restricted the account (`errors/account_restricted`: every route answers it, with no LinkedIn call, until a person clears the restriction in Lempile), or the account doesn't write through Direct (`errors/insufficient_permissions`), or it needs Sales Navigator or Recruiter (`errors/feature_not_subscribed`). ```json { "title": "Access restricted", "detail": "LinkedIn refused this read for this account.", "type": "errors/resource_access_restricted", "status": 403 } ``` ### 404 `errors/resource_not_found`: an unknown or removed account, an account of another workspace (answered exactly the same), or nothing on LinkedIn with this id. ```json { "title": "Account not found", "detail": "No account with this account_id is enabled here.", "type": "errors/resource_not_found", "status": 404 } ``` ### 409 `errors/conflict`: a write with this Idempotency-Key is still running. ```json { "title": "Write in progress", "detail": "A write with this key is still running.", "type": "errors/conflict", "status": 409 } ``` ### 415 `errors/unsupported_media_type`: a voice note that isn't audio Direct can turn into LinkedIn's format (AAC .m4a). Nothing was sent. ```json { "title": "Unsupported media type", "detail": "This voice note isn't an audio file LinkedIn can take (m4a, mp3, ogg, webm, wav, aac or flac).", "type": "errors/unsupported_media_type", "status": 415 } ``` ### 422 A write LinkedIn refuses, or that the checks before it refuse: `errors/already_connected`, `errors/already_invited_recently`, `errors/cannot_invite_attendee`, `errors/invalid_recipient`, `errors/cannot_resend_yet`, `errors/limit_exceeded`, `errors/connection_limit_reached`, `errors/no_connection_with_recipient`, `errors/not_allowed_inmail`, `errors/insufficient_credits`, `errors/invalid_post`, `errors/unprocessable_entity`, `errors/invalid_parameters`, `errors/invalid_message` (a voice note over 60 seconds), `errors/action_already_performed` (a message already deleted), `errors/not_supported_by_provider`. ```json { "title": "Already connected", "detail": "This person is already a connection of the account.", "type": "errors/already_connected", "status": 422 } ``` ### 429 `errors/too_many_requests`: LinkedIn asked the account to slow down (it rests 15 minutes), its daily calls or writes are used up, or it's busy with other calls. Wait `retry_after` seconds. ```json { "title": "Too many requests", "detail": "LinkedIn asked this account to slow down.", "type": "errors/too_many_requests", "status": 429, "retry_after": 900 } ``` ### 500 `errors/provider_error`: LinkedIn answered something Direct couldn't read (nothing was written). `errors/unexpected_error`: Direct failed. ```json { "title": "Provider error", "detail": "LinkedIn answered 500.", "type": "errors/provider_error", "status": 500 } ``` ### 501 `errors/feature_not_implemented`: Direct doesn't do this (yet). A Unipile client can fall back to Unipile. ```json { "title": "Missing feature", "detail": "Lempile Direct reads LinkedIn only (see /api/v1/users and /api/v1/posts).", "type": "errors/feature_not_implemented", "status": 501 } ``` ### 503 `errors/network_down`: the account's proxy or browser server didn't answer. Nothing was sent. ```json { "title": "Network down", "detail": "The account's proxy didn't connect.", "type": "errors/network_down", "status": 503 } ``` ### 504 `errors/request_timeout`: LinkedIn didn't answer in time. On a write: an unknown outcome (it may have been sent); it's never retried and its Idempotency-Key never writes again. ```json { "title": "Unknown outcome", "detail": "LinkedIn may have received this write; it isn't tried again. Check before sending it once more.", "type": "errors/request_timeout", "status": 504 } ``` --- # Lempile Direct: Retrieve a message `GET https://direct.lempile.com/api/v1/messages/{message_id}` One message by its id (a LinkedIn call by ids). 404 when LinkedIn doesn't know it. ## Authentication Send your Lempile Direct API key in the `X-API-KEY` header. ## Path parameters - `message_id` (string, required): The message's id as Direct answers it. Example: `2-_vptc2cwMDAzIQ`. ## Query parameters - `account_id` (string, required): The account that reads: a Lempile LinkedIn account id (`GET /accounts` lists them). Example: `00000000-0000-4000-8000-0000000000a1`. ## Example request ```bash curl -sS "https://direct.lempile.com/api/v1/messages/2-_vptc2cwMDAzIQ?account_id=00000000-0000-4000-8000-0000000000a1" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` ## Responses ### 200 OK ```json { "object": "Message", "id": "2-_vptc2cwMDAzIQ", "provider_id": "2-_vptc2cwMDAzIQ", "account_id": "00000000-0000-4000-8000-0000000000a1", "chat_id": "2--_90aHJlYWQwMDAwIQ", "chat_provider_id": "2--_90aHJlYWQwMDAwIQ", "sender_id": "ACoAAAbcdefghijklmnop", "sender_attendee_id": "ACoAAAbcdefghijklmnop", "sender_urn": "urn:li:fsd_profile:ACoAAAbcdefghijklmnop", "text": "message 3", "attachments": [], "timestamp": "2025-10-24T09:57:53.000Z", "is_sender": 1, "reactions": [], "seen": 0, "seen_by": {}, "hidden": 0, "deleted": 0, "edited": 0, "is_event": 0, "delivered": 1, "behavior": null, "original": "", "message_type": "MESSAGE", "attendee_type": "MEMBER", "account_type": "LINKEDIN" } ``` ### 400 A required parameter missing (`errors/missing_parameters`), or one that isn't valid (`errors/invalid_parameters`, `errors/invalid_url`, `errors/content_too_large`). ```json { "title": "Missing parameters", "detail": "account_id is required.", "type": "errors/missing_parameters", "status": 400 } ``` ### 401 `errors/missing_credentials`: the `X-API-KEY` header is missing, wrong or revoked. `errors/disconnected_account`: LinkedIn signed the account out (or asks it for a security check); reconnect it. ```json { "title": "Missing credentials", "detail": "The X-API-KEY header is missing or wrong.", "type": "errors/missing_credentials", "status": 401 } ``` ### 404 `errors/resource_not_found`: an unknown or removed account, an account of another workspace (answered exactly the same), or nothing on LinkedIn with this id. ```json { "title": "Account not found", "detail": "No account with this account_id is enabled here.", "type": "errors/resource_not_found", "status": 404 } ``` ### 429 `errors/too_many_requests`: LinkedIn asked the account to slow down (it rests 15 minutes), its daily calls or writes are used up, or it's busy with other calls. Wait `retry_after` seconds. ```json { "title": "Too many requests", "detail": "LinkedIn asked this account to slow down.", "type": "errors/too_many_requests", "status": 429, "retry_after": 900 } ``` ### 500 `errors/provider_error`: LinkedIn answered something Direct couldn't read (nothing was written). `errors/unexpected_error`: Direct failed. ```json { "title": "Provider error", "detail": "LinkedIn answered 500.", "type": "errors/provider_error", "status": 500 } ``` ### 503 `errors/network_down`: the account's proxy or browser server didn't answer. Nothing was sent. ```json { "title": "Network down", "detail": "The account's proxy didn't connect.", "type": "errors/network_down", "status": 503 } ``` ### 504 `errors/request_timeout`: LinkedIn didn't answer in time. On a write: an unknown outcome (it may have been sent); it's never retried and its Idempotency-Key never writes again. ```json { "title": "Unknown outcome", "detail": "LinkedIn may have received this write; it isn't tried again. Check before sending it once more.", "type": "errors/request_timeout", "status": 504 } ``` --- # Lempile Direct: Edit a message `PATCH https://direct.lempile.com/api/v1/messages/{message_id}` Changes the text of one of the account's own messages, within 60 minutes of sending it (LinkedIn's limit; checked first: someone else's message answers 403, an older one 422 `errors/unprocessable_entity`). ## Authentication Send your Lempile Direct API key in the `X-API-KEY` header. ## Path parameters - `message_id` (string, required): LinkedIn's message id (`2-…`, as Direct answers it). ## Query parameters - `account_id` (string): The account that writes, when the body doesn't name it. - `dry_run` (boolean): `true`: answer the write's plan (`DryRun`, 200) and send nothing to LinkedIn. Default: `false`. ## Headers - `Idempotency-Key` (string): The same key (per account) never writes twice: a repeat answers the first answer for 7 days; a repeat while the first runs answers 409. ## Request body `application/json` (required) - `account_id` (string) - `text` (string, required) ## Example request ```bash curl -sS -X PATCH "https://direct.lempile.com/api/v1/messages/{message_id}?dry_run=true" \ -H "X-API-KEY: $DIRECT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "account_id": "00000000-0000-4000-8000-0000000000a1", "text": "Hi Bob, see you at 3pm" }' ``` ## Responses ### 200 Edited, or with `?dry_run=true` the plan. ```json { "object": "MessagePatched" } ``` ### 400 A required parameter missing (`errors/missing_parameters`), or one that isn't valid (`errors/invalid_parameters`, `errors/invalid_url`, `errors/content_too_large`). ```json { "title": "Missing parameters", "detail": "account_id is required.", "type": "errors/missing_parameters", "status": 400 } ``` ### 401 `errors/missing_credentials`: the `X-API-KEY` header is missing, wrong or revoked. `errors/disconnected_account`: LinkedIn signed the account out (or asks it for a security check); reconnect it. ```json { "title": "Missing credentials", "detail": "The X-API-KEY header is missing or wrong.", "type": "errors/missing_credentials", "status": 401 } ``` ### 403 LinkedIn refused it for this account (`errors/resource_access_restricted`, `errors/action_required`), or LinkedIn restricted the account (`errors/account_restricted`: every route answers it, with no LinkedIn call, until a person clears the restriction in Lempile), or the account doesn't write through Direct (`errors/insufficient_permissions`), or it needs Sales Navigator or Recruiter (`errors/feature_not_subscribed`). ```json { "title": "Access restricted", "detail": "LinkedIn refused this read for this account.", "type": "errors/resource_access_restricted", "status": 403 } ``` ### 404 `errors/resource_not_found`: an unknown or removed account, an account of another workspace (answered exactly the same), or nothing on LinkedIn with this id. ```json { "title": "Account not found", "detail": "No account with this account_id is enabled here.", "type": "errors/resource_not_found", "status": 404 } ``` ### 409 `errors/conflict`: a write with this Idempotency-Key is still running. ```json { "title": "Write in progress", "detail": "A write with this key is still running.", "type": "errors/conflict", "status": 409 } ``` ### 422 A write LinkedIn refuses, or that the checks before it refuse: `errors/already_connected`, `errors/already_invited_recently`, `errors/cannot_invite_attendee`, `errors/invalid_recipient`, `errors/cannot_resend_yet`, `errors/limit_exceeded`, `errors/connection_limit_reached`, `errors/no_connection_with_recipient`, `errors/not_allowed_inmail`, `errors/insufficient_credits`, `errors/invalid_post`, `errors/unprocessable_entity`, `errors/invalid_parameters`, `errors/invalid_message` (a voice note over 60 seconds), `errors/action_already_performed` (a message already deleted), `errors/not_supported_by_provider`. ```json { "title": "Already connected", "detail": "This person is already a connection of the account.", "type": "errors/already_connected", "status": 422 } ``` ### 429 `errors/too_many_requests`: LinkedIn asked the account to slow down (it rests 15 minutes), its daily calls or writes are used up, or it's busy with other calls. Wait `retry_after` seconds. ```json { "title": "Too many requests", "detail": "LinkedIn asked this account to slow down.", "type": "errors/too_many_requests", "status": 429, "retry_after": 900 } ``` ### 500 `errors/provider_error`: LinkedIn answered something Direct couldn't read (nothing was written). `errors/unexpected_error`: Direct failed. ```json { "title": "Provider error", "detail": "LinkedIn answered 500.", "type": "errors/provider_error", "status": 500 } ``` ### 501 `errors/feature_not_implemented`: Direct doesn't do this (yet). A Unipile client can fall back to Unipile. ```json { "title": "Missing feature", "detail": "Lempile Direct reads LinkedIn only (see /api/v1/users and /api/v1/posts).", "type": "errors/feature_not_implemented", "status": 501 } ``` ### 503 `errors/network_down`: the account's proxy or browser server didn't answer. Nothing was sent. ```json { "title": "Network down", "detail": "The account's proxy didn't connect.", "type": "errors/network_down", "status": 503 } ``` ### 504 `errors/request_timeout`: LinkedIn didn't answer in time. On a write: an unknown outcome (it may have been sent); it's never retried and its Idempotency-Key never writes again. ```json { "title": "Unknown outcome", "detail": "LinkedIn may have received this write; it isn't tried again. Check before sending it once more.", "type": "errors/request_timeout", "status": 504 } ``` --- # Lempile Direct: Delete a message `DELETE https://direct.lempile.com/api/v1/messages/{message_id}` Unipile's route: takes back one of the account's own messages for everyone, as LinkedIn's "Delete" does (`messengerMessages?action=recall`). Reads the message first: someone else's answers 403, one already deleted 422 `errors/action_already_performed`, and one sent more than 60 minutes ago 422 `errors/unprocessable_entity` (LinkedIn's limit, as Unipile says). Direct needs `account_id`, as on every inbox call. ## Authentication Send your Lempile Direct API key in the `X-API-KEY` header. ## Path parameters - `message_id` (string, required): The message's id as Direct answers it. Example: `2-_vptc2cwMDAzIQ`. ## Query parameters - `account_id` (string, required): The account that writes. - `dry_run` (boolean): `true`: answer the write's plan (`DryRun`, 200) and send nothing to LinkedIn. Default: `false`. ## Headers - `Idempotency-Key` (string): The same key (per account) never writes twice: a repeat answers the first answer for 7 days; a repeat while the first runs answers 409. ## Example request ```bash curl -sS -X DELETE "https://direct.lempile.com/api/v1/messages/2-_vptc2cwMDAzIQ?dry_run=true" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` ## Responses ### 200 Deleted, or with `?dry_run=true` the plan. ```json { "object": "MessageDeleted" } ``` ### 400 A required parameter missing (`errors/missing_parameters`), or one that isn't valid (`errors/invalid_parameters`, `errors/invalid_url`, `errors/content_too_large`). ```json { "title": "Missing parameters", "detail": "account_id is required.", "type": "errors/missing_parameters", "status": 400 } ``` ### 401 `errors/missing_credentials`: the `X-API-KEY` header is missing, wrong or revoked. `errors/disconnected_account`: LinkedIn signed the account out (or asks it for a security check); reconnect it. ```json { "title": "Missing credentials", "detail": "The X-API-KEY header is missing or wrong.", "type": "errors/missing_credentials", "status": 401 } ``` ### 403 LinkedIn refused it for this account (`errors/resource_access_restricted`, `errors/action_required`), or LinkedIn restricted the account (`errors/account_restricted`: every route answers it, with no LinkedIn call, until a person clears the restriction in Lempile), or the account doesn't write through Direct (`errors/insufficient_permissions`), or it needs Sales Navigator or Recruiter (`errors/feature_not_subscribed`). ```json { "title": "Access restricted", "detail": "LinkedIn refused this read for this account.", "type": "errors/resource_access_restricted", "status": 403 } ``` ### 404 `errors/resource_not_found`: an unknown or removed account, an account of another workspace (answered exactly the same), or nothing on LinkedIn with this id. ```json { "title": "Account not found", "detail": "No account with this account_id is enabled here.", "type": "errors/resource_not_found", "status": 404 } ``` ### 409 `errors/conflict`: a write with this Idempotency-Key is still running. ```json { "title": "Write in progress", "detail": "A write with this key is still running.", "type": "errors/conflict", "status": 409 } ``` ### 422 A write LinkedIn refuses, or that the checks before it refuse: `errors/already_connected`, `errors/already_invited_recently`, `errors/cannot_invite_attendee`, `errors/invalid_recipient`, `errors/cannot_resend_yet`, `errors/limit_exceeded`, `errors/connection_limit_reached`, `errors/no_connection_with_recipient`, `errors/not_allowed_inmail`, `errors/insufficient_credits`, `errors/invalid_post`, `errors/unprocessable_entity`, `errors/invalid_parameters`, `errors/invalid_message` (a voice note over 60 seconds), `errors/action_already_performed` (a message already deleted), `errors/not_supported_by_provider`. ```json { "title": "Already connected", "detail": "This person is already a connection of the account.", "type": "errors/already_connected", "status": 422 } ``` ### 429 `errors/too_many_requests`: LinkedIn asked the account to slow down (it rests 15 minutes), its daily calls or writes are used up, or it's busy with other calls. Wait `retry_after` seconds. ```json { "title": "Too many requests", "detail": "LinkedIn asked this account to slow down.", "type": "errors/too_many_requests", "status": 429, "retry_after": 900 } ``` ### 500 `errors/provider_error`: LinkedIn answered something Direct couldn't read (nothing was written). `errors/unexpected_error`: Direct failed. ```json { "title": "Provider error", "detail": "LinkedIn answered 500.", "type": "errors/provider_error", "status": 500 } ``` ### 503 `errors/network_down`: the account's proxy or browser server didn't answer. Nothing was sent. ```json { "title": "Network down", "detail": "The account's proxy didn't connect.", "type": "errors/network_down", "status": 503 } ``` ### 504 `errors/request_timeout`: LinkedIn didn't answer in time. On a write: an unknown outcome (it may have been sent); it's never retried and its Idempotency-Key never writes again. ```json { "title": "Unknown outcome", "detail": "LinkedIn may have received this write; it isn't tried again. Check before sending it once more.", "type": "errors/request_timeout", "status": 504 } ``` --- # Lempile Direct: React to a message `POST https://direct.lempile.com/api/v1/messages/{message_id}/reaction` Adds the account's emoji reaction to a message (the message is read first: unknown answers 404). ## Authentication Send your Lempile Direct API key in the `X-API-KEY` header. ## Path parameters - `message_id` (string, required): LinkedIn's message id (`2-…`, as Direct answers it). ## Query parameters - `account_id` (string): The account that writes, when the body doesn't name it. - `dry_run` (boolean): `true`: answer the write's plan (`DryRun`, 200) and send nothing to LinkedIn. Default: `false`. ## Headers - `Idempotency-Key` (string): The same key (per account) never writes twice: a repeat answers the first answer for 7 days; a repeat while the first runs answers 409. ## Request body `application/json` (required) - `account_id` (string) - `reaction` (string, required): A native emoji, e.g. 👍. ## Example request ```bash curl -sS -X POST "https://direct.lempile.com/api/v1/messages/{message_id}/reaction?dry_run=true" \ -H "X-API-KEY: $DIRECT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "account_id": "00000000-0000-4000-8000-0000000000a1", "reaction": "👍" }' ``` ## Responses ### 200 Added, or with `?dry_run=true` the plan. ```json { "object": "MessageReactionAdded", "success": true } ``` ### 400 A required parameter missing (`errors/missing_parameters`), or one that isn't valid (`errors/invalid_parameters`, `errors/invalid_url`, `errors/content_too_large`). ```json { "title": "Missing parameters", "detail": "account_id is required.", "type": "errors/missing_parameters", "status": 400 } ``` ### 401 `errors/missing_credentials`: the `X-API-KEY` header is missing, wrong or revoked. `errors/disconnected_account`: LinkedIn signed the account out (or asks it for a security check); reconnect it. ```json { "title": "Missing credentials", "detail": "The X-API-KEY header is missing or wrong.", "type": "errors/missing_credentials", "status": 401 } ``` ### 403 LinkedIn refused it for this account (`errors/resource_access_restricted`, `errors/action_required`), or LinkedIn restricted the account (`errors/account_restricted`: every route answers it, with no LinkedIn call, until a person clears the restriction in Lempile), or the account doesn't write through Direct (`errors/insufficient_permissions`), or it needs Sales Navigator or Recruiter (`errors/feature_not_subscribed`). ```json { "title": "Access restricted", "detail": "LinkedIn refused this read for this account.", "type": "errors/resource_access_restricted", "status": 403 } ``` ### 404 `errors/resource_not_found`: an unknown or removed account, an account of another workspace (answered exactly the same), or nothing on LinkedIn with this id. ```json { "title": "Account not found", "detail": "No account with this account_id is enabled here.", "type": "errors/resource_not_found", "status": 404 } ``` ### 409 `errors/conflict`: a write with this Idempotency-Key is still running. ```json { "title": "Write in progress", "detail": "A write with this key is still running.", "type": "errors/conflict", "status": 409 } ``` ### 422 A write LinkedIn refuses, or that the checks before it refuse: `errors/already_connected`, `errors/already_invited_recently`, `errors/cannot_invite_attendee`, `errors/invalid_recipient`, `errors/cannot_resend_yet`, `errors/limit_exceeded`, `errors/connection_limit_reached`, `errors/no_connection_with_recipient`, `errors/not_allowed_inmail`, `errors/insufficient_credits`, `errors/invalid_post`, `errors/unprocessable_entity`, `errors/invalid_parameters`, `errors/invalid_message` (a voice note over 60 seconds), `errors/action_already_performed` (a message already deleted), `errors/not_supported_by_provider`. ```json { "title": "Already connected", "detail": "This person is already a connection of the account.", "type": "errors/already_connected", "status": 422 } ``` ### 429 `errors/too_many_requests`: LinkedIn asked the account to slow down (it rests 15 minutes), its daily calls or writes are used up, or it's busy with other calls. Wait `retry_after` seconds. ```json { "title": "Too many requests", "detail": "LinkedIn asked this account to slow down.", "type": "errors/too_many_requests", "status": 429, "retry_after": 900 } ``` ### 500 `errors/provider_error`: LinkedIn answered something Direct couldn't read (nothing was written). `errors/unexpected_error`: Direct failed. ```json { "title": "Provider error", "detail": "LinkedIn answered 500.", "type": "errors/provider_error", "status": 500 } ``` ### 501 `errors/feature_not_implemented`: Direct doesn't do this (yet). A Unipile client can fall back to Unipile. ```json { "title": "Missing feature", "detail": "Lempile Direct reads LinkedIn only (see /api/v1/users and /api/v1/posts).", "type": "errors/feature_not_implemented", "status": 501 } ``` ### 503 `errors/network_down`: the account's proxy or browser server didn't answer. Nothing was sent. ```json { "title": "Network down", "detail": "The account's proxy didn't connect.", "type": "errors/network_down", "status": 503 } ``` ### 504 `errors/request_timeout`: LinkedIn didn't answer in time. On a write: an unknown outcome (it may have been sent); it's never retried and its Idempotency-Key never writes again. ```json { "title": "Unknown outcome", "detail": "LinkedIn may have received this write; it isn't tried again. Check before sending it once more.", "type": "errors/request_timeout", "status": 504 } ``` --- # Lempile Direct: Remove a message reaction `DELETE https://direct.lempile.com/api/v1/messages/{message_id}/reaction` Takes the account's emoji reaction off a message. `reaction` in a JSON body or the query. ## Authentication Send your Lempile Direct API key in the `X-API-KEY` header. ## Path parameters - `message_id` (string, required): LinkedIn's message id (`2-…`, as Direct answers it). ## Query parameters - `account_id` (string): The account that writes, when the body doesn't name it. - `dry_run` (boolean): `true`: answer the write's plan (`DryRun`, 200) and send nothing to LinkedIn. Default: `false`. - `reaction` (string): The emoji, when the body doesn't name it. ## Headers - `Idempotency-Key` (string): The same key (per account) never writes twice: a repeat answers the first answer for 7 days; a repeat while the first runs answers 409. ## Request body `application/json` - `account_id` (string) - `reaction` (string, required): A native emoji, e.g. 👍. ## Example request ```bash curl -sS -X DELETE "https://direct.lempile.com/api/v1/messages/{message_id}/reaction?dry_run=true" \ -H "X-API-KEY: $DIRECT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "account_id": "00000000-0000-4000-8000-0000000000a1", "reaction": "👍" }' ``` ## Responses ### 200 Removed, or with `?dry_run=true` the plan. ```json { "object": "MessageReactionRemoved", "success": true } ``` ### 400 A required parameter missing (`errors/missing_parameters`), or one that isn't valid (`errors/invalid_parameters`, `errors/invalid_url`, `errors/content_too_large`). ```json { "title": "Missing parameters", "detail": "account_id is required.", "type": "errors/missing_parameters", "status": 400 } ``` ### 401 `errors/missing_credentials`: the `X-API-KEY` header is missing, wrong or revoked. `errors/disconnected_account`: LinkedIn signed the account out (or asks it for a security check); reconnect it. ```json { "title": "Missing credentials", "detail": "The X-API-KEY header is missing or wrong.", "type": "errors/missing_credentials", "status": 401 } ``` ### 403 LinkedIn refused it for this account (`errors/resource_access_restricted`, `errors/action_required`), or LinkedIn restricted the account (`errors/account_restricted`: every route answers it, with no LinkedIn call, until a person clears the restriction in Lempile), or the account doesn't write through Direct (`errors/insufficient_permissions`), or it needs Sales Navigator or Recruiter (`errors/feature_not_subscribed`). ```json { "title": "Access restricted", "detail": "LinkedIn refused this read for this account.", "type": "errors/resource_access_restricted", "status": 403 } ``` ### 404 `errors/resource_not_found`: an unknown or removed account, an account of another workspace (answered exactly the same), or nothing on LinkedIn with this id. ```json { "title": "Account not found", "detail": "No account with this account_id is enabled here.", "type": "errors/resource_not_found", "status": 404 } ``` ### 409 `errors/conflict`: a write with this Idempotency-Key is still running. ```json { "title": "Write in progress", "detail": "A write with this key is still running.", "type": "errors/conflict", "status": 409 } ``` ### 422 A write LinkedIn refuses, or that the checks before it refuse: `errors/already_connected`, `errors/already_invited_recently`, `errors/cannot_invite_attendee`, `errors/invalid_recipient`, `errors/cannot_resend_yet`, `errors/limit_exceeded`, `errors/connection_limit_reached`, `errors/no_connection_with_recipient`, `errors/not_allowed_inmail`, `errors/insufficient_credits`, `errors/invalid_post`, `errors/unprocessable_entity`, `errors/invalid_parameters`, `errors/invalid_message` (a voice note over 60 seconds), `errors/action_already_performed` (a message already deleted), `errors/not_supported_by_provider`. ```json { "title": "Already connected", "detail": "This person is already a connection of the account.", "type": "errors/already_connected", "status": 422 } ``` ### 429 `errors/too_many_requests`: LinkedIn asked the account to slow down (it rests 15 minutes), its daily calls or writes are used up, or it's busy with other calls. Wait `retry_after` seconds. ```json { "title": "Too many requests", "detail": "LinkedIn asked this account to slow down.", "type": "errors/too_many_requests", "status": 429, "retry_after": 900 } ``` ### 500 `errors/provider_error`: LinkedIn answered something Direct couldn't read (nothing was written). `errors/unexpected_error`: Direct failed. ```json { "title": "Provider error", "detail": "LinkedIn answered 500.", "type": "errors/provider_error", "status": 500 } ``` ### 501 `errors/feature_not_implemented`: Direct doesn't do this (yet). A Unipile client can fall back to Unipile. ```json { "title": "Missing feature", "detail": "Lempile Direct reads LinkedIn only (see /api/v1/users and /api/v1/posts).", "type": "errors/feature_not_implemented", "status": 501 } ``` ### 503 `errors/network_down`: the account's proxy or browser server didn't answer. Nothing was sent. ```json { "title": "Network down", "detail": "The account's proxy didn't connect.", "type": "errors/network_down", "status": 503 } ``` ### 504 `errors/request_timeout`: LinkedIn didn't answer in time. On a write: an unknown outcome (it may have been sent); it's never retried and its Idempotency-Key never writes again. ```json { "title": "Unknown outcome", "detail": "LinkedIn may have received this write; it isn't tried again. Check before sending it once more.", "type": "errors/request_timeout", "status": 504 } ``` --- # Lempile Direct: Create a post `POST https://direct.lempile.com/api/v1/posts` Publishes a post (public, comments open), with mentions, a link, up to 20 images or one video, as the member or as a page. Files are uploaded first (multipart). With `repost`: a repost (LinkedIn's instant repost, or with `text` a repost with those words). ## Authentication Send your Lempile Direct API key in the `X-API-KEY` header. ## Query parameters - `account_id` (string): The account that writes, when the body doesn't name it. - `dry_run` (boolean): `true`: answer the write's plan (`DryRun`, 200) and send nothing to LinkedIn. Default: `false`. ## Headers - `Idempotency-Key` (string): The same key (per account) never writes twice: a repeat answers the first answer for 7 days; a repeat while the first runs answers 409. ## Request body `application/json` (required) - `account_id` (string, required): The account that writes (or `?account_id=`). Required. - `text` (string, required): 3,000 characters at most (mentions' names and an added link count). - `mentions` (array of object): Placed in `text` with `{{0}}`, `{{1}}`… Every mention must be placed. - `name` (string, required): The text shown. - `profile_id` (string, required): A person's provider id (`ACo…`) or a company's id (digits). - `is_company` (boolean) - `external_link` (string): An http(s) link, added at the end of the text unless it's already in it. - `as_organization` (string): Write as this company page (its id, digits). The account must be an admin of the page. - `attachments` (array of string (binary)): Up to 20 images (jpg, png, gif, webp; 36 MB each) or one video (75 KB to 5 GB). - `video_thumbnail` (string (binary)): An image for the video. - `repost` (string): A post's id to repost. With no `text` (or an empty one): LinkedIn's instant repost (as a page with `as_organization`). With `text`: a repost with those words (mentions and link as for a post; no files). - `include_job_posting` (string): Answers 501. - `targeted_audience` (string): Answers 501. `multipart/form-data` (required) - `account_id` (string, required): The account that writes (or `?account_id=`). Required. - `text` (string, required): 3,000 characters at most (mentions' names and an added link count). - `mentions` (array of object): Placed in `text` with `{{0}}`, `{{1}}`… Every mention must be placed. - `name` (string, required): The text shown. - `profile_id` (string, required): A person's provider id (`ACo…`) or a company's id (digits). - `is_company` (boolean) - `external_link` (string): An http(s) link, added at the end of the text unless it's already in it. - `as_organization` (string): Write as this company page (its id, digits). The account must be an admin of the page. - `attachments` (array of string (binary)): Up to 20 images (jpg, png, gif, webp; 36 MB each) or one video (75 KB to 5 GB). - `video_thumbnail` (string (binary)): An image for the video. - `repost` (string): A post's id to repost. With no `text` (or an empty one): LinkedIn's instant repost (as a page with `as_organization`). With `text`: a repost with those words (mentions and link as for a post; no files). - `include_job_posting` (string): Answers 501. - `targeted_audience` (string): Answers 501. ## Example request ```bash curl -sS -X POST "https://direct.lempile.com/api/v1/posts?dry_run=true" \ -H "X-API-KEY: $DIRECT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "account_id": "00000000-0000-4000-8000-0000000000a1", "text": "We shipped it today. Thanks {{0}} for the review!", "mentions": [ { "name": "Bob Buyer", "profile_id": "ACoAAAzyxwvutsrqponml" } ] }' ``` ## Responses ### 200 With `?dry_run=true`: the write's plan. Nothing is sent. ```json { "object": "DryRun", "route": "string", "method": "string", "path": "string", "body": {}, "status": 0, "uploads": [ { "method": "string", "path": "string", "body": {}, "then": "string", "content_type": "string", "file": {} } ], "multiphoto": { "method": "string", "path": "string", "body": {} }, "checked": [ "string" ] } ``` ### 201 Created ```json { "object": "PostCreated", "post_id": "7389000000000000000", "id": "7389000000000000000", "share_url": "https://www.linkedin.com/feed/update/urn:li:activity:7389000000000000000/" } ``` ### 400 A required parameter missing (`errors/missing_parameters`), or one that isn't valid (`errors/invalid_parameters`, `errors/invalid_url`, `errors/content_too_large`). ```json { "title": "Missing parameters", "detail": "account_id is required.", "type": "errors/missing_parameters", "status": 400 } ``` ### 401 `errors/missing_credentials`: the `X-API-KEY` header is missing, wrong or revoked. `errors/disconnected_account`: LinkedIn signed the account out (or asks it for a security check); reconnect it. ```json { "title": "Missing credentials", "detail": "The X-API-KEY header is missing or wrong.", "type": "errors/missing_credentials", "status": 401 } ``` ### 403 LinkedIn refused it for this account (`errors/resource_access_restricted`, `errors/action_required`), or LinkedIn restricted the account (`errors/account_restricted`: every route answers it, with no LinkedIn call, until a person clears the restriction in Lempile), or the account doesn't write through Direct (`errors/insufficient_permissions`), or it needs Sales Navigator or Recruiter (`errors/feature_not_subscribed`). ```json { "title": "Access restricted", "detail": "LinkedIn refused this read for this account.", "type": "errors/resource_access_restricted", "status": 403 } ``` ### 404 `errors/resource_not_found`: an unknown or removed account, an account of another workspace (answered exactly the same), or nothing on LinkedIn with this id. ```json { "title": "Account not found", "detail": "No account with this account_id is enabled here.", "type": "errors/resource_not_found", "status": 404 } ``` ### 409 `errors/conflict`: a write with this Idempotency-Key is still running. ```json { "title": "Write in progress", "detail": "A write with this key is still running.", "type": "errors/conflict", "status": 409 } ``` ### 422 A write LinkedIn refuses, or that the checks before it refuse: `errors/already_connected`, `errors/already_invited_recently`, `errors/cannot_invite_attendee`, `errors/invalid_recipient`, `errors/cannot_resend_yet`, `errors/limit_exceeded`, `errors/connection_limit_reached`, `errors/no_connection_with_recipient`, `errors/not_allowed_inmail`, `errors/insufficient_credits`, `errors/invalid_post`, `errors/unprocessable_entity`, `errors/invalid_parameters`, `errors/invalid_message` (a voice note over 60 seconds), `errors/action_already_performed` (a message already deleted), `errors/not_supported_by_provider`. ```json { "title": "Already connected", "detail": "This person is already a connection of the account.", "type": "errors/already_connected", "status": 422 } ``` ### 429 `errors/too_many_requests`: LinkedIn asked the account to slow down (it rests 15 minutes), its daily calls or writes are used up, or it's busy with other calls. Wait `retry_after` seconds. ```json { "title": "Too many requests", "detail": "LinkedIn asked this account to slow down.", "type": "errors/too_many_requests", "status": 429, "retry_after": 900 } ``` ### 500 `errors/provider_error`: LinkedIn answered something Direct couldn't read (nothing was written). `errors/unexpected_error`: Direct failed. ```json { "title": "Provider error", "detail": "LinkedIn answered 500.", "type": "errors/provider_error", "status": 500 } ``` ### 501 `errors/feature_not_implemented`: Direct doesn't do this (yet). A Unipile client can fall back to Unipile. ```json { "title": "Missing feature", "detail": "Lempile Direct reads LinkedIn only (see /api/v1/users and /api/v1/posts).", "type": "errors/feature_not_implemented", "status": 501 } ``` ### 503 `errors/network_down`: the account's proxy or browser server didn't answer. Nothing was sent. ```json { "title": "Network down", "detail": "The account's proxy didn't connect.", "type": "errors/network_down", "status": 503 } ``` ### 504 `errors/request_timeout`: LinkedIn didn't answer in time. On a write: an unknown outcome (it may have been sent); it's never retried and its Idempotency-Key never writes again. ```json { "title": "Unknown outcome", "detail": "LinkedIn may have received this write; it isn't tried again. Check before sending it once more.", "type": "errors/request_timeout", "status": 504 } ``` --- # Lempile Direct: Retrieve a post `GET https://direct.lempile.com/api/v1/posts/{post_id}` One post (one LinkedIn call). ## Authentication Send your Lempile Direct API key in the `X-API-KEY` header. ## Path parameters - `post_id` (string, required): The post: its id (digits), `urn:li:activity:…` (or a `ugcPost`/`share` urn) or its URL. Example: `urn:li:activity:7388000000000000000`. ## Query parameters - `account_id` (string, required): The account that reads: a Lempile LinkedIn account id (`GET /accounts` lists them). Example: `00000000-0000-4000-8000-0000000000a1`. ## Example request ```bash curl -sS "https://direct.lempile.com/api/v1/posts/urn%3Ali%3Aactivity%3A7388000000000000000?account_id=00000000-0000-4000-8000-0000000000a1" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` ## Responses ### 200 OK ```json { "object": "Post", "provider": "LINKEDIN", "id": "7388000000000000000", "social_id": "urn:li:activity:7388000000000000000", "share_url": "https://www.linkedin.com/posts/ada-sender_hello-activity-7388000000000000000-abcd", "text": "Hello\nworld", "date": "2d", "parsed_datetime": "2025-10-25T23:54:22.402Z", "reaction_counter": 12, "comment_counter": 3, "repost_counter": 1, "impressions_counter": 0, "author": { "public_identifier": "ada-sender", "id": "ACoAAAbcdefghijklmnop", "name": "Ada Sender", "is_company": false, "headline": "Founder", "profile_picture_url": "https://media.licdn.com/dms/image/x/400.jpg" }, "permissions": { "can_react": true, "can_share": true, "can_post_comments": true }, "is_repost": false, "attachments": [ { "id": "D1", "type": "img", "url": "https://media.licdn.com/dms/image/x/1280.jpg", "url_expires_at": 1900000000000, "size": { "width": 1280, "height": 1280 }, "mimetype": "image/jpeg", "unavailable": false, "sticker": false } ], "mentions": [] } ``` ### 400 A required parameter missing (`errors/missing_parameters`), or one that isn't valid (`errors/invalid_parameters`, `errors/invalid_url`, `errors/content_too_large`). ```json { "title": "Missing parameters", "detail": "account_id is required.", "type": "errors/missing_parameters", "status": 400 } ``` ### 401 `errors/missing_credentials`: the `X-API-KEY` header is missing, wrong or revoked. `errors/disconnected_account`: LinkedIn signed the account out (or asks it for a security check); reconnect it. ```json { "title": "Missing credentials", "detail": "The X-API-KEY header is missing or wrong.", "type": "errors/missing_credentials", "status": 401 } ``` ### 404 `errors/resource_not_found`: an unknown or removed account, an account of another workspace (answered exactly the same), or nothing on LinkedIn with this id. ```json { "title": "Account not found", "detail": "No account with this account_id is enabled here.", "type": "errors/resource_not_found", "status": 404 } ``` ### 429 `errors/too_many_requests`: LinkedIn asked the account to slow down (it rests 15 minutes), its daily calls or writes are used up, or it's busy with other calls. Wait `retry_after` seconds. ```json { "title": "Too many requests", "detail": "LinkedIn asked this account to slow down.", "type": "errors/too_many_requests", "status": 429, "retry_after": 900 } ``` ### 500 `errors/provider_error`: LinkedIn answered something Direct couldn't read (nothing was written). `errors/unexpected_error`: Direct failed. ```json { "title": "Provider error", "detail": "LinkedIn answered 500.", "type": "errors/provider_error", "status": 500 } ``` ### 503 `errors/network_down`: the account's proxy or browser server didn't answer. Nothing was sent. ```json { "title": "Network down", "detail": "The account's proxy didn't connect.", "type": "errors/network_down", "status": 503 } ``` ### 504 `errors/request_timeout`: LinkedIn didn't answer in time. On a write: an unknown outcome (it may have been sent); it's never retried and its Idempotency-Key never writes again. ```json { "title": "Unknown outcome", "detail": "LinkedIn may have received this write; it isn't tried again. Check before sending it once more.", "type": "errors/request_timeout", "status": 504 } ``` --- # Lempile Direct: Delete a post `DELETE https://direct.lempile.com/api/v1/posts/{post_id}` Reads the post first (it must be the account's own, or a page's), then deletes it. The account's own plain repost (its `repost_id`) is undone as LinkedIn's "Delete repost" does; the reposted post stays. Answers 204 with an empty body. ## Authentication Send your Lempile Direct API key in the `X-API-KEY` header. ## Path parameters - `post_id` (string, required): The post: its id (digits), `urn:li:activity:…` (or a `ugcPost`/`share` urn) or its URL. Example: `urn:li:activity:7388000000000000000`. ## Query parameters - `account_id` (string, required): The account that writes. - `dry_run` (boolean): `true`: answer the write's plan (`DryRun`, 200) and send nothing to LinkedIn. Default: `false`. ## Headers - `Idempotency-Key` (string): The same key (per account) never writes twice: a repeat answers the first answer for 7 days; a repeat while the first runs answers 409. ## Example request ```bash curl -sS -X DELETE "https://direct.lempile.com/api/v1/posts/urn%3Ali%3Aactivity%3A7388000000000000000?dry_run=true" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` ## Responses ### 200 With `?dry_run=true`: the write's plan. Nothing is sent. ```json { "object": "DryRun", "route": "string", "method": "string", "path": "string", "body": {}, "status": 0, "uploads": [ { "method": "string", "path": "string", "body": {}, "then": "string", "content_type": "string", "file": {} } ], "multiphoto": { "method": "string", "path": "string", "body": {} }, "checked": [ "string" ] } ``` ### 204 Deleted (empty body). ### 400 A required parameter missing (`errors/missing_parameters`), or one that isn't valid (`errors/invalid_parameters`, `errors/invalid_url`, `errors/content_too_large`). ```json { "title": "Missing parameters", "detail": "account_id is required.", "type": "errors/missing_parameters", "status": 400 } ``` ### 401 `errors/missing_credentials`: the `X-API-KEY` header is missing, wrong or revoked. `errors/disconnected_account`: LinkedIn signed the account out (or asks it for a security check); reconnect it. ```json { "title": "Missing credentials", "detail": "The X-API-KEY header is missing or wrong.", "type": "errors/missing_credentials", "status": 401 } ``` ### 403 LinkedIn refused it for this account (`errors/resource_access_restricted`, `errors/action_required`), or LinkedIn restricted the account (`errors/account_restricted`: every route answers it, with no LinkedIn call, until a person clears the restriction in Lempile), or the account doesn't write through Direct (`errors/insufficient_permissions`), or it needs Sales Navigator or Recruiter (`errors/feature_not_subscribed`). ```json { "title": "Access restricted", "detail": "LinkedIn refused this read for this account.", "type": "errors/resource_access_restricted", "status": 403 } ``` ### 404 `errors/resource_not_found`: an unknown or removed account, an account of another workspace (answered exactly the same), or nothing on LinkedIn with this id. ```json { "title": "Account not found", "detail": "No account with this account_id is enabled here.", "type": "errors/resource_not_found", "status": 404 } ``` ### 409 `errors/conflict`: a write with this Idempotency-Key is still running. ```json { "title": "Write in progress", "detail": "A write with this key is still running.", "type": "errors/conflict", "status": 409 } ``` ### 422 A write LinkedIn refuses, or that the checks before it refuse: `errors/already_connected`, `errors/already_invited_recently`, `errors/cannot_invite_attendee`, `errors/invalid_recipient`, `errors/cannot_resend_yet`, `errors/limit_exceeded`, `errors/connection_limit_reached`, `errors/no_connection_with_recipient`, `errors/not_allowed_inmail`, `errors/insufficient_credits`, `errors/invalid_post`, `errors/unprocessable_entity`, `errors/invalid_parameters`, `errors/invalid_message` (a voice note over 60 seconds), `errors/action_already_performed` (a message already deleted), `errors/not_supported_by_provider`. ```json { "title": "Already connected", "detail": "This person is already a connection of the account.", "type": "errors/already_connected", "status": 422 } ``` ### 429 `errors/too_many_requests`: LinkedIn asked the account to slow down (it rests 15 minutes), its daily calls or writes are used up, or it's busy with other calls. Wait `retry_after` seconds. ```json { "title": "Too many requests", "detail": "LinkedIn asked this account to slow down.", "type": "errors/too_many_requests", "status": 429, "retry_after": 900 } ``` ### 500 `errors/provider_error`: LinkedIn answered something Direct couldn't read (nothing was written). `errors/unexpected_error`: Direct failed. ```json { "title": "Provider error", "detail": "LinkedIn answered 500.", "type": "errors/provider_error", "status": 500 } ``` ### 501 `errors/feature_not_implemented`: Direct doesn't do this (yet). A Unipile client can fall back to Unipile. ```json { "title": "Missing feature", "detail": "Lempile Direct reads LinkedIn only (see /api/v1/users and /api/v1/posts).", "type": "errors/feature_not_implemented", "status": 501 } ``` ### 503 `errors/network_down`: the account's proxy or browser server didn't answer. Nothing was sent. ```json { "title": "Network down", "detail": "The account's proxy didn't connect.", "type": "errors/network_down", "status": 503 } ``` ### 504 `errors/request_timeout`: LinkedIn didn't answer in time. On a write: an unknown outcome (it may have been sent); it's never retried and its Idempotency-Key never writes again. ```json { "title": "Unknown outcome", "detail": "LinkedIn may have received this write; it isn't tried again. Check before sending it once more.", "type": "errors/request_timeout", "status": 504 } ``` --- # Lempile Direct: List a profile's or a company's posts `GET https://direct.lempile.com/api/v1/users/{identifier}/posts` A member's posts, newest first (20 a LinkedIn call; `me` for the account's own), or with `is_company=true` a company page's (`identifier` = its id or universal name). ## Authentication Send your Lempile Direct API key in the `X-API-KEY` header. ## Path parameters - `identifier` (string, required): The person: provider id (`ACo…`), public identifier, `urn:li:fsd_profile:…`, a profile URL (URL-encoded) or `me`. Example: `ada-sender`. ## Query parameters - `account_id` (string, required): The account that reads: a Lempile LinkedIn account id (`GET /accounts` lists them). Example: `00000000-0000-4000-8000-0000000000a1`. - `limit` (integer): Items per page: 1 to 100 (default 10). Default: `10`. - `cursor` (string): A cursor a previous page gave. - `is_company` (boolean): `true`: `identifier` is a company. Default: `false`. ## Example request ```bash curl -sS "https://direct.lempile.com/api/v1/users/ada-sender/posts?account_id=00000000-0000-4000-8000-0000000000a1" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` ## Responses ### 200 OK ```json { "object": "PostList", "items": [ { "object": "Post", "provider": "LINKEDIN", "id": "7388000000000000000", "social_id": "urn:li:activity:7388000000000000000", "share_url": "https://www.linkedin.com/posts/ada-sender_hello-activity-7388000000000000000-abcd", "text": "Hello\nworld", "date": "2d", "parsed_datetime": "2025-10-25T23:54:22.402Z", "reaction_counter": 12, "comment_counter": 3, "repost_counter": 1, "impressions_counter": 0, "author": { "public_identifier": "ada-sender", "id": "ACoAAAbcdefghijklmnop", "name": "Ada Sender", "is_company": false, "headline": "Founder", "profile_picture_url": "https://media.licdn.com/dms/image/x/400.jpg" }, "permissions": { "can_react": true, "can_share": true, "can_post_comments": true }, "is_repost": false, "attachments": [ { "id": "D1", "type": "img", "url": "https://media.licdn.com/dms/image/x/1280.jpg", "url_expires_at": 1900000000000, "size": { "width": 1280, "height": 1280 }, "mimetype": "image/jpeg", "unavailable": false, "sticker": false } ], "mentions": [] } ], "paging": { "page_count": 1 }, "cursor": "eyJrIjoicG9zdHMiLCJzIjoxLCJ0IjoidG9rLTEifQ" } ``` ### 400 A required parameter missing (`errors/missing_parameters`), or one that isn't valid (`errors/invalid_parameters`, `errors/invalid_url`, `errors/content_too_large`). ```json { "title": "Missing parameters", "detail": "account_id is required.", "type": "errors/missing_parameters", "status": 400 } ``` ### 401 `errors/missing_credentials`: the `X-API-KEY` header is missing, wrong or revoked. `errors/disconnected_account`: LinkedIn signed the account out (or asks it for a security check); reconnect it. ```json { "title": "Missing credentials", "detail": "The X-API-KEY header is missing or wrong.", "type": "errors/missing_credentials", "status": 401 } ``` ### 404 `errors/resource_not_found`: an unknown or removed account, an account of another workspace (answered exactly the same), or nothing on LinkedIn with this id. ```json { "title": "Account not found", "detail": "No account with this account_id is enabled here.", "type": "errors/resource_not_found", "status": 404 } ``` ### 429 `errors/too_many_requests`: LinkedIn asked the account to slow down (it rests 15 minutes), its daily calls or writes are used up, or it's busy with other calls. Wait `retry_after` seconds. ```json { "title": "Too many requests", "detail": "LinkedIn asked this account to slow down.", "type": "errors/too_many_requests", "status": 429, "retry_after": 900 } ``` ### 500 `errors/provider_error`: LinkedIn answered something Direct couldn't read (nothing was written). `errors/unexpected_error`: Direct failed. ```json { "title": "Provider error", "detail": "LinkedIn answered 500.", "type": "errors/provider_error", "status": 500 } ``` ### 503 `errors/network_down`: the account's proxy or browser server didn't answer. Nothing was sent. ```json { "title": "Network down", "detail": "The account's proxy didn't connect.", "type": "errors/network_down", "status": 503 } ``` ### 504 `errors/request_timeout`: LinkedIn didn't answer in time. On a write: an unknown outcome (it may have been sent); it's never retried and its Idempotency-Key never writes again. ```json { "title": "Unknown outcome", "detail": "LinkedIn may have received this write; it isn't tried again. Check before sending it once more.", "type": "errors/request_timeout", "status": 504 } ``` --- # Lempile Direct: React to a post or a comment `POST https://direct.lempile.com/api/v1/posts/reaction` Adds the account's reaction (or the page's, with `as_organization`). Reacting again with another type replaces it on LinkedIn. ## Authentication Send your Lempile Direct API key in the `X-API-KEY` header. ## Query parameters - `account_id` (string): The account that writes, when the body doesn't name it. - `dry_run` (boolean): `true`: answer the write's plan (`DryRun`, 200) and send nothing to LinkedIn. Default: `false`. ## Headers - `Idempotency-Key` (string): The same key (per account) never writes twice: a repeat answers the first answer for 7 days; a repeat while the first runs answers 409. ## Request body `application/json` (required) - `account_id` (string, required): The account that writes (or `?account_id=`). Required. - `post_id` (string, required): The post: its `social_id` (`urn:li:activity:…`, or a `ugcPost`/`share` urn), its id, or its URL. - `comment_id` (string): React to this comment of the post instead (its id, digits). - `reaction_type` (string): One of: `like`, `celebrate`, `support`, `love`, `insightful`, `funny`. Default: `"like"`. - `as_organization` (string): Write as this company page (its id, digits). The account must be an admin of the page. `multipart/form-data` (required) - `account_id` (string, required): The account that writes (or `?account_id=`). Required. - `post_id` (string, required): The post: its `social_id` (`urn:li:activity:…`, or a `ugcPost`/`share` urn), its id, or its URL. - `comment_id` (string): React to this comment of the post instead (its id, digits). - `reaction_type` (string): One of: `like`, `celebrate`, `support`, `love`, `insightful`, `funny`. Default: `"like"`. - `as_organization` (string): Write as this company page (its id, digits). The account must be an admin of the page. ## Example request ```bash curl -sS -X POST "https://direct.lempile.com/api/v1/posts/reaction?dry_run=true" \ -H "X-API-KEY: $DIRECT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "account_id": "00000000-0000-4000-8000-0000000000a1", "post_id": "urn:li:activity:7388000000000000000", "reaction_type": "like" }' ``` ## Responses ### 200 With `?dry_run=true`: the write's plan. Nothing is sent. ```json { "object": "DryRun", "route": "string", "method": "string", "path": "string", "body": {}, "status": 0, "uploads": [ { "method": "string", "path": "string", "body": {}, "then": "string", "content_type": "string", "file": {} } ], "multiphoto": { "method": "string", "path": "string", "body": {} }, "checked": [ "string" ] } ``` ### 201 Created ```json { "object": "ReactionAdded" } ``` ### 400 A required parameter missing (`errors/missing_parameters`), or one that isn't valid (`errors/invalid_parameters`, `errors/invalid_url`, `errors/content_too_large`). ```json { "title": "Missing parameters", "detail": "account_id is required.", "type": "errors/missing_parameters", "status": 400 } ``` ### 401 `errors/missing_credentials`: the `X-API-KEY` header is missing, wrong or revoked. `errors/disconnected_account`: LinkedIn signed the account out (or asks it for a security check); reconnect it. ```json { "title": "Missing credentials", "detail": "The X-API-KEY header is missing or wrong.", "type": "errors/missing_credentials", "status": 401 } ``` ### 403 LinkedIn refused it for this account (`errors/resource_access_restricted`, `errors/action_required`), or LinkedIn restricted the account (`errors/account_restricted`: every route answers it, with no LinkedIn call, until a person clears the restriction in Lempile), or the account doesn't write through Direct (`errors/insufficient_permissions`), or it needs Sales Navigator or Recruiter (`errors/feature_not_subscribed`). ```json { "title": "Access restricted", "detail": "LinkedIn refused this read for this account.", "type": "errors/resource_access_restricted", "status": 403 } ``` ### 404 `errors/resource_not_found`: an unknown or removed account, an account of another workspace (answered exactly the same), or nothing on LinkedIn with this id. ```json { "title": "Account not found", "detail": "No account with this account_id is enabled here.", "type": "errors/resource_not_found", "status": 404 } ``` ### 409 `errors/conflict`: a write with this Idempotency-Key is still running. ```json { "title": "Write in progress", "detail": "A write with this key is still running.", "type": "errors/conflict", "status": 409 } ``` ### 422 A write LinkedIn refuses, or that the checks before it refuse: `errors/already_connected`, `errors/already_invited_recently`, `errors/cannot_invite_attendee`, `errors/invalid_recipient`, `errors/cannot_resend_yet`, `errors/limit_exceeded`, `errors/connection_limit_reached`, `errors/no_connection_with_recipient`, `errors/not_allowed_inmail`, `errors/insufficient_credits`, `errors/invalid_post`, `errors/unprocessable_entity`, `errors/invalid_parameters`, `errors/invalid_message` (a voice note over 60 seconds), `errors/action_already_performed` (a message already deleted), `errors/not_supported_by_provider`. ```json { "title": "Already connected", "detail": "This person is already a connection of the account.", "type": "errors/already_connected", "status": 422 } ``` ### 429 `errors/too_many_requests`: LinkedIn asked the account to slow down (it rests 15 minutes), its daily calls or writes are used up, or it's busy with other calls. Wait `retry_after` seconds. ```json { "title": "Too many requests", "detail": "LinkedIn asked this account to slow down.", "type": "errors/too_many_requests", "status": 429, "retry_after": 900 } ``` ### 500 `errors/provider_error`: LinkedIn answered something Direct couldn't read (nothing was written). `errors/unexpected_error`: Direct failed. ```json { "title": "Provider error", "detail": "LinkedIn answered 500.", "type": "errors/provider_error", "status": 500 } ``` ### 501 `errors/feature_not_implemented`: Direct doesn't do this (yet). A Unipile client can fall back to Unipile. ```json { "title": "Missing feature", "detail": "Lempile Direct reads LinkedIn only (see /api/v1/users and /api/v1/posts).", "type": "errors/feature_not_implemented", "status": 501 } ``` ### 503 `errors/network_down`: the account's proxy or browser server didn't answer. Nothing was sent. ```json { "title": "Network down", "detail": "The account's proxy didn't connect.", "type": "errors/network_down", "status": 503 } ``` ### 504 `errors/request_timeout`: LinkedIn didn't answer in time. On a write: an unknown outcome (it may have been sent); it's never retried and its Idempotency-Key never writes again. ```json { "title": "Unknown outcome", "detail": "LinkedIn may have received this write; it isn't tried again. Check before sending it once more.", "type": "errors/request_timeout", "status": 504 } ``` --- # Lempile Direct: Remove a reaction `DELETE https://direct.lempile.com/api/v1/posts/reaction` Direct's own route (Unipile has none): takes the account's reaction back. The fields go in the query or in a JSON body. ## Authentication Send your Lempile Direct API key in the `X-API-KEY` header. ## Query parameters - `account_id` (string): The account that writes, when the body doesn't name it. - `post_id` (string): The post. - `comment_id` (string): The comment, for a reaction on a comment. - `as_organization` (string): The page, for a page's reaction. - `dry_run` (boolean): `true`: answer the write's plan (`DryRun`, 200) and send nothing to LinkedIn. Default: `false`. ## Headers - `Idempotency-Key` (string): The same key (per account) never writes twice: a repeat answers the first answer for 7 days; a repeat while the first runs answers 409. ## Request body `application/json` - `account_id` (string, required): The account that writes (or `?account_id=`). Required. - `post_id` (string, required): The post, as for adding one. - `comment_id` (string): The comment, when the reaction is on a comment. - `as_organization` (string): Write as this company page (its id, digits). The account must be an admin of the page. ## Example request ```bash curl -sS -X DELETE "https://direct.lempile.com/api/v1/posts/reaction?dry_run=true" \ -H "X-API-KEY: $DIRECT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "account_id": "string", "post_id": "string", "comment_id": "string", "as_organization": "string" }' ``` ## Responses ### 200 Removed, or with `?dry_run=true` the plan. ```json { "object": "ReactionRemoved" } ``` ### 400 A required parameter missing (`errors/missing_parameters`), or one that isn't valid (`errors/invalid_parameters`, `errors/invalid_url`, `errors/content_too_large`). ```json { "title": "Missing parameters", "detail": "account_id is required.", "type": "errors/missing_parameters", "status": 400 } ``` ### 401 `errors/missing_credentials`: the `X-API-KEY` header is missing, wrong or revoked. `errors/disconnected_account`: LinkedIn signed the account out (or asks it for a security check); reconnect it. ```json { "title": "Missing credentials", "detail": "The X-API-KEY header is missing or wrong.", "type": "errors/missing_credentials", "status": 401 } ``` ### 403 LinkedIn refused it for this account (`errors/resource_access_restricted`, `errors/action_required`), or LinkedIn restricted the account (`errors/account_restricted`: every route answers it, with no LinkedIn call, until a person clears the restriction in Lempile), or the account doesn't write through Direct (`errors/insufficient_permissions`), or it needs Sales Navigator or Recruiter (`errors/feature_not_subscribed`). ```json { "title": "Access restricted", "detail": "LinkedIn refused this read for this account.", "type": "errors/resource_access_restricted", "status": 403 } ``` ### 404 `errors/resource_not_found`: an unknown or removed account, an account of another workspace (answered exactly the same), or nothing on LinkedIn with this id. ```json { "title": "Account not found", "detail": "No account with this account_id is enabled here.", "type": "errors/resource_not_found", "status": 404 } ``` ### 409 `errors/conflict`: a write with this Idempotency-Key is still running. ```json { "title": "Write in progress", "detail": "A write with this key is still running.", "type": "errors/conflict", "status": 409 } ``` ### 422 A write LinkedIn refuses, or that the checks before it refuse: `errors/already_connected`, `errors/already_invited_recently`, `errors/cannot_invite_attendee`, `errors/invalid_recipient`, `errors/cannot_resend_yet`, `errors/limit_exceeded`, `errors/connection_limit_reached`, `errors/no_connection_with_recipient`, `errors/not_allowed_inmail`, `errors/insufficient_credits`, `errors/invalid_post`, `errors/unprocessable_entity`, `errors/invalid_parameters`, `errors/invalid_message` (a voice note over 60 seconds), `errors/action_already_performed` (a message already deleted), `errors/not_supported_by_provider`. ```json { "title": "Already connected", "detail": "This person is already a connection of the account.", "type": "errors/already_connected", "status": 422 } ``` ### 429 `errors/too_many_requests`: LinkedIn asked the account to slow down (it rests 15 minutes), its daily calls or writes are used up, or it's busy with other calls. Wait `retry_after` seconds. ```json { "title": "Too many requests", "detail": "LinkedIn asked this account to slow down.", "type": "errors/too_many_requests", "status": 429, "retry_after": 900 } ``` ### 500 `errors/provider_error`: LinkedIn answered something Direct couldn't read (nothing was written). `errors/unexpected_error`: Direct failed. ```json { "title": "Provider error", "detail": "LinkedIn answered 500.", "type": "errors/provider_error", "status": 500 } ``` ### 501 `errors/feature_not_implemented`: Direct doesn't do this (yet). A Unipile client can fall back to Unipile. ```json { "title": "Missing feature", "detail": "Lempile Direct reads LinkedIn only (see /api/v1/users and /api/v1/posts).", "type": "errors/feature_not_implemented", "status": 501 } ``` ### 503 `errors/network_down`: the account's proxy or browser server didn't answer. Nothing was sent. ```json { "title": "Network down", "detail": "The account's proxy didn't connect.", "type": "errors/network_down", "status": 503 } ``` ### 504 `errors/request_timeout`: LinkedIn didn't answer in time. On a write: an unknown outcome (it may have been sent); it's never retried and its Idempotency-Key never writes again. ```json { "title": "Unknown outcome", "detail": "LinkedIn may have received this write; it isn't tried again. Check before sending it once more.", "type": "errors/request_timeout", "status": 504 } ``` --- # Lempile Direct: List a post's comments `GET https://direct.lempile.com/api/v1/posts/{post_id}/comments` A post's comments, or with `comment_id` that comment's replies: newest first by default (`MOST_RECENT`, as Unipile), or in LinkedIn's relevance order (`MOST_RELEVANT`; replies oldest first, as LinkedIn's apps read them). ## Authentication Send your Lempile Direct API key in the `X-API-KEY` header. ## Path parameters - `post_id` (string, required): The post: its id (digits), `urn:li:activity:…` (or a `ugcPost`/`share` urn) or its URL. Example: `urn:li:activity:7388000000000000000`. ## Query parameters - `account_id` (string, required): The account that reads: a Lempile LinkedIn account id (`GET /accounts` lists them). Example: `00000000-0000-4000-8000-0000000000a1`. - `limit` (integer): Items per page: 1 to 100 (default 10). Default: `10`. - `cursor` (string): A cursor a previous page gave. - `sort_by` (string): `MOST_RECENT` (the default, as Unipile's): newest first, page after page. `MOST_RELEVANT`: LinkedIn's relevance order (a comment's replies oldest first). One of: `MOST_RELEVANT`, `MOST_RECENT`. Default: `"MOST_RECENT"`. - `comment_id` (string): List this comment's replies instead (its id, digits). ## Example request ```bash curl -sS "https://direct.lempile.com/api/v1/posts/urn%3Ali%3Aactivity%3A7388000000000000000/comments?account_id=00000000-0000-4000-8000-0000000000a1" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` ## Responses ### 200 OK ```json { "object": "CommentList", "items": [ { "object": "Comment", "id": "7390000000000000001", "post_id": "7388000000000000000", "post_urn": "urn:li:activity:7388000000000000000", "author": "Bob Buyer", "author_details": { "id": "ACoAAAzyxwvutsrqponml", "headline": "Founder", "profile_url": "https://www.linkedin.com/in/bob-buyer", "profile_picture_url": "https://media.licdn.com/dms/image/x/400.jpg", "network_distance": "DISTANCE_2", "is_company": false }, "date": "2025-10-24T10:00:00.000Z", "text": "Great point", "reaction_counter": 4, "reply_counter": 1 } ], "cursor": "eyJrIjoiY29tbWVudHMiLCJzIjoyfQ", "total_items": 5, "paging": { "start": 0, "page_count": 1, "total_count": 5 } } ``` ### 400 A required parameter missing (`errors/missing_parameters`), or one that isn't valid (`errors/invalid_parameters`, `errors/invalid_url`, `errors/content_too_large`). ```json { "title": "Missing parameters", "detail": "account_id is required.", "type": "errors/missing_parameters", "status": 400 } ``` ### 401 `errors/missing_credentials`: the `X-API-KEY` header is missing, wrong or revoked. `errors/disconnected_account`: LinkedIn signed the account out (or asks it for a security check); reconnect it. ```json { "title": "Missing credentials", "detail": "The X-API-KEY header is missing or wrong.", "type": "errors/missing_credentials", "status": 401 } ``` ### 404 `errors/resource_not_found`: an unknown or removed account, an account of another workspace (answered exactly the same), or nothing on LinkedIn with this id. ```json { "title": "Account not found", "detail": "No account with this account_id is enabled here.", "type": "errors/resource_not_found", "status": 404 } ``` ### 429 `errors/too_many_requests`: LinkedIn asked the account to slow down (it rests 15 minutes), its daily calls or writes are used up, or it's busy with other calls. Wait `retry_after` seconds. ```json { "title": "Too many requests", "detail": "LinkedIn asked this account to slow down.", "type": "errors/too_many_requests", "status": 429, "retry_after": 900 } ``` ### 500 `errors/provider_error`: LinkedIn answered something Direct couldn't read (nothing was written). `errors/unexpected_error`: Direct failed. ```json { "title": "Provider error", "detail": "LinkedIn answered 500.", "type": "errors/provider_error", "status": 500 } ``` ### 503 `errors/network_down`: the account's proxy or browser server didn't answer. Nothing was sent. ```json { "title": "Network down", "detail": "The account's proxy didn't connect.", "type": "errors/network_down", "status": 503 } ``` ### 504 `errors/request_timeout`: LinkedIn didn't answer in time. On a write: an unknown outcome (it may have been sent); it's never retried and its Idempotency-Key never writes again. ```json { "title": "Unknown outcome", "detail": "LinkedIn may have received this write; it isn't tried again. Check before sending it once more.", "type": "errors/request_timeout", "status": 504 } ``` --- # Lempile Direct: Comment on a post `POST https://direct.lempile.com/api/v1/posts/{post_id}/comments` A comment, or with `comment_id` a reply, with mentions, a link and one image, as the member or as a page. ## Authentication Send your Lempile Direct API key in the `X-API-KEY` header. ## Path parameters - `post_id` (string, required): The post: its id (digits), `urn:li:activity:…` (or a `ugcPost`/`share` urn) or its URL. Example: `urn:li:activity:7388000000000000000`. ## Query parameters - `account_id` (string): The account that writes, when the body doesn't name it. - `dry_run` (boolean): `true`: answer the write's plan (`DryRun`, 200) and send nothing to LinkedIn. Default: `false`. ## Headers - `Idempotency-Key` (string): The same key (per account) never writes twice: a repeat answers the first answer for 7 days; a repeat while the first runs answers 409. ## Request body `application/json` (required) - `account_id` (string, required): The account that writes (or `?account_id=`). Required. - `text` (string, required): 1,250 characters at most. - `comment_id` (string): Reply to this comment (its id, digits). - `mentions` (array of object): Placed in `text` with `{{0}}`, `{{1}}`… Every mention must be placed. - `name` (string, required): The text shown. - `profile_id` (string, required): A person's provider id (`ACo…`) or a company's id (digits). - `is_company` (boolean) - `external_link` (string): An http(s) link, added at the end of the text unless it's already in it. - `as_organization` (string): Write as this company page (its id, digits). The account must be an admin of the page. - `attachments` (array of string (binary)): One image (jpg, png, gif or webp). `multipart/form-data` (required) - `account_id` (string, required): The account that writes (or `?account_id=`). Required. - `text` (string, required): 1,250 characters at most. - `comment_id` (string): Reply to this comment (its id, digits). - `mentions` (array of object): Placed in `text` with `{{0}}`, `{{1}}`… Every mention must be placed. - `name` (string, required): The text shown. - `profile_id` (string, required): A person's provider id (`ACo…`) or a company's id (digits). - `is_company` (boolean) - `external_link` (string): An http(s) link, added at the end of the text unless it's already in it. - `as_organization` (string): Write as this company page (its id, digits). The account must be an admin of the page. - `attachments` (array of string (binary)): One image (jpg, png, gif or webp). ## Example request ```bash curl -sS -X POST "https://direct.lempile.com/api/v1/posts/urn%3Ali%3Aactivity%3A7388000000000000000/comments?dry_run=true" \ -H "X-API-KEY: $DIRECT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "account_id": "00000000-0000-4000-8000-0000000000a1", "text": "Agreed, the second point is the one people miss." }' ``` ## Responses ### 200 With `?dry_run=true`: the write's plan. Nothing is sent. ```json { "object": "DryRun", "route": "string", "method": "string", "path": "string", "body": {}, "status": 0, "uploads": [ { "method": "string", "path": "string", "body": {}, "then": "string", "content_type": "string", "file": {} } ], "multiphoto": { "method": "string", "path": "string", "body": {} }, "checked": [ "string" ] } ``` ### 201 Created ```json { "object": "CommentSent", "comment_id": "7390000000000000009" } ``` ### 400 A required parameter missing (`errors/missing_parameters`), or one that isn't valid (`errors/invalid_parameters`, `errors/invalid_url`, `errors/content_too_large`). ```json { "title": "Missing parameters", "detail": "account_id is required.", "type": "errors/missing_parameters", "status": 400 } ``` ### 401 `errors/missing_credentials`: the `X-API-KEY` header is missing, wrong or revoked. `errors/disconnected_account`: LinkedIn signed the account out (or asks it for a security check); reconnect it. ```json { "title": "Missing credentials", "detail": "The X-API-KEY header is missing or wrong.", "type": "errors/missing_credentials", "status": 401 } ``` ### 403 LinkedIn refused it for this account (`errors/resource_access_restricted`, `errors/action_required`), or LinkedIn restricted the account (`errors/account_restricted`: every route answers it, with no LinkedIn call, until a person clears the restriction in Lempile), or the account doesn't write through Direct (`errors/insufficient_permissions`), or it needs Sales Navigator or Recruiter (`errors/feature_not_subscribed`). ```json { "title": "Access restricted", "detail": "LinkedIn refused this read for this account.", "type": "errors/resource_access_restricted", "status": 403 } ``` ### 404 `errors/resource_not_found`: an unknown or removed account, an account of another workspace (answered exactly the same), or nothing on LinkedIn with this id. ```json { "title": "Account not found", "detail": "No account with this account_id is enabled here.", "type": "errors/resource_not_found", "status": 404 } ``` ### 409 `errors/conflict`: a write with this Idempotency-Key is still running. ```json { "title": "Write in progress", "detail": "A write with this key is still running.", "type": "errors/conflict", "status": 409 } ``` ### 422 A write LinkedIn refuses, or that the checks before it refuse: `errors/already_connected`, `errors/already_invited_recently`, `errors/cannot_invite_attendee`, `errors/invalid_recipient`, `errors/cannot_resend_yet`, `errors/limit_exceeded`, `errors/connection_limit_reached`, `errors/no_connection_with_recipient`, `errors/not_allowed_inmail`, `errors/insufficient_credits`, `errors/invalid_post`, `errors/unprocessable_entity`, `errors/invalid_parameters`, `errors/invalid_message` (a voice note over 60 seconds), `errors/action_already_performed` (a message already deleted), `errors/not_supported_by_provider`. ```json { "title": "Already connected", "detail": "This person is already a connection of the account.", "type": "errors/already_connected", "status": 422 } ``` ### 429 `errors/too_many_requests`: LinkedIn asked the account to slow down (it rests 15 minutes), its daily calls or writes are used up, or it's busy with other calls. Wait `retry_after` seconds. ```json { "title": "Too many requests", "detail": "LinkedIn asked this account to slow down.", "type": "errors/too_many_requests", "status": 429, "retry_after": 900 } ``` ### 500 `errors/provider_error`: LinkedIn answered something Direct couldn't read (nothing was written). `errors/unexpected_error`: Direct failed. ```json { "title": "Provider error", "detail": "LinkedIn answered 500.", "type": "errors/provider_error", "status": 500 } ``` ### 501 `errors/feature_not_implemented`: Direct doesn't do this (yet). A Unipile client can fall back to Unipile. ```json { "title": "Missing feature", "detail": "Lempile Direct reads LinkedIn only (see /api/v1/users and /api/v1/posts).", "type": "errors/feature_not_implemented", "status": 501 } ``` ### 503 `errors/network_down`: the account's proxy or browser server didn't answer. Nothing was sent. ```json { "title": "Network down", "detail": "The account's proxy didn't connect.", "type": "errors/network_down", "status": 503 } ``` ### 504 `errors/request_timeout`: LinkedIn didn't answer in time. On a write: an unknown outcome (it may have been sent); it's never retried and its Idempotency-Key never writes again. ```json { "title": "Unknown outcome", "detail": "LinkedIn may have received this write; it isn't tried again. Check before sending it once more.", "type": "errors/request_timeout", "status": 504 } ``` --- # Lempile Direct: Delete a comment `DELETE https://direct.lempile.com/api/v1/posts/{post_id}/comments/{comment_id}` Direct's own route (Unipile has none): deletes one of the account's comments. ## Authentication Send your Lempile Direct API key in the `X-API-KEY` header. ## Path parameters - `post_id` (string, required): The post: its id (digits), `urn:li:activity:…` (or a `ugcPost`/`share` urn) or its URL. Example: `urn:li:activity:7388000000000000000`. - `comment_id` (string, required): The comment's id (digits). Example: `7390000000000000009`. ## Query parameters - `account_id` (string, required): The account that writes. - `dry_run` (boolean): `true`: answer the write's plan (`DryRun`, 200) and send nothing to LinkedIn. Default: `false`. ## Headers - `Idempotency-Key` (string): The same key (per account) never writes twice: a repeat answers the first answer for 7 days; a repeat while the first runs answers 409. ## Example request ```bash curl -sS -X DELETE "https://direct.lempile.com/api/v1/posts/urn%3Ali%3Aactivity%3A7388000000000000000/comments/7390000000000000009?dry_run=true" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` ## Responses ### 200 Deleted, or with `?dry_run=true` the plan. ```json { "object": "CommentDeleted" } ``` ### 400 A required parameter missing (`errors/missing_parameters`), or one that isn't valid (`errors/invalid_parameters`, `errors/invalid_url`, `errors/content_too_large`). ```json { "title": "Missing parameters", "detail": "account_id is required.", "type": "errors/missing_parameters", "status": 400 } ``` ### 401 `errors/missing_credentials`: the `X-API-KEY` header is missing, wrong or revoked. `errors/disconnected_account`: LinkedIn signed the account out (or asks it for a security check); reconnect it. ```json { "title": "Missing credentials", "detail": "The X-API-KEY header is missing or wrong.", "type": "errors/missing_credentials", "status": 401 } ``` ### 403 LinkedIn refused it for this account (`errors/resource_access_restricted`, `errors/action_required`), or LinkedIn restricted the account (`errors/account_restricted`: every route answers it, with no LinkedIn call, until a person clears the restriction in Lempile), or the account doesn't write through Direct (`errors/insufficient_permissions`), or it needs Sales Navigator or Recruiter (`errors/feature_not_subscribed`). ```json { "title": "Access restricted", "detail": "LinkedIn refused this read for this account.", "type": "errors/resource_access_restricted", "status": 403 } ``` ### 404 `errors/resource_not_found`: an unknown or removed account, an account of another workspace (answered exactly the same), or nothing on LinkedIn with this id. ```json { "title": "Account not found", "detail": "No account with this account_id is enabled here.", "type": "errors/resource_not_found", "status": 404 } ``` ### 409 `errors/conflict`: a write with this Idempotency-Key is still running. ```json { "title": "Write in progress", "detail": "A write with this key is still running.", "type": "errors/conflict", "status": 409 } ``` ### 422 A write LinkedIn refuses, or that the checks before it refuse: `errors/already_connected`, `errors/already_invited_recently`, `errors/cannot_invite_attendee`, `errors/invalid_recipient`, `errors/cannot_resend_yet`, `errors/limit_exceeded`, `errors/connection_limit_reached`, `errors/no_connection_with_recipient`, `errors/not_allowed_inmail`, `errors/insufficient_credits`, `errors/invalid_post`, `errors/unprocessable_entity`, `errors/invalid_parameters`, `errors/invalid_message` (a voice note over 60 seconds), `errors/action_already_performed` (a message already deleted), `errors/not_supported_by_provider`. ```json { "title": "Already connected", "detail": "This person is already a connection of the account.", "type": "errors/already_connected", "status": 422 } ``` ### 429 `errors/too_many_requests`: LinkedIn asked the account to slow down (it rests 15 minutes), its daily calls or writes are used up, or it's busy with other calls. Wait `retry_after` seconds. ```json { "title": "Too many requests", "detail": "LinkedIn asked this account to slow down.", "type": "errors/too_many_requests", "status": 429, "retry_after": 900 } ``` ### 500 `errors/provider_error`: LinkedIn answered something Direct couldn't read (nothing was written). `errors/unexpected_error`: Direct failed. ```json { "title": "Provider error", "detail": "LinkedIn answered 500.", "type": "errors/provider_error", "status": 500 } ``` ### 501 `errors/feature_not_implemented`: Direct doesn't do this (yet). A Unipile client can fall back to Unipile. ```json { "title": "Missing feature", "detail": "Lempile Direct reads LinkedIn only (see /api/v1/users and /api/v1/posts).", "type": "errors/feature_not_implemented", "status": 501 } ``` ### 503 `errors/network_down`: the account's proxy or browser server didn't answer. Nothing was sent. ```json { "title": "Network down", "detail": "The account's proxy didn't connect.", "type": "errors/network_down", "status": 503 } ``` ### 504 `errors/request_timeout`: LinkedIn didn't answer in time. On a write: an unknown outcome (it may have been sent); it's never retried and its Idempotency-Key never writes again. ```json { "title": "Unknown outcome", "detail": "LinkedIn may have received this write; it isn't tried again. Check before sending it once more.", "type": "errors/request_timeout", "status": 504 } ``` --- # Lempile Direct: List a post's reactions `GET https://direct.lempile.com/api/v1/posts/{post_id}/reactions` Who reacted to a post, or with `comment_id` to one of its comments. ## Authentication Send your Lempile Direct API key in the `X-API-KEY` header. ## Path parameters - `post_id` (string, required): The post: its id (digits), `urn:li:activity:…` (or a `ugcPost`/`share` urn) or its URL. Example: `urn:li:activity:7388000000000000000`. ## Query parameters - `account_id` (string, required): The account that reads: a Lempile LinkedIn account id (`GET /accounts` lists them). Example: `00000000-0000-4000-8000-0000000000a1`. - `limit` (integer): Items per page: 1 to 100 (default 10). Default: `10`. - `cursor` (string): A cursor a previous page gave. - `comment_id` (string): List this comment's reactions instead. ## Example request ```bash curl -sS "https://direct.lempile.com/api/v1/posts/urn%3Ali%3Aactivity%3A7388000000000000000/reactions?account_id=00000000-0000-4000-8000-0000000000a1" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` ## Responses ### 200 OK ```json { "object": "PostReactionList", "items": [ { "object": "PostReaction", "value": "PRAISE", "post_id": "7388000000000000000", "author": { "id": "ACoAAAzyxwvutsrqponml", "type": "INDIVIDUAL", "name": "Bob Buyer", "headline": "Head of Sales", "profile_url": "https://www.linkedin.com/in/bob-buyer/", "profile_picture_url": "https://media.licdn.com/dms/image/x/400.jpg", "public_identifier": "bob-buyer", "network_distance": "SECOND_DEGREE" } } ], "cursor": null, "paging": { "cursor": null, "start": 0, "page_count": 1, "total_count": 1 } } ``` ### 400 A required parameter missing (`errors/missing_parameters`), or one that isn't valid (`errors/invalid_parameters`, `errors/invalid_url`, `errors/content_too_large`). ```json { "title": "Missing parameters", "detail": "account_id is required.", "type": "errors/missing_parameters", "status": 400 } ``` ### 401 `errors/missing_credentials`: the `X-API-KEY` header is missing, wrong or revoked. `errors/disconnected_account`: LinkedIn signed the account out (or asks it for a security check); reconnect it. ```json { "title": "Missing credentials", "detail": "The X-API-KEY header is missing or wrong.", "type": "errors/missing_credentials", "status": 401 } ``` ### 404 `errors/resource_not_found`: an unknown or removed account, an account of another workspace (answered exactly the same), or nothing on LinkedIn with this id. ```json { "title": "Account not found", "detail": "No account with this account_id is enabled here.", "type": "errors/resource_not_found", "status": 404 } ``` ### 429 `errors/too_many_requests`: LinkedIn asked the account to slow down (it rests 15 minutes), its daily calls or writes are used up, or it's busy with other calls. Wait `retry_after` seconds. ```json { "title": "Too many requests", "detail": "LinkedIn asked this account to slow down.", "type": "errors/too_many_requests", "status": 429, "retry_after": 900 } ``` ### 500 `errors/provider_error`: LinkedIn answered something Direct couldn't read (nothing was written). `errors/unexpected_error`: Direct failed. ```json { "title": "Provider error", "detail": "LinkedIn answered 500.", "type": "errors/provider_error", "status": 500 } ``` ### 503 `errors/network_down`: the account's proxy or browser server didn't answer. Nothing was sent. ```json { "title": "Network down", "detail": "The account's proxy didn't connect.", "type": "errors/network_down", "status": 503 } ``` ### 504 `errors/request_timeout`: LinkedIn didn't answer in time. On a write: an unknown outcome (it may have been sent); it's never retried and its Idempotency-Key never writes again. ```json { "title": "Unknown outcome", "detail": "LinkedIn may have received this write; it isn't tried again. Check before sending it once more.", "type": "errors/request_timeout", "status": 504 } ``` --- # Lempile Direct: Search people, companies, posts or jobs `POST https://direct.lempile.com/api/v1/linkedin/search` LinkedIn's classic search in Unipile's shape: people (10 a LinkedIn call), companies (keywords only), posts (3 by default) and jobs (25 a call), by Unipile's body, by a LinkedIn search page's `url`, or by `cursor` alone. `api: sales_navigator` or `recruiter` answers 403 `errors/feature_not_subscribed`. ## Authentication Send your Lempile Direct API key in the `X-API-KEY` header. ## Query parameters - `account_id` (string, required): The account that reads: a Lempile LinkedIn account id (`GET /accounts` lists them). Example: `00000000-0000-4000-8000-0000000000a1`. - `limit` (integer): Items per page: 1 to 100 (default 10). Default: `10`. - `cursor` (string): A cursor a previous page gave. ## Request body `application/json` (required) - Option 1: CompanySearchRequest - `api` (string): One of: `classic`. Default: `"classic"`. - `category` (string, required): One of: `companies`. - `keywords` (string, required): Required. - `limit` (integer): The query's `limit` wins over this one. Default: `10`. - Option 2: PeopleSearchRequest - `api` (string): One of: `classic`. Default: `"classic"`. - `category` (string, required) - `keywords` (string) - `industry` (array of string): LinkedIn ids (digits): `GET /linkedin/search/parameters` finds them. - `location` (array of string): LinkedIn ids (digits): `GET /linkedin/search/parameters` finds them. - `company` (array of string): Current company ids: a company's employees. - `past_company` (array of string): LinkedIn ids (digits): `GET /linkedin/search/parameters` finds them. - `school` (array of string): LinkedIn ids (digits): `GET /linkedin/search/parameters` finds them. - `service` (array of string): LinkedIn ids (digits): `GET /linkedin/search/parameters` finds them. - `profile_language` (array of string) - `network_distance` (array of integer) - `connections_of` (array of string): Members' provider ids (or public identifiers: one read each). - `followers_of` (array of string): Members' provider ids (or public identifiers: one read each). - `open_to` (array of string) - `advanced_keywords` (object) - `first_name` (string) - `last_name` (string) - `title` (string) - `company` (string) - `school` (string) - Option 3: PostSearchRequest - `api` (string): One of: `classic`. Default: `"classic"`. - `category` (string, required) - `keywords` (string) - `sort_by` (string): One of: `relevance`, `date`. - `date_posted` (string): One of: `past_day`, `past_week`, `past_month`. - `content_type` (string): One of: `videos`, `images`, `live_videos`, `collaborative_articles`, `documents`, `jobs`. - `posted_by` (object) - `member` (array of string) - `company` (array of string): LinkedIn ids (digits): `GET /linkedin/search/parameters` finds them. - `me` (boolean) - `first_connections` (boolean) - `people_you_follow` (boolean) - `mentioning` (object) - `member` (array of string) - `company` (array of string): LinkedIn ids (digits): `GET /linkedin/search/parameters` finds them. - `author` (object) - `industry` (array of string): LinkedIn ids (digits): `GET /linkedin/search/parameters` finds them. - `company` (array of string): LinkedIn ids (digits): `GET /linkedin/search/parameters` finds them. - `keywords` (string) - Option 4: JobSearchRequest - `api` (string): One of: `classic`. Default: `"classic"`. - `category` (string, required) - `keywords` (string) - `sort_by` (string): One of: `relevance`, `date`. - `date_posted` (number): Days since today. - `region` (string): A location id (the search's own place). - `location` (array of string): LinkedIn ids (digits): `GET /linkedin/search/parameters` finds them. - `location_within_area` (number): Miles. - `industry` (array of string): LinkedIn ids (digits): `GET /linkedin/search/parameters` finds them. - `role` (array of string): LinkedIn ids (digits): `GET /linkedin/search/parameters` finds them. - `company` (array of string): LinkedIn ids (digits): `GET /linkedin/search/parameters` finds them. - `seniority` (array of string) - `function` (array of string) - `job_type` (array of string) - `presence` (array of string) - `easy_apply` (boolean) - `has_verifications` (boolean) - `under_10_applicants` (boolean) - `in_your_network` (boolean) - `fair_chance_employer` (boolean) - Option 5: UrlSearchRequest - `url` (string, required) - Option 6: CursorSearchRequest - `cursor` (string, required) ## Example request ```bash curl -sS -X POST "https://direct.lempile.com/api/v1/linkedin/search?account_id=00000000-0000-4000-8000-0000000000a1" \ -H "X-API-KEY: $DIRECT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "api": "classic", "category": "people", "keywords": "founder", "network_distance": [ 2 ], "company": [ "1035" ] }' ``` ## Responses ### 200 OK ```json { "object": "LinkedinSearch", "items": [ { "type": "COMPANY", "id": "1035", "name": "Example Co", "location": "Cambridge, MA", "profile_url": "https://www.linkedin.com/company/example-co/", "industry": "Software Development", "summary": "Grow better", "logo": "https://media.licdn.com/dms/image/logo1035/100.jpg", "followers_count": 1200000 }, { "type": "COMPANY", "id": "2046", "name": "Small Shop", "location": null, "profile_url": "https://www.linkedin.com/company/small-shop/", "industry": "Retail", "summary": null, "followers_count": 845 } ], "config": { "params": { "api": "classic", "category": "companies", "keywords": "x" } }, "paging": { "start": 0, "page_count": 2, "total_count": 2 }, "cursor": null } ``` ### 400 A required parameter missing (`errors/missing_parameters`), or one that isn't valid (`errors/invalid_parameters`, `errors/invalid_url`, `errors/content_too_large`). ```json { "title": "Missing parameters", "detail": "account_id is required.", "type": "errors/missing_parameters", "status": 400 } ``` ### 401 `errors/missing_credentials`: the `X-API-KEY` header is missing, wrong or revoked. `errors/disconnected_account`: LinkedIn signed the account out (or asks it for a security check); reconnect it. ```json { "title": "Missing credentials", "detail": "The X-API-KEY header is missing or wrong.", "type": "errors/missing_credentials", "status": 401 } ``` ### 403 LinkedIn refused it for this account (`errors/resource_access_restricted`, `errors/action_required`), or LinkedIn restricted the account (`errors/account_restricted`: every route answers it, with no LinkedIn call, until a person clears the restriction in Lempile), or the account doesn't write through Direct (`errors/insufficient_permissions`), or it needs Sales Navigator or Recruiter (`errors/feature_not_subscribed`). ```json { "title": "Access restricted", "detail": "LinkedIn refused this read for this account.", "type": "errors/resource_access_restricted", "status": 403 } ``` ### 404 `errors/resource_not_found`: an unknown or removed account, an account of another workspace (answered exactly the same), or nothing on LinkedIn with this id. ```json { "title": "Account not found", "detail": "No account with this account_id is enabled here.", "type": "errors/resource_not_found", "status": 404 } ``` ### 429 `errors/too_many_requests`: LinkedIn asked the account to slow down (it rests 15 minutes), its daily calls or writes are used up, or it's busy with other calls. Wait `retry_after` seconds. ```json { "title": "Too many requests", "detail": "LinkedIn asked this account to slow down.", "type": "errors/too_many_requests", "status": 429, "retry_after": 900 } ``` ### 500 `errors/provider_error`: LinkedIn answered something Direct couldn't read (nothing was written). `errors/unexpected_error`: Direct failed. ```json { "title": "Provider error", "detail": "LinkedIn answered 500.", "type": "errors/provider_error", "status": 500 } ``` ### 501 `errors/feature_not_implemented`: Direct doesn't do this (yet). A Unipile client can fall back to Unipile. ```json { "title": "Missing feature", "detail": "Lempile Direct reads LinkedIn only (see /api/v1/users and /api/v1/posts).", "type": "errors/feature_not_implemented", "status": 501 } ``` ### 503 `errors/network_down`: the account's proxy or browser server didn't answer. Nothing was sent. ```json { "title": "Network down", "detail": "The account's proxy didn't connect.", "type": "errors/network_down", "status": 503 } ``` ### 504 `errors/request_timeout`: LinkedIn didn't answer in time. On a write: an unknown outcome (it may have been sent); it's never retried and its Idempotency-Key never writes again. ```json { "title": "Unknown outcome", "detail": "LinkedIn may have received this write; it isn't tried again. Check before sending it once more.", "type": "errors/request_timeout", "status": 504 } ``` --- # Lempile Direct: Find search parameter ids `GET https://direct.lempile.com/api/v1/linkedin/search/parameters` LinkedIn's own typeahead: the ids its search filters take, for `LOCATION`, `REGION`, `PEOPLE`, `CONNECTIONS`, `COMPANY`, `SCHOOL`, `INDUSTRY`, `JOB_TITLE` and `SKILL` (one LinkedIn call). Other classic types answer 501; Sales Navigator and Recruiter types or services answer 403 `errors/feature_not_subscribed`. ## Authentication Send your Lempile Direct API key in the `X-API-KEY` header. ## Query parameters - `account_id` (string, required): The account that reads: a Lempile LinkedIn account id (`GET /accounts` lists them). Example: `00000000-0000-4000-8000-0000000000a1`. - `type` (string, required): LOCATION, REGION, PEOPLE, CONNECTIONS, COMPANY, SCHOOL, INDUSTRY, JOB_TITLE or SKILL. - `keywords` (string): What to look for (required). - `service` (string): Only CLASSIC is served. One of: `CLASSIC`, `RECRUITER`, `SALES_NAVIGATOR`. Default: `"CLASSIC"`. - `limit` (integer): Items per page: 1 to 100 (default 10). Default: `10`. ## Example request ```bash curl -sS "https://direct.lempile.com/api/v1/linkedin/search/parameters?account_id=00000000-0000-4000-8000-0000000000a1" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` ## Responses ### 200 OK ```json { "object": "LinkedinSearchParametersList", "items": [ { "object": "LinkedinSearchParameter", "id": "105015875", "title": "Paris, Île-de-France, France" } ], "paging": { "page_count": 1 } } ``` ### 400 A required parameter missing (`errors/missing_parameters`), or one that isn't valid (`errors/invalid_parameters`, `errors/invalid_url`, `errors/content_too_large`). ```json { "title": "Missing parameters", "detail": "account_id is required.", "type": "errors/missing_parameters", "status": 400 } ``` ### 401 `errors/missing_credentials`: the `X-API-KEY` header is missing, wrong or revoked. `errors/disconnected_account`: LinkedIn signed the account out (or asks it for a security check); reconnect it. ```json { "title": "Missing credentials", "detail": "The X-API-KEY header is missing or wrong.", "type": "errors/missing_credentials", "status": 401 } ``` ### 403 LinkedIn refused it for this account (`errors/resource_access_restricted`, `errors/action_required`), or LinkedIn restricted the account (`errors/account_restricted`: every route answers it, with no LinkedIn call, until a person clears the restriction in Lempile), or the account doesn't write through Direct (`errors/insufficient_permissions`), or it needs Sales Navigator or Recruiter (`errors/feature_not_subscribed`). ```json { "title": "Access restricted", "detail": "LinkedIn refused this read for this account.", "type": "errors/resource_access_restricted", "status": 403 } ``` ### 404 `errors/resource_not_found`: an unknown or removed account, an account of another workspace (answered exactly the same), or nothing on LinkedIn with this id. ```json { "title": "Account not found", "detail": "No account with this account_id is enabled here.", "type": "errors/resource_not_found", "status": 404 } ``` ### 429 `errors/too_many_requests`: LinkedIn asked the account to slow down (it rests 15 minutes), its daily calls or writes are used up, or it's busy with other calls. Wait `retry_after` seconds. ```json { "title": "Too many requests", "detail": "LinkedIn asked this account to slow down.", "type": "errors/too_many_requests", "status": 429, "retry_after": 900 } ``` ### 500 `errors/provider_error`: LinkedIn answered something Direct couldn't read (nothing was written). `errors/unexpected_error`: Direct failed. ```json { "title": "Provider error", "detail": "LinkedIn answered 500.", "type": "errors/provider_error", "status": 500 } ``` ### 501 `errors/feature_not_implemented`: Direct doesn't do this (yet). A Unipile client can fall back to Unipile. ```json { "title": "Missing feature", "detail": "Lempile Direct reads LinkedIn only (see /api/v1/users and /api/v1/posts).", "type": "errors/feature_not_implemented", "status": 501 } ``` ### 503 `errors/network_down`: the account's proxy or browser server didn't answer. Nothing was sent. ```json { "title": "Network down", "detail": "The account's proxy didn't connect.", "type": "errors/network_down", "status": 503 } ``` ### 504 `errors/request_timeout`: LinkedIn didn't answer in time. On a write: an unknown outcome (it may have been sent); it's never retried and its Idempotency-Key never writes again. ```json { "title": "Unknown outcome", "detail": "LinkedIn may have received this write; it isn't tried again. Check before sending it once more.", "type": "errors/request_timeout", "status": 504 } ``` --- # Lempile Direct: Retrieve a company page `GET https://direct.lempile.com/api/v1/linkedin/company/{identifier}` A company page by its public identifier, id, urn or link (one LinkedIn call). Its employees: `POST /linkedin/search` with `category: people` and `company: [id]`. ## Authentication Send your Lempile Direct API key in the `X-API-KEY` header. ## Path parameters - `identifier` (string, required): The company's public identifier (`example-co`), id (`1035`), urn or link. ## Query parameters - `account_id` (string, required): The account that reads: a Lempile LinkedIn account id (`GET /accounts` lists them). Example: `00000000-0000-4000-8000-0000000000a1`. ## Example request ```bash curl -sS "https://direct.lempile.com/api/v1/linkedin/company/{identifier}?account_id=00000000-0000-4000-8000-0000000000a1" \ -H "X-API-KEY: $DIRECT_API_KEY" ``` ## Responses ### 200 OK ```json { "object": "CompanyProfile", "id": "1035", "name": "Example Co", "description": "We make outbound simple.", "entity_urn": "urn:li:fsd_company:1035", "public_identifier": "example-co", "profile_url": "https://www.linkedin.com/company/example-co/", "tagline": "Grow better", "followers_count": 5400, "is_following": true, "is_employee": false, "hashtags": [ { "title": "#outbound" } ], "messaging": { "is_enabled": false }, "claimed": true, "viewer_permissions": { "canReadAdminDashboard": false }, "organization_type": "PRIVATELY_HELD", "locations": [ { "is_headquarter": true, "country": "US", "city": "Boston", "street": [ "1 Main St" ], "postalCode": "02110", "area": "MA" } ], "industry": [ "Software Development" ], "employee_count": 120, "employee_count_range": { "from": 51, "to": 200 }, "website": "https://example.com", "foundation_date": "2015" } ``` ### 400 A required parameter missing (`errors/missing_parameters`), or one that isn't valid (`errors/invalid_parameters`, `errors/invalid_url`, `errors/content_too_large`). ```json { "title": "Missing parameters", "detail": "account_id is required.", "type": "errors/missing_parameters", "status": 400 } ``` ### 401 `errors/missing_credentials`: the `X-API-KEY` header is missing, wrong or revoked. `errors/disconnected_account`: LinkedIn signed the account out (or asks it for a security check); reconnect it. ```json { "title": "Missing credentials", "detail": "The X-API-KEY header is missing or wrong.", "type": "errors/missing_credentials", "status": 401 } ``` ### 403 LinkedIn refused it for this account (`errors/resource_access_restricted`, `errors/action_required`), or LinkedIn restricted the account (`errors/account_restricted`: every route answers it, with no LinkedIn call, until a person clears the restriction in Lempile), or the account doesn't write through Direct (`errors/insufficient_permissions`), or it needs Sales Navigator or Recruiter (`errors/feature_not_subscribed`). ```json { "title": "Access restricted", "detail": "LinkedIn refused this read for this account.", "type": "errors/resource_access_restricted", "status": 403 } ``` ### 404 `errors/resource_not_found`: an unknown or removed account, an account of another workspace (answered exactly the same), or nothing on LinkedIn with this id. ```json { "title": "Account not found", "detail": "No account with this account_id is enabled here.", "type": "errors/resource_not_found", "status": 404 } ``` ### 429 `errors/too_many_requests`: LinkedIn asked the account to slow down (it rests 15 minutes), its daily calls or writes are used up, or it's busy with other calls. Wait `retry_after` seconds. ```json { "title": "Too many requests", "detail": "LinkedIn asked this account to slow down.", "type": "errors/too_many_requests", "status": 429, "retry_after": 900 } ``` ### 500 `errors/provider_error`: LinkedIn answered something Direct couldn't read (nothing was written). `errors/unexpected_error`: Direct failed. ```json { "title": "Provider error", "detail": "LinkedIn answered 500.", "type": "errors/provider_error", "status": 500 } ``` ### 501 `errors/feature_not_implemented`: Direct doesn't do this (yet). A Unipile client can fall back to Unipile. ```json { "title": "Missing feature", "detail": "Lempile Direct reads LinkedIn only (see /api/v1/users and /api/v1/posts).", "type": "errors/feature_not_implemented", "status": 501 } ``` ### 503 `errors/network_down`: the account's proxy or browser server didn't answer. Nothing was sent. ```json { "title": "Network down", "detail": "The account's proxy didn't connect.", "type": "errors/network_down", "status": 503 } ``` ### 504 `errors/request_timeout`: LinkedIn didn't answer in time. On a write: an unknown outcome (it may have been sent); it's never retried and its Idempotency-Key never writes again. ```json { "title": "Unknown outcome", "detail": "LinkedIn may have received this write; it isn't tried again. Check before sending it once more.", "type": "errors/request_timeout", "status": 504 } ``` --- # Lempile Direct: Raw LinkedIn data (reads) `POST https://direct.lempile.com/api/v1/linkedin` Unipile's raw route, for reads: a GET of one of LinkedIn's API addresses with the account's own session, paced and counted like every read. Writes (any other method, or an `action=`) answer 501: they go through Direct's own routes, each checked and dry-runnable. ## Authentication Send your Lempile Direct API key in the `X-API-KEY` header. ## Request body `application/json` (required) - `account_id` (string, required) - `request_url` (string, required) - `method` (string): One of: `GET`, `POST`, `PUT`, `PATCH`, `DELETE`. Default: `"GET"`. - `query_params` (object): Added to the address's query string. - `encoding` (boolean): `false`: query_params are added as given (not URL-encoded). Default: `true`. - `headers` (object): Ignored: the account's own session headers are sent. - `body` (object): Ignored (reads only). ## Example request ```bash curl -sS -X POST "https://direct.lempile.com/api/v1/linkedin" \ -H "X-API-KEY: $DIRECT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "account_id": "00000000-0000-4000-8000-0000000000a1", "request_url": "https://www.linkedin.com/voyager/api/me" }' ``` ## Responses ### 200 OK ```json { "object": "LinkedinRawData", "data": { "data": { "plainId": 1 } } } ``` ### 400 A required parameter missing (`errors/missing_parameters`), or one that isn't valid (`errors/invalid_parameters`, `errors/invalid_url`, `errors/content_too_large`). ```json { "title": "Missing parameters", "detail": "account_id is required.", "type": "errors/missing_parameters", "status": 400 } ``` ### 401 `errors/missing_credentials`: the `X-API-KEY` header is missing, wrong or revoked. `errors/disconnected_account`: LinkedIn signed the account out (or asks it for a security check); reconnect it. ```json { "title": "Missing credentials", "detail": "The X-API-KEY header is missing or wrong.", "type": "errors/missing_credentials", "status": 401 } ``` ### 403 LinkedIn refused it for this account (`errors/resource_access_restricted`, `errors/action_required`), or LinkedIn restricted the account (`errors/account_restricted`: every route answers it, with no LinkedIn call, until a person clears the restriction in Lempile), or the account doesn't write through Direct (`errors/insufficient_permissions`), or it needs Sales Navigator or Recruiter (`errors/feature_not_subscribed`). ```json { "title": "Access restricted", "detail": "LinkedIn refused this read for this account.", "type": "errors/resource_access_restricted", "status": 403 } ``` ### 404 `errors/resource_not_found`: an unknown or removed account, an account of another workspace (answered exactly the same), or nothing on LinkedIn with this id. ```json { "title": "Account not found", "detail": "No account with this account_id is enabled here.", "type": "errors/resource_not_found", "status": 404 } ``` ### 429 `errors/too_many_requests`: LinkedIn asked the account to slow down (it rests 15 minutes), its daily calls or writes are used up, or it's busy with other calls. Wait `retry_after` seconds. ```json { "title": "Too many requests", "detail": "LinkedIn asked this account to slow down.", "type": "errors/too_many_requests", "status": 429, "retry_after": 900 } ``` ### 500 `errors/provider_error`: LinkedIn answered something Direct couldn't read (nothing was written). `errors/unexpected_error`: Direct failed. ```json { "title": "Provider error", "detail": "LinkedIn answered 500.", "type": "errors/provider_error", "status": 500 } ``` ### 501 `errors/feature_not_implemented`: Direct doesn't do this (yet). A Unipile client can fall back to Unipile. ```json { "title": "Missing feature", "detail": "Lempile Direct reads LinkedIn only (see /api/v1/users and /api/v1/posts).", "type": "errors/feature_not_implemented", "status": 501 } ``` ### 503 `errors/network_down`: the account's proxy or browser server didn't answer. Nothing was sent. ```json { "title": "Network down", "detail": "The account's proxy didn't connect.", "type": "errors/network_down", "status": 503 } ``` ### 504 `errors/request_timeout`: LinkedIn didn't answer in time. On a write: an unknown outcome (it may have been sent); it's never retried and its Idempotency-Key never writes again. ```json { "title": "Unknown outcome", "detail": "LinkedIn may have received this write; it isn't tried again. Check before sending it once more.", "type": "errors/request_timeout", "status": 504 } ``` --- # X API: Overview > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact > Post, reply, like, repost, follow, pin and read on X from your own connected X accounts, each in its own browser with its own IP. Lempile's X API acts from **your own X accounts**: each one runs in its own browser profile, behind its own IP, signed in once in the dashboard. A call opens that account's browser and does what a person would do there: post, reply, like, repost, follow, pin, publish an Article, change its profile, or read what the account sees. Paths, fields and errors follow Unipile's where Unipile has the route. ## Before you start 1. **Connect an X account** in the dashboard: **Accounts → Connect X**, with the account's sign-in (and its code when X asks for one) or its cookies. The account then shows as Ready. 2. **Create an API key** in the dashboard: **Access Tokens → Generate a token**. Reads need `accounts.read`; writes need `accounts.write`. 3. Send the key in the `X-API-KEY` header (`?api_key=` and `Authorization: Bearer` work too). Every route takes the account as `account_id`: its Lempile id, its X user id, or its handle (`janedemo`). ## Your First Post ```bash curl -sS -X POST "https://api.lempile.com/posts" \ -H "X-API-KEY: $LEMPILE_API_KEY" \ -H "Idempotency-Key: first-post-1" \ -H "Content-Type: application/json" \ -d '{ "account_id": "janedemo", "text": "Shipping today." }' ``` ```json { "object": "PostCreated", "provider": "X", "post_id": "1850000000000000001" } ``` ## How Writes Behave - **A key per write.** Posts, replies and Articles require an `Idempotency-Key`; follows, reposts, pins and profile edits accept one. The same key with the same request replays the first answer, so a retry never posts twice. See [Write Receipts](https://lempile.com/docs/x/write-receipts). - **Not sure means not sure.** When X doesn't confirm in time, the answer is `504 errors/timeout` and the write may or may not be on X. Read `GET /writes/{key}` (the browser's answer is kept 48 hours) before sending anything again. - **A human pace.** Each account's posts, replies and Articles go out at least 45 seconds apart and 70 in 24 hours at most; replies to people who answered the account have their own 200 a day. Likes, reposts, follows, pins and deletes aren't paced. See [Errors And Limits](https://lempile.com/docs/x/errors-and-limits). - **Repeats change nothing.** Liking, reposting, following or unfollowing again answers `already: true`. - **Nothing happens on a locked account.** When X shows its lock page, every call answers `423 errors/x_account_locked` until someone passes X's check. ## What's Here | Page | Routes | | --- | --- | | [Posts](https://lempile.com/docs/x/posts) | `POST /posts`, `GET /posts/{post_id}`, `DELETE /posts/{post_id}`, `GET /posts/gifs`, pin and unpin | | [Replies](https://lempile.com/docs/x/replies) | `POST` and `GET /posts/{post_id}/comments` | | [Likes, Reposts And Follows](https://lempile.com/docs/x/likes-reposts-and-follows) | `POST /posts/reaction`, `POST /posts/repost` (and its undo), `POST /users/follow` (and its undo), likers, followers, `GET /users/me/following` | | [Search And Reads](https://lempile.com/docs/x/search-and-reads) | `GET /posts/search`, `GET /users/{identifier}/posts`, `GET /users/me/posts` | | [Profile And Analytics](https://lempile.com/docs/x/profile-and-analytics) | `PATCH /users/me/edit`, `GET /users/me`, `GET /accounts/{account_id}/analytics` | | [Page Capture](https://lempile.com/docs/x/page-capture) | `POST /accounts/{account_id}/capture`: a JPEG of a public X post, a status page or the account's own profile | | [Rebrand An X Account](https://lempile.com/docs/x/rebrand) | a whole rebrand, step by step | | [Articles](https://lempile.com/docs/x/articles) | `POST /articles`, `GET /articles/{key}` | | [Write Receipts](https://lempile.com/docs/x/write-receipts) | `GET /writes/{key}`, `POST /writes/{key}/not-sent` | | [Errors And Limits](https://lempile.com/docs/x/errors-and-limits) | every error and limit | Accounts are listed with `GET /accounts` and read with `GET /accounts/{account_id}` (`sources[].status` is `OK`, `CREDENTIALS`, `CONNECTING` or `ERROR`); neither opens a browser. --- # X API: Posts > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact > Create a post with words, images, a video or a GIF; quote a post, with files; label a sponsored post Paid partnership; read one post; delete the account's own; pin and unpin. ## Create A Post `POST /posts` (`accounts.write`, `Idempotency-Key` required) posts from the account's own X. JSON for words only: ```bash curl -sS -X POST "https://api.lempile.com/posts" \ -H "X-API-KEY: $LEMPILE_API_KEY" \ -H "Idempotency-Key: launch-post-1" \ -H "Content-Type: application/json" \ -d '{ "account_id": "janedemo", "text": "Shipping today." }' ``` `multipart/form-data` for pictures or a video: ```bash curl -sS -X POST "https://api.lempile.com/posts" \ -H "X-API-KEY: $LEMPILE_API_KEY" \ -H "Idempotency-Key: launch-post-2" \ -F account_id=janedemo \ -F "text=Before and after" \ -F attachments=@before.png \ -F attachments=@after.png ``` ```json { "object": "PostCreated", "provider": "X", "post_id": "1850000000000000001" } ``` A quote of another post, with a picture and X's **Paid partnership** label (a sponsored post): ```bash curl -sS -X POST "https://api.lempile.com/posts" \ -H "X-API-KEY: $LEMPILE_API_KEY" \ -H "Idempotency-Key: sponsor-quote-1" \ -F account_id=janedemo \ -F "text=This is the launch I'd actually use every morning." \ -F "quote=https://x.com/acmedemo/status/1850000000000000009" \ -F paid_partnership=true \ -F attachments=@meme.jpg ``` ```json { "object": "PostCreated", "provider": "X", "post_id": "1850000000000000002", "quote": { "post_id": "1850000000000000009", "confirmed": true }, "paid_partnership": { "shown": true, "sent": true } } ``` - `text`: required, up to 3,000 characters. More than 280 needs X Premium on the account: without it X keeps the post in its box, and the answer is `422 errors/not_sent` with that reason in `detail`. - `attachments` (multipart only): up to 4 images (JPEG, PNG, WebP or GIF, 8 MiB = 8,388,608 bytes each), or one MP4 of up to 50 MiB (52,428,800 bytes) on its own. Over 50 MiB in all: `413 errors/payload_too_large`, before anything is sent. - `gif`: a GIF from X's own GIF search, `{ "query": "ship it", "url": "…" }` (a JSON string in a form field). `url` is a result of `GET /posts/gifs`; the browser searches X again and refuses if that GIF is gone. Not with attachments. - `quote`: the post this one quotes, as its id (a string: an X id doesn't fit in a JSON number) or its link (`https://x.com//status/`, twitter.com too). The browser opens that post, then its Repost menu → Quote, the way a person does, so the quote can carry `attachments` (a quote made by pasting a link at the end of `text` can't). Before Post it checks that X's quote box shows the quoted post. Not with `gif`. - `paid_partnership: true`: X's own **Paid partnership** label goes on the post (the post box's Content Disclosures → Paid Partnership), for a sponsored post. Works on a plain post, with files, and on a quote. No label shown in X's post box, no post: `422 errors/not_sent` with `code: "paid_label_unavailable"`, nothing sent. `true` or `false` only (a form field takes `"true"`). - `dry_run: true`: everything but the Post button, answered `200` `{ "object": "PostDryRun", "not_sent": true }`, with what the box showed: `quote` (`{ "post_id", "author", "shown": true }`), `paid_partnership` (`{ "shown": true }`), `media` for files (`{ "ready_s": 41.2, "status": "clip.mp4: Ready" }`: how long X took to take them, and its own words) and `gif`. A dry run also checks that Post could be pressed (on, nothing over it); if not, it answers `422 errors/not_sent` with `code: "post_button_disabled"`, as the real post would stop there. `true` or `false` only. `dry_run` is part of the request, so the real post needs a new `Idempotency-Key`. A dry run that asked for `quote` or `paid_partnership` and doesn't show it answers `502 errors/not_sent` with `code: "quote_unconfirmed"` or `"paid_label_unconfirmed"`: the dry run proves nothing. `quote`, `paid_partnership` and `dry_run` are part of the request too: one `Idempotency-Key` never stands for both a labelled and an unlabelled post, or a quote and a plain post. All three are X's: another account answers `400 errors/invalid_parameters`. What the answer adds when you asked for them: - `quote: { post_id, confirmed }`: `confirmed` is `true` when X's own answer names the quoted post, `false` when it names another, `null` when it didn't say. - `paid_partnership: { shown: true, sent, app }`: the label was on in the box; `sent` is `true` when X's own request carried it, `null` when it wasn't readable; `app` is which of X's two web apps the account was shown, `"x-web"` or `"responsive-web"` (the label is in a different place in each; Lempile handles both). A dry run's `paid_partnership` has `shown` and `app`. - `warnings`: only when something asked for isn't confirmed on a post that went out (`201`, the post is live): `paid_label_unconfirmed`, `paid_label_not_sent`, `quote_unconfirmed`, `quote_not_confirmed`, each with a sentence. Check the post on X; delete it if it's wrong. When X refuses the words as already posted by the account and the request asked for `quote` or `paid_partnership`, nothing shows the post already on X carries them: the answer is `422 errors/not_sent` with `code: "duplicate_post"` and that post's link, never a success. Files go only once X has taken them: the browser waits for X's own "Ready" under each file (up to 3 minutes for a video, 40 seconds for images) and answers `422 errors/not_sent` with `code: "media_upload_failed"` (X refused the file) or `"media_upload_timeout"`, nothing sent. A long video can take longer than the request's 140 seconds: read [the receipt](https://lempile.com/docs/x/write-receipts) for its key. The browser keeps the job inside its 5 minutes: a slow upload ends as `media_upload_timeout` rather than a job stopped after Post. **Big files, and the rule for any `5xx`: read the receipt, never send again under a new key.** Until Nov 12 a request carrying more than about 5 MB of files could lose its HTTP answer (`500` with `WorkerRequestCancelled`) while the write went on: a 12.6 MB video's answer was cut 24 seconds in, and its receipt then said what X did. Files now travel once, without that cost, up to the limits above. While another post's big files are being sent, a post with files can get `429 errors/files_busy` with `retry_at`: nothing was sent, send it again then with the same key. On any `5xx` from `POST /posts`, read `GET /writes/{key}` with the same `Idempotency-Key`, or send again with the same key; a new key could post twice. A write left `pending` settles by itself within minutes (see [Write Receipts](https://lempile.com/docs/x/write-receipts)). To reply, use [`POST /posts/{post_id}/comments`](https://lempile.com/docs/x/replies). Posts are paced: at least 45 seconds after the account's last write, 70 writes in 24 hours. The request waits up to 140 seconds; past that it answers `504 errors/timeout` and [the receipt](https://lempile.com/docs/x/write-receipts) says what happened. ## Search X's GIFs `GET /posts/gifs?account_id=&q=&limit=` (`accounts.read`): X's GIF search as the composer shows it (`q` 2–40 characters, `limit` 1–24, default 12). Nothing is typed into a post. ```json { "object": "GifList", "provider": "X", "query": "ship it", "items": [{ "url": "https://media1.giphy.com/media/demoGifId/giphy.gif", "title": "Ship it", "width": 498, "height": 280 }] } ``` ## Read A Post `GET /posts/{post_id}?account_id=` (`accounts.read`): ```json { "object": "Post", "provider": "X", "id": "1850000000000000001", "author": "Jane Demo", "author_details": { "id": "janedemo", "public_identifier": "janedemo", "profile_url": "https://x.com/janedemo", "profile_picture_url": "https://pbs.twimg.com/profile_images/0/demo.jpg" }, "date": "2026-11-06T09:12:00.000Z", "text": "Shipping today.", "share_url": "https://x.com/janedemo/status/1850000000000000001", "reply_counter": 3, "comment_counter": 3, "reaction_counter": 12, "repost_counter": 1, "quote_counter": 0, "bookmark_counter": 2, "impressions_counter": 840, "user_reacted": false } ``` `quote_counter`, `bookmark_counter` and `impressions_counter` are `null` when the post's page was read instead of X's own data. ## Delete A Post `DELETE /posts/{post_id}?account_id=` (`accounts.write`) deletes one of the account's own posts or replies through X's menu on it, then opens it again to check it's gone: `200 { "object": "PostDeleted", "post_id": "…" }`. - `403 errors/not_own_post`: someone else's post. Nothing was deleted. - `404 errors/post_not_found`: missing or already deleted. - `422 errors/delete_unavailable`: X's menu, its Delete item or the confirmation didn't show. Nothing was deleted. - `504 errors/timeout`: Delete was confirmed but the post may still be there. Open it before trying again. ## Pin And Unpin `POST /accounts/{account_id}/posts/{status_id}/pin` and `/unpin` (`accounts.write`, optional `Idempotency-Key`, optional body `{ "dry_run": true }`). X keeps one pinned post, so a new pin replaces the old one. The answer comes once the profile shows it: ```json { "object": "PostPin", "provider": "X", "status": "pinned", "status_id": "1850000000000000001", "previous_pinned_id": "1840000000000000002", "already": false } ``` `status` is `pinned`, `unpinned`, `already_pinned` or `already_unpinned`. Only the account's own posts (`400 errors/not_own_post`); `502 errors/pin_unconfirmed` means check the profile before trying again. --- # X API: Replies > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact > Reply under an X post or a reply, find the post in the account's feed first, and read a post's replies. ## Reply To A Post `POST /posts/{post_id}/comments` (`accounts.write`, `Idempotency-Key` required): ```bash curl -sS -X POST "https://api.lempile.com/posts/1850000000000000001/comments" \ -H "X-API-KEY: $LEMPILE_API_KEY" \ -H "Idempotency-Key: reply-1850000000000000001-1" \ -H "Content-Type: application/json" \ -d '{ "account_id": "janedemo", "text": "Congrats on the launch.", "navigation": "timeline", "author_handle": "marclou" }' ``` ```json { "object": "CommentSent", "provider": "X", "comment_id": "1850000000000000099", "via": "timeline" } ``` - `text`: up to 1,250 characters. - `comment_id`: a reply's id, as a string of digits: the reply goes under that reply instead. - `navigation`: `timeline` looks for the post in the account's Following feed first, as a person scrolling would (give `author_handle`), then falls back to its page; `direct` opens the post's page. `via` says which happened. - `answer: true`: this answers someone who replied to the account. It counts toward its own 200 a day instead of the posts' 70. - If the post was edited, the reply goes under its latest version (`edited_from` names the id you asked for). - `comment_id` in the answer is `null` when X gave no link; the reply still went out. ### Reply With A Video Send the reply as `multipart/form-data` with one MP4 in `attachments`, up to 50 MiB (52,428,800 bytes), as a post's video: ```bash curl -sS -X POST "https://api.lempile.com/posts/1850000000000000001/comments" \ -H "X-API-KEY: $LEMPILE_API_KEY" \ -H "Idempotency-Key: reply-1850000000000000001-video-1" \ -F account_id=janedemo \ -F "text=Try it free for 7 days: https://example.com/" \ -F "attachments=@film.mp4;type=video/mp4" ``` - The reply goes only once X shows the video ready (up to 3 minutes), else `422 errors/not_sent` with `code` `media_upload_failed` or `media_upload_timeout`, nothing sent. - One video, on a reply under the post: not with `comment_id` (`501`). - The video is part of the request's `Idempotency-Key`: the same key with another file is refused. - A body over 50 MiB is refused before it is read: `413 errors/payload_too_large`. While other big files are being sent: `429 errors/files_busy` with `retry_at`, nothing sent; send it again then, same key. - LinkedIn comments take one image, never a video: a video on a LinkedIn comment answers `400 errors/invalid_parameters`. - The answer's `media` is what X showed for the video. When the browser didn't confirm it, the reply is still out and `warnings` says `video_unconfirmed`: check the reply on X. ### Dry Run Add `dry_run=true` (or `"dry_run": true` in JSON) to do everything but press Reply: the browser reaches the post, types the text, attaches the video and checks Reply could be pressed, then closes the tab. Nothing is sent. - The answer is `200` with `object` `CommentDryRun`, `not_sent: true` and, with a video, `media` (X's own words for it and the seconds until Ready). A dry run that doesn't show the video it was asked to attach answers `502 errors/not_sent` with `code` `video_unconfirmed`. - The key is free again, and a dry run isn't one of the account's writes. It is still paced like one: send it outside the account's planned posts. - `dry_run` is part of the request's `Idempotency-Key`: a dry run's key never stands for a real reply. - X replies under a post only: not with `comment_id` (`501`), not on LinkedIn (`400`). When the post's author limits who can reply, nothing is sent: `422 errors/not_sent`, with that reason in `detail`. Replies share the posts' pace and their `504 errors/timeout` rule: read the [receipt](https://lempile.com/docs/x/write-receipts) before sending again. ## Read A Post's Replies `GET /posts/{post_id}/comments?account_id=&limit=&sort_by=&comment_id=` (`accounts.read`): the replies the post's page shows (`limit` up to 100, default 50). - `sort_by`: `MOST_RECENT` (the default) puts them newest first by `date`; `MOST_RELEVANT` keeps X's own order. - `comment_id`: a reply's id. Its own replies come back instead. - `cursor`: X's replies come in one page, so a cursor answers `400 errors/invalid_parameters`; every answer's `cursor` is `null`. ```json { "object": "CommentList", "total_items": 1, "cursor": null, "items": [{ "object": "Comment", "post_id": "1850000000000000001", "id": "1850000000000000099", "author": "Sam Doe", "text": "Congrats on the launch.", "date": "2026-11-06T09:30:00.000Z" }] } ``` --- # X API: Likes, Reposts And Follows > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact > Like, repost (and undo a repost), follow and unfollow from an X account, and read who liked its posts, who follows it and whom it follows. Repeats change nothing: liking, reposting, undoing a repost, following or unfollowing again answers `already: true`. None of these are paced. ## Like A Post `POST /posts/reaction` (`accounts.write`) with `{ account_id, post_id, comment_id?, reaction_type?, navigation?, author_handle? }`. X has only `like` (the default). To like a reply, pass its id as `comment_id` (or as `post_id`). ```json { "object": "ReactionAdded", "provider": "X", "post_id": "1850000000000000001", "reaction_type": "like", "already": false } ``` `422 errors/like_not_kept` means X undid the like; `502 errors/like_unconfirmed` means open the post before liking again. ## Repost A Post `POST /posts/repost` (`accounts.write`, optional `Idempotency-Key`) with `{ account_id, post_id, navigation?, author_handle? }`: a plain repost. ```json { "object": "PostReposted", "provider": "X", "post_id": "1850000000000000001", "already": false } ``` `502 errors/repost_unconfirmed` or `504`: check the post; reposting again changes nothing. ## Undo A Repost The same route with `undo: true` takes the account's repost back: the browser presses the post's green Repost button, then X's **Undo repost**, and answers once the post shows its plain Repost button again. `post_id` is the reposted post's own id (the one the account reposted, not a repost id). ```json { "account_id": "janedemo", "post_id": "1850000000000000001", "undo": true } ``` ```json { "object": "PostUnreposted", "provider": "X", "post_id": "1850000000000000001", "already": false } ``` A post the account hasn't reposted answers `already: true` with nothing pressed. `undo` is `true` or `false`; any other value answers `400` (it's never read as a repost). Keys and receipts work as for a repost; an undo's fingerprint differs from the repost's, so one key never covers both. `422 errors/repost_unavailable`: X didn't offer Undo repost, nothing changed. `502 errors/repost_unconfirmed` or `504`: check the post; undoing again changes nothing. On a LinkedIn post, `undo` answers `501 errors/feature_not_implemented`. ## Follow An Account `POST /users/follow` (`accounts.write`, optional `Idempotency-Key`) with `{ account_id, identifier }`, `identifier` being the X handle, with or without `@`: ```json { "object": "UserFollowed", "provider": "X", "identifier": "marclou", "already": false } ``` `429 errors/follow_limited` means X says the account can't follow more people right now. ## Unfollow An Account The same route with `undo: true` unfollows the account: the browser presses the profile's own **Following** button, then X's **Unfollow**, and answers once the profile shows its **Follow** button again. ```json { "account_id": "janedemo", "identifier": "marclou", "undo": true } ``` ```json { "object": "UserUnfollowed", "provider": "X", "identifier": "marclou", "already": false } ``` An account it doesn't follow answers `already: true` with nothing pressed. `undo` is `true` or `false`; any other value answers `400` (it's never read as a follow). Keys and receipts work as for a follow; an unfollow's fingerprint differs from the follow's, so one key never covers both. `422 errors/unfollow_unavailable`: X showed no Following button, nothing changed. `422 errors/unfollow_unconfirmed`: X didn't ask to confirm, nothing changed. `502 errors/unfollow_unconfirmed` or `504`: check the profile; unfollowing again changes nothing. A LinkedIn account answers `501 errors/feature_not_implemented`. ## Who Liked A Post `GET /posts/{post_id}/reactions?account_id=&limit=` (`accounts.read`, `limit` 1–200, default 100): X shows a post's likers to its author only, so this works on the account's own posts. ```json { "object": "ReactionList", "provider": "X", "post_id": "1850000000000000001", "total_items": 1, "cursor": null, "items": [{ "object": "Reaction", "value": "LIKE", "author": { "id": "1700000000000000000", "public_identifier": "samdoe", "name": "Sam Doe", "profile_url": "https://x.com/samdoe" } }] } ``` ## The Account's Followers `GET /users/followers?account_id=&limit=` (`accounts.read`, `limit` 1–1000, default 100): its newest followers first. ```json { "object": "UserFollowerList", "provider": "X", "cursor": null, "items": [{ "object": "UserFollower", "id": "1700000000000000000", "public_identifier": "samdoe", "name": "Sam Doe", "profile_url": "https://x.com/samdoe" }] } ``` ## Whom The Account Follows `GET /users/me/following?account_id=&limit=` (`accounts.read`, `limit` 1–1000, default 100): the accounts it follows, newest follow first. Also at `/users/following`, the twin of `/users/followers`. ```json { "object": "UserFollowingList", "provider": "X", "cursor": null, "items": [{ "object": "UserFollowing", "id": "marclou", "public_identifier": "marclou", "name": "Marc Lou", "profile_url": "https://x.com/marclou" }] } ``` A LinkedIn account answers `501 errors/feature_not_implemented`. These reads use X's own data first and the page when that fails, and never click, like or follow. --- # X API: Search And Reads > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact > X search on the Latest tab, a profile's newest posts, and the account's own posts, replies and reposts. Read-only: nothing is clicked, typed or followed. ## Search Posts `GET /posts/search?account_id=&q=&limit=` (`accounts.read`): the latest posts for a search, as the account sees X's Latest tab, newest first, reposts left out. `q` takes X's search words and operators (up to 300 characters); `limit` is 1–50, default 20. ```bash curl -sS "https://api.lempile.com/posts/search?account_id=janedemo&q=%22just%20launched%22%20min_faves%3A50&limit=10" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ```json { "object": "PostList", "provider": "X", "query": "\"just launched\" min_faves:50", "items": [ { "object": "Post", "id": "1850000000000000001", "...": "as in Read A Post" } ] } ``` `422 errors/search_not_loaded` means X showed neither posts nor its no-results notice; it's an error, never an empty list. ## A Profile's Posts `GET /users/{identifier}/posts?account_id=&limit=` (`accounts.read`): an X profile's newest posts, reposts left out (`identifier` is the handle; `limit` default 20, at most 100). It comes in one page: a `cursor` answers `400 errors/invalid_parameters`, and the answer's `cursor` is always `null`. An empty list means no post showed within 25 seconds. `404 errors/user_not_found` when there's no such profile. There's no read of another X profile (`GET /users/{identifier}` is LinkedIn's). The account's own profile is `GET /users/me` ([Profile And Analytics](https://lempile.com/docs/x/profile-and-analytics#read-the-profile)). ## The Account's Own Posts `GET /users/me/posts?account_id=&kind=&limit=&cursor=` (`accounts.read`): the account's own posts, replies or reposts, newest first, from its profile's tabs. This is what a rebrand deletes or undoes ([Rebrand An X Account](https://lempile.com/docs/x/rebrand)). | `kind` | From | Each item has | | --- | --- | --- | | `posts` (default) | its Posts tab | `pinned: true` on the pinned post | | `replies` | its Replies tab | `in_reply_to`: the post it answers | | `reposts` | its Posts tab | `reposted_id`: the post it reposted, for `POST /posts/repost` with `undo: true` | ```json { "object": "OwnPostList", "provider": "X", "account_id": "11111111-1111-4111-8111-111111111111", "kind": "reposts", "items": [{ "object": "OwnPost", "id": "1850000000000000003", "kind": "repost", "text": "Shipped my app", "created_at": "2026-11-07T09:00:00.000Z", "reposted_id": "1700000000000000009" }], "cursor": "1850000000000000003" } ``` - `limit` is 1–100, default 20. `cursor` is `null` at the end; otherwise pass it back as `cursor` for the next page. It still works after you deleted the post it names: the next page starts from the posts older than it. - A repost's `id` is the repost itself; `text` is the reposted post's. - X's own data is read first; when it can't be had, the tab itself is read while it's scrolled like a person. Nothing is clicked. - `422 errors/timeline_not_loaded` means the profile showed neither posts nor its empty notice: it's an error, never an empty list. On a LinkedIn account, `/users/me/posts` is `/users/{identifier}/posts`, as before. --- # X API: Profile And Analytics > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact > Edit the X profile (pictures, name, bio, location, website, handle), read it back, and read the account's own analytics by day. ## Edit The Profile `PATCH /users/me/edit` (or `POST`; `accounts.write`, optional `Idempotency-Key`), Unipile's "Edit own profile". Give any of these fields; the ones you leave out stay as they are: | Field | Unipile's name | What X takes | | --- | --- | --- | | `name` | | 1 to 50 characters, one line. | | `bio` | `summary` | Up to 160 characters, line breaks kept. `""` clears it. | | `location` | | Up to 30 characters, one line. `""` clears it. | | `website` | `custom_link: { url, type: "WEBSITE" }` | One https address, up to 100 characters, a host with a dot, no spaces or credentials. It can't be emptied. | | `avatar` | `picture` | A JPEG or PNG of at most 2 MB. | | `banner` | `cover_picture` | A JPEG or PNG of at most 5 MB (the header photo). | | `username` | | The new handle: 4 to 15 letters, digits or `_`, with or without `@`. | | `dry_run` | | `true` reads everything and presses nothing. | Characters are counted as X counts them (an emoji is 2). `account_id` goes in the body. A field the profile doesn't have (`headline`, `experience`…) or another `type` than `X` answers `501 errors/feature_not_implemented`, with nothing changed; `dry_run` and every field are checked before the browser opens (`400 errors/invalid_parameters`). Pictures go as files in a `multipart/form-data` body, as Unipile sends them: ```bash curl -sS -X PATCH "https://api.lempile.com/users/me/edit" \ -H "X-API-KEY: $LEMPILE_API_KEY" \ -H "Idempotency-Key: rebrand-janedemo-1" \ -F account_id=janedemo -F type=X \ -F name="LAUNCH WIRE" -F bio="Every launch worth knowing, as it ships." \ -F location="" -F website="https://launchwire.example" \ -F avatar=@avatar.png -F banner=@header.jpg -F username=launchwire ``` or in JSON, each picture as `{ name, content_type, data_base64 }` (the file's bytes in base64, no `data:` prefix). Either way, the type is read from the file's own bytes: a GIF or WebP answers `400`. ```json { "account_id": "janedemo", "name": "LAUNCH WIRE", "username": "@launchwire", "avatar": { "name": "avatar.png", "content_type": "image/png", "data_base64": "iVBORw0KGgo…" } } ``` The browser reads X's Edit profile, gives it the pictures (through X's own crop window, as is), types each field that isn't already as asked, checks the others unchanged, presses Save, and reads everything back on a fresh window. The handle comes last, on X's Change username page: typed, X's own check that it's free waited for, saved, read back. The answer says what X keeps: ```json { "object": "ProfileEdited", "provider": "X", "account_id": "11111111-1111-4111-8111-111111111111", "changed": { "name": "LAUNCH WIRE", "bio": "Every launch worth knowing, as it ships.", "avatar": "https://pbs.twimg.com/profile_images/2/new.jpg", "username": "launchwire" }, "previous": { "name": "Jane Demo", "bio": "Building in public.", "avatar": "https://pbs.twimg.com/profile_images/1/old.jpg", "username": "janedemo" }, "already": ["location", "website"], "avatar_changed": true, "banner_changed": true, "username": "launchwire" } ``` - `already` lists the fields that were already as asked: nothing was typed for them. Pictures are always given again (X can't tell they're the same). - `avatar_changed` / `banner_changed` compare the addresses X serves the pictures from before and after Save (`null` when unreadable). - A dry run answers `ProfileEditDryRun` with `current`, `would_change`, `already` and `checks` (`save_button`, `photo_inputs`, `username_field`, `password_required`). - After a new handle, Lempile's own record of the account follows in the same request (`GET /accounts` shows it). The old handle no longer works as `account_id`: use the Lempile id. - On a verified account, a new name, avatar or handle removes the checkmark until X reviews the account again. X asks at Save, and Lempile confirms that notice: the edit is what you asked. Any other sheet X shows is left alone, and the answer quotes it (`X said: …`). **`website` alone** is the Website edit, as before: its answer is `{ "object": "ProfileEdited", "provider": "X", "website": "…", "previous_website": "…", "already": false }`, and a dry run's `{ "object": "ProfileEditDryRun", "website": "…", "would": "set" | "already_set" }`. **Time.** A website or a few words take under a minute. Pictures and a handle can take a few minutes: the request waits 140 seconds, then answers `504 errors/timeout` while the browser goes on (up to 10 minutes). Send an `Idempotency-Key` and read `GET /writes/{key}` until it's `done` or `failed`; without one, read the profile (`GET /users/me`) before trying again. | HTTP | Type | Meaning | | --- | --- | --- | | `400` | `errors/invalid_parameters`, `errors/invalid_*` | A field X wouldn't take. Nothing was changed. | | `403` | `errors/password_required` | X asks for the account's password to change the handle. Lempile never types it: the handle wasn't changed. | | `409` | `errors/username_taken` | X says the handle isn't free. The handle wasn't changed. | | `422` | `errors/username_field_not_found` | X's Change username page shows no Username field, as while an X Premium check is under review. | | `422` | `errors/username_refused`, `errors/username_check_failed`, `errors/username_not_kept` | X refused the handle, never said, or kept the old one. | | `422` | `errors/profile_photo_input_not_found`, `errors/profile_photo_not_taken` | X's file picker or crop window didn't show. Nothing was saved. | | `422` | `errors/profile_field_not_found`, `errors/profile_fields_changed`, `errors/profile_save_unavailable`, `errors/typing_failed` | The Edit profile window wasn't as expected. Nothing was saved. | | `422` | `errors/profile_value_not_kept` | Saved, but X keeps another value (`detail` says which, and what X said). | | `502` | `errors/profile_unconfirmed`, `errors/username_unconfirmed` | Saved, but not read back: not sure. Read the profile before trying again. | | `504` | `errors/timeout` | Still running, or not sure: read the receipt. | A refusal after the Edit profile part was saved (the handle failed) carries `done`: what X keeps from that part. ## Read The Profile `GET /users/me?account_id=` (`accounts.read`) on an X account: the profile as X's Edit profile window and Change username page show it. The browser reads them and presses nothing (it's a dry run of the edit). ```json { "object": "AccountOwnerProfile", "provider": "X", "account_id": "11111111-1111-4111-8111-111111111111", "name": "LAUNCH WIRE", "username": "launchwire", "public_identifier": "launchwire", "public_profile_url": "https://x.com/launchwire", "bio": "Every launch worth knowing, as it ships.", "location": null, "website": "https://launchwire.example", "profile_picture_url": "https://pbs.twimg.com/profile_images/2/new.jpg", "cover_picture_url": "https://pbs.twimg.com/profile_banners/9/1700000000", "can_change_username": true } ``` Empty fields are `null`. `can_change_username` is `false` when X's Change username page shows no Username field or asks for the password. When X shows another handle than Lempile has on record, the record follows. ## Daily Analytics `GET /accounts/{account_id}/analytics?from=YYYY-MM-DD&to=YYYY-MM-DD` (`accounts.read`): the account's own analytics by UTC day, read from its analytics page (x.com/i/account_analytics, which needs X Premium). Complete days only: `to` is capped at yesterday (UTC); at most 365 days. ```json { "account_id": "11111111-1111-4111-8111-111111111111", "object": "AccountAnalytics", "provider": "X", "from": "2026-11-01", "to": "2026-11-01", "read_at": "2026-11-07T08:00:00Z", "days": [{ "date": "2026-11-01", "impressions": 1520, "likes": 34, "replies": 6, "reposts": 2, "quotes": 0, "bookmarks": 3, "profile_visits": 41, "posts": 3, "replies_sent": 12, "quotes_sent": 0, "new_follows": 4, "unfollows": 1, "engagements": null, "engagement_rate": null, "shares": null }], "totals": { "impressions": 1520, "...": "the same keys, added up" }, "followers": { "total": 812, "verified": 40, "active": 300 } } ``` - Each count is X's own daily series (`impressions` is X's "Displayed"; `posts`, `replies_sent` and `quotes_sent` are what the account wrote). A type with no entry on a day is `0`; `new_follows` and `unfollows` are `null` on a day X's follow chart doesn't list. - `engagements`, `engagement_rate` and `shares` are always `null`: X has them by the hour only. - `422 errors/analytics_unavailable`: X doesn't show this account analytics yet (for instance under its follower floor). `502 errors/analytics_not_loaded`: no Premium, or the page didn't finish. Never an empty answer. --- # X API: Page Capture > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact > A JPEG of one page from the X account's own browser: a public X post cropped to the post, a company blog, outlet or data page cropped to its headline, a status page, the account's own profile, one of its "followed you" notifications with the names blurred, or a news page. `POST /accounts/{account_id}/capture` (`accounts.write`): a picture of one page, opened in the X account's own browser and proxy. Read-only: the browser opens the page in a new tab, hides cookie banners and X's own overlays with CSS (it never clicks them, so nothing is accepted or dismissed), takes a JPEG and closes the tab. Nothing is clicked or typed. It isn't a write: no `Idempotency-Key`, no receipt, not paced. ## What It Opens Only these addresses, written exactly so. Anything else answers `400 errors/invalid_parameters` (listing them) before any browser opens. | Page | The address | The picture | | --- | --- | --- | | A public X post | `https://x.com//status/`: a handle of 1 to 15 letters, digits or `_` (not `i`), 1 to 25 digits, and nothing after: no query (`?s=20`), no fragment, no trailing slash, no `/photo/1`. `x.com` only: not `twitter.com`, `www.x.com` or `mobile.x.com`. | The post alone, read from the account's own signed-in X. | | A status page | `https://`, `https:///` or `https:///incidents/` (8 to 40 letters or digits), no query or fragment, on `www.vercel-status.com`, `www.githubstatus.com`, `status.supabase.com`, `www.cloudflarestatus.com`, `status.openai.com`, `status.claude.com`, `www.netlifystatus.com`, `status.render.com`, `status.flyio.net`, `status.clerk.com` or `resend-status.com`. | The page from its top, or `clip.selector`. | | The account's own X | `https://x.com/` and `https://x.com/i/account_analytics`. | From the top. | | The account's own notifications | `https://x.com/notifications` exactly: no tab (`/mentions`), no query, fragment or trailing slash. | One "followed you" notification, every name blurred (see [Notifications](#notifications)). | | News pages | Any page on `blog.google`, `developers.google.com`, `blogs.bing.com`, `www.seroundtable.com` or `techcrunch.com`; on Hacker News, `https://news.ycombinator.com/item?id=` only. | From the top, or `clip.selector`. | | Story sources: company blogs and changelogs | Any page on `openai.com`, `deepmind.google`, `developers.googleblog.com`, `github.blog`, `vercel.com`, `blog.cloudflare.com`, `supabase.com`, `stripe.com`, `huggingface.co`, `cursor.com`, `blog.replit.com`, `railway.com`, `neon.com`, `developer.apple.com`, `blogs.nvidia.com` or `aws.amazon.com`. On `github.com`, a repository's releases only: `///releases`, `/releases/latest` or `/releases/tag/`. On `replit.com`, `/blog` and `/blog/` only (where `blog.replit.com` sends its posts). | The headline's area (see [Story Sources](#story-sources)), or `clip.selector`. | | Story sources: outlets | Any page on `www.theverge.com`, `arstechnica.com`, `www.wired.com`, `www.theregister.com`, `9to5mac.com`, `www.bloomberg.com`, `www.theinformation.com`, `www.404media.co` or `www.platformer.news`. | The headline's area, or `clip.selector`. | | Story sources: data pages | A package's page on `www.npmjs.com` (`/package/`, `/package/@/`, optionally `/v/`); any page on `pypistats.org`; an app's page on `apps.apple.com` (`//app//id`); a post or product page on `www.producthunt.com` (`/posts/`, `/products/`, `/products//launches/`). | The headline's area, or `clip.selector`. | | Sites added for your workspace | Any page on a site Lempile added to your workspace's list. | From the top, or `clip.selector`. | Hosts are matched exactly: `x.com.evil.com`, `status.claude.com.evil.com`, `www.openai.com` or another subdomain is refused. On a host that opens only some pages (`github.com`, `replit.com`, `www.npmjs.com`, `apps.apple.com`, `www.producthunt.com`), the address has no query and no fragment. `status.anthropic.com` and the bare `githubstatus.com`, `vercel-status.com`, `cloudflarestatus.com` and `netlifystatus.com` redirect elsewhere: use the address above. The browser checks the address again before it opens it and after the page loads, so a page that goes to another address is never captured (`left_allowed_hosts`). ### X Posts The post is opened from the account's own signed-in X (never a signed-out view) and the picture is the post's own article on its page, found by X's markup and the post's own link, never by its words: no other post of the conversation, and the reply box and X's header, bars, sheets and floating buttons hidden. It ends at the post's action bar (reply, repost, like, bookmark, share), without X's sort row under it, and the author's Subscribe and Follow buttons are hidden, like a plain screenshot of the post. With `x_post: { counts: false }`, the post's time and views row and its action bar are hidden too, and the picture ends 16 px under its last content (its text, media or quoted post): no views, replies, reposts, likes or bookmarks. The post is captured only when X shows it under the handle in the address; otherwise nothing is captured: | `code` | What X showed | | --- | --- | | `x_post_author_mismatch` | The post under another handle (X's own address for it, or the author on the post), or no author it could read. | | `x_post_protected` | A protected account's post, whether the account can see it or not. | | `x_post_deleted` | X's "this page doesn't exist": the post was deleted, or never posted. | | `x_post_age_restricted` | The post only behind an age or sensitive-content warning. Lempile never clicks through one. | | `x_post_unavailable` | X's "This post is unavailable" notice (a suspended author, X's rules, withheld…). | | `x_post_not_loaded` | X ran but didn't show the post within 25 seconds; `detail` quotes what X showed. Try again later. | ### Notifications `https://x.com/notifications` is opened from the account's own signed-in X, and the picture is one "followed you" notification, never the page: the newest one X shows with at least `x_notifications.min_others` others (default 0, any). It is found by X's own markup for a notification, never inside a post that quotes the words. Before the picture, every name in it is blurred (an emoji in a name too), so is any other text that isn't X's own words (a time, a label), and every avatar too unless `x_notifications.blur_avatars` is `false`. X's header, tabs and bars are hidden. All of it is CSS in that tab: nothing is posted, typed or clicked. Right before the picture and again right after it, the browser reads which words in the notification are still on show. Only X's own may be ("and 12 others followed you", in English or French). When anything else is readable, or a name isn't blurred, no picture is returned (`names_not_blurred`). The answer's `notification` says what was pictured: `kind` (`followed`), `others` (the number X writes in "and N others", or how many more people it names: "Alice and Bob followed you" is 1), `names_blurred` (always `true`) and `avatars_blurred`. Opening the page clears the account's unread notifications badge on X, as any visit does. Nothing else changes. | `code` | What X showed | | --- | --- | | `x_no_follow_notification` | No "followed you" notification with at least `min_others` others among the ones X showed first. Try again later. | | `names_not_blurred` | A word other than X's own stayed readable in the notification, before or right after the picture: no picture. `detail` says what, as counts (how many texts, how many in a link), never the words. | | `x_notification_not_loaded` | X drew the notification again, or dropped it, before the picture. Try again. | ### Story Sources The picture is the article's headline area, not the whole page: the kicker (a section or a date) right above the title, the title, the dek, the byline and the lead picture under them, ending at the picture's bottom edge and never going into the body. A company blog, changelog or data page with no lead picture goes on into its first lines, until the picture is about three quarters as tall as it is wide, and ends at a paragraph's end. A data page's chart counts as its lead picture. The picture is the article's own column (at a phone width, usually the page's whole width). The area's pictures load first (6 seconds at most). A page with no headline is pictured from its top. `clip.selector` crops to that element instead. The answer's `crop` says which: `article`, `element` or `page`. Before the picture, every fixed or sticky layer outside the headline is hidden with CSS: cookie and consent banners, newsletter pop-ups, sticky headers, paywall overlays and chat buttons, along with the usual ad slots, and a scroll lock is released. Nothing is clicked, so nothing is accepted, dismissed or signed into. Another layer that still covers the headline is hidden too, unless it carries a wall's words. Some pages are refused instead of pictured: | `code` | `blocked_by` | What the page showed | | --- | --- | --- | | `page_blocked` | `bot_check` | A bot check (Cloudflare's "Just a moment", a captcha, "Are you a robot?") that didn't pass by itself within 16 seconds. It is never clicked. Trying again later can help. | | `page_blocked` | `paywall` | A paywall over the headline (a layer with "Subscribe to continue reading" or the like), a blurred headline, or a page with no headline under a paywall. | | `page_blocked` | `consent` | A consent wall over the headline that CSS couldn't hide. It is never accepted. | | `page_error` | | The page answered an HTTP error (a `404`, a `504` from the host). | ## Request | Field | | | --- | --- | | `url` | Required. One of the addresses above. | | `width` | CSS pixels, a whole number from 320 to 1280. Default 520 (under 768, X and most sites draw their phone layout). | | `dpr` | Device pixel ratio, 1 to 3. Default 2: the JPEG is twice the CSS size. | | `clip.maxHeight` | CSS pixels, 100 to 4000. Default 1600: the picture stops there. `clip.max_height` works too. | | `clip.selector` | A CSS selector of at most 200 characters: the picture is that element. Not on an X post (`400`): a post is always cropped to the post. On a story source page it replaces the headline's area. | | `x_post.counts` | X posts only. `false` leaves out the post's time and views row and its action bar, so the picture shows no counts. Default `true`. `x_post` on another address answers `400`. | | `x_notifications.min_others` | The notifications page only. The fewest others the "followed you" notification must count, a whole number from 0 to 1000. Default 0. | | `x_notifications.blur_avatars` | The notifications page only. `false` leaves the avatars sharp; the names are always blurred. Default `true`. `x_notifications` on another address, or `clip.selector` on the notifications page, answers `400`. | ```bash curl -sS -X POST "https://api.lempile.com/accounts/janedemo/capture" \ -H "X-API-KEY: $LEMPILE_API_KEY" \ -H "content-type: application/json" \ -d '{ "url": "https://x.com/OpenAI/status/1986000000000000001", "width": 520, "dpr": 2, "x_post": { "counts": false } }' ``` ## Answer The picture: `200`, with the JPEG as base64 and its size in pixels (CSS size times `dpr`), the address the page ended on and its title. On a story source page, `crop` too: `article` (the headline's area), `element` (`clip.selector`) or `page` (no headline: from the top). ```bash curl -sS -X POST "https://api.lempile.com/accounts/janedemo/capture" \ -H "X-API-KEY: $LEMPILE_API_KEY" \ -H "content-type: application/json" \ -d '{ "url": "https://www.theverge.com/tech/1023230/the90-gem-necklace-hands-on-impressions", "width": 520, "dpr": 2, "clip": { "maxHeight": 1000 } }' ``` ```json { "object": "PageCapture", "ok": true, "account_id": "11111111-1111-4111-8111-111111111111", "url": "https://x.com/OpenAI/status/1986000000000000001", "final_url": "https://x.com/OpenAI/status/1986000000000000001", "title": "OpenAI on X: \"…\" / X", "width": 1040, "height": 1224, "jpeg_base64": "/9j/4AAQSkZJRg…", "captured_at": "2026-11-07T18:20:00.000Z" } ``` No picture: still `200`, with `ok: false`, the browser's `code` and `detail`. Nothing was clicked or typed; the code says whether trying again can help. ```json { "object": "PageCapture", "ok": false, "account_id": "11111111-1111-4111-8111-111111111111", "url": "https://x.com/fakeopenai/status/1986000000000000001", "code": "x_post_author_mismatch", "detail": "X shows this post under @OpenAI, not @fakeopenai: nothing was captured.", "captured_at": "2026-11-07T18:20:00.000Z" } ``` With `https://x.com/notifications`, the answer also has `"notification": { "kind": "followed", "others": 12, "names_blurred": true, "avatars_blurred": true }`. Besides the X post and notifications codes above: | `code` | Meaning | | --- | --- | | `x_signed_out` | X is signed out in the account's browser: sign it in again in the dashboard. | | `x_app_not_loaded` | X's app didn't load in the account's browser. | | `left_allowed_hosts` | The page went to another address after it loaded: another post, another page of the host, another host. | | `url_not_allowed` | The browser's own check refused the address. | | `element_not_found` | No element for `clip.selector` within 10 seconds. | | `browser_busy` | The account's browser was on another job for 15 seconds. Try again in a minute. | | `capture_blank` | The picture came out blank (almost all of it one colour), or X drew the post's box empty: it isn't returned. Try again later. | | `counts_not_hidden` | Asked with `x_post: { counts: false }`, but X's post wasn't built as expected around its views row and action bar, or the browser can't hide them yet: no picture, never one with counts. | | `page_blocked` | A story source page behind a bot check, a paywall or a consent wall: `blocked_by` says which (see [Story Sources](#story-sources)). | | `page_error` | A story source page answered an HTTP error. | | `no_picture`, `capture_failed` | The browser gave no picture, or stopped. | The account itself answers as on other routes: `423 errors/x_account_locked`, `422 errors/proxy_auth_failed` or `errors/proxy_unreachable`, `401 errors/disconnected_account`. `400 errors/invalid_parameters` is a field out of range or an address it doesn't open, `403` a key without `accounts.write`, `404` no such X account, `503 errors/service_unavailable` the browser runner out of reach, and `504 errors/timeout` no picture within 90 seconds. See [Errors And Limits](https://lempile.com/docs/x/errors-and-limits). --- # X API: Rebrand An X Account > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact > Turn an X account into another brand with the API alone: clear its posts, replies, reposts and follows, then change its pictures, name, bio and handle. Every step below is one of the X API's own routes, so a rebrand needs nothing else. The example turns `@janedemo` into **LAUNCH WIRE** (`@launchwire`). > **A verified account loses its checkmark.** On a verified (blue check) > account, a new name, avatar or handle removes the checkmark until X reviews > the account again. X asks to confirm that at Save, and Lempile confirms it: > the edit is what you asked for. Expect the check to be gone right after the > edit, and to come back only once X has reviewed the account. ## 1. Read The Profile First Keep what it was, in case you want it back: ```bash curl -sS "https://api.lempile.com/users/me?account_id=janedemo" -H "X-API-KEY: $LEMPILE_API_KEY" ``` The answer has `name`, `username`, `bio`, `location`, `website`, `profile_picture_url`, `cover_picture_url` and `can_change_username` ([Read The Profile](https://lempile.com/docs/x/profile-and-analytics#read-the-profile)). If `can_change_username` is `false`, X won't take a new handle yet (see the notes at the end): change the rest now and the handle later. ## 2. List What It Posted `GET /users/me/posts?account_id=&kind=&limit=&cursor=` (`accounts.read`) lists the account's own posts, replies or reposts from its profile's tabs, newest first ([The Account's Own Posts](https://lempile.com/docs/x/search-and-reads#the-accounts-own-posts)): ```bash curl -sS "https://api.lempile.com/users/me/posts?account_id=janedemo&kind=posts&limit=100" -H "X-API-KEY: $LEMPILE_API_KEY" ``` ```json { "object": "OwnPostList", "provider": "X", "account_id": "11111111-1111-4111-8111-111111111111", "kind": "posts", "items": [{ "object": "OwnPost", "id": "1850000000000000001", "kind": "post", "text": "Shipping today.", "created_at": "2026-11-06T09:12:00.000Z", "pinned": true }], "cursor": null } ``` `kind` is `posts` (the default), `replies` or `reposts`. A reply carries `in_reply_to` (the post it answers), a repost `reposted_id` (the post it reposted). `cursor` is `null` at the end; otherwise pass it back for the next page. ## 3. Delete Its Posts And Replies Delete each post (`kind=posts`) and each reply (`kind=replies`), then list again until the list comes back empty: ```bash curl -sS -X DELETE "https://api.lempile.com/posts/1850000000000000001?account_id=janedemo" -H "X-API-KEY: $LEMPILE_API_KEY" ``` `DELETE /posts/{post_id}` deletes only the account's own posts and replies, and answers once the post is gone (`PostDeleted`). A post already gone answers `404 errors/post_not_found`: nothing to do. Deleting the pinned post removes the pin too. Listing again from the top after each batch is simplest; a `cursor` whose post you deleted still works. ## 4. Undo Its Reposts List them with `kind=reposts`, then take each one back with `POST /posts/repost` and `undo: true` ([Undo A Repost](https://lempile.com/docs/x/likes-reposts-and-follows#undo-a-repost)). Give it the item's `reposted_id`, the post the account reposted: ```bash curl -sS "https://api.lempile.com/users/me/posts?account_id=janedemo&kind=reposts&limit=100" -H "X-API-KEY: $LEMPILE_API_KEY" curl -sS -X POST "https://api.lempile.com/posts/repost" \ -H "X-API-KEY: $LEMPILE_API_KEY" -H "Content-Type: application/json" \ -H "Idempotency-Key: unrepost-janedemo-1700000000000000009" \ -d '{ "account_id": "janedemo", "post_id": "1700000000000000009", "undo": true }' ``` List again until `kind=reposts` comes back empty. A post the account hasn't reposted answers `already: true` with nothing pressed, so undoing one twice does no harm. ## 5. Unfollow What The Old Brand Followed `GET /users/me/following` lists the accounts it follows, newest follow first ([Whom The Account Follows](https://lempile.com/docs/x/likes-reposts-and-follows#whom-the-account-follows)). Unfollow each one the new brand shouldn't keep with `POST /users/follow` and `undo: true` ([Unfollow An Account](https://lempile.com/docs/x/likes-reposts-and-follows#unfollow-an-account)): ```bash curl -sS "https://api.lempile.com/users/me/following?account_id=janedemo&limit=1000" -H "X-API-KEY: $LEMPILE_API_KEY" curl -sS -X POST "https://api.lempile.com/users/follow" \ -H "X-API-KEY: $LEMPILE_API_KEY" -H "Content-Type: application/json" \ -H "Idempotency-Key: unfollow-janedemo-marclou" \ -d '{ "account_id": "janedemo", "identifier": "marclou", "undo": true }' ``` ```json { "object": "UserUnfollowed", "provider": "X", "identifier": "marclou", "already": false } ``` Read the list again to check. An account it doesn't follow answers `already: true` with nothing pressed, so unfollowing one twice does no harm. ## 6. Try The Edit The same edit with `dry_run: true` opens every window, reads it, and presses nothing: ```bash curl -sS -X PATCH "https://api.lempile.com/users/me/edit" \ -H "X-API-KEY: $LEMPILE_API_KEY" \ -F account_id=janedemo -F dry_run=true \ -F name="LAUNCH WIRE" -F bio="Every launch worth knowing, as it ships." -F location="" \ -F website="https://launchwire.example" -F avatar=@avatar.png -F banner=@header.jpg \ -F username=launchwire ``` ```json { "object": "ProfileEditDryRun", "provider": "X", "not_sent": true, "current": { "name": "Jane Demo", "bio": "Building in public.", "location": "Lisbon", "website": "https://janedemo.example", "avatar": "https://pbs.twimg.com/profile_images/1/old.jpg", "banner": "https://pbs.twimg.com/profile_banners/9/1690000000", "username": "janedemo" }, "would_change": { "name": "LAUNCH WIRE", "bio": "Every launch worth knowing, as it ships.", "location": "", "website": "https://launchwire.example", "avatar": "new picture", "banner": "new picture", "username": "launchwire" }, "already": [], "checks": { "save_button": true, "photo_inputs": { "inputs": 2, "banner": true, "avatar": true }, "username_field": true, "password_required": false } } ``` Every field and picture is checked before the browser opens (`400` for one X wouldn't take). In `checks`, `username_field: false` or `password_required: true` means the handle won't change: see the notes. ## 7. Make The Edit The same call without `dry_run`, with an `Idempotency-Key`. Pictures and a handle can take a few minutes: the request waits 140 seconds, then answers `504 errors/timeout` while the browser goes on. Then read the receipt until it's `done` or `failed`: ```bash curl -sS "https://api.lempile.com/writes/rebrand-janedemo-1" -H "X-API-KEY: $LEMPILE_API_KEY" ``` Done, the answer (in the request or in the receipt's `response`) is `ProfileEdited` with `changed` (what X keeps now), `previous` and `already` ([Edit The Profile](https://lempile.com/docs/x/profile-and-analytics#edit-the-profile)). Lempile's own record of the account takes the new handle in the same step: from then on use the account's Lempile id (or `launchwire`) as `account_id`; `janedemo` no longer finds it. A failure on the handle after the rest was saved (`409 errors/username_taken`, say) carries `done`: what X keeps from the Edit profile part. Send the edit again with another handle (and another key): the fields already as asked are left alone. ## 8. Read It Back ```bash curl -sS "https://api.lempile.com/users/me?account_id=launchwire" -H "X-API-KEY: $LEMPILE_API_KEY" ``` The answer shows the profile as X serves it now. Then post the new brand's first post and pin it (`POST /accounts/{account_id}/posts/{status_id}/pin`). ## Notes - **The checkmark.** A verified account's checkmark goes as soon as the name, avatar or handle changes, until X reviews the account again (see the top of this page). - **A handle X won't change yet.** While an X Premium check is under review, X's Change username page shows no Username field: the edit answers `422 errors/username_field_not_found` and `GET /users/me` says `can_change_username: false`. Change the rest now and the handle once the review is over. - **A handle someone has.** A handle is only free once the account that had it has let it go (changed it or been deleted): until then X says it's taken (`409 errors/username_taken`), and nothing changes for the handle. - **A password X asks for.** If X asks for the account's password to change the handle, the answer is `403 errors/password_required`: Lempile never types a password there. Change the handle on X yourself, in the account's browser. - **Pictures** must be JPEG or PNG (at most 2 MB for the avatar, 5 MB for the header photo). X shows them through its own crop window, applied as is: crop them before you send them (400 × 400 for the avatar, 1500 × 500 for the header). --- # X API: Articles > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact > Publish an X Article: built in a draft, read back, and published only if X kept every block. An Article takes minutes to build, longer than a request may wait, so `POST /articles` starts it and answers `202`, and `GET /articles/{key}` says where it is. The browser builds it in a new X draft (title, every block in order, cover), reads the saved draft back, and publishes it only if X kept exactly those blocks. Otherwise nothing is published and the draft stays in the account's Drafts. ## Publish One `POST /articles` (`accounts.write`, `Idempotency-Key` required, JSON): ```json { "account_id": "janedemo", "title": "How we ship every week", "cover": { "name": "cover.png", "content_type": "image/png", "data_base64": "…" }, "blocks": [ { "kind": "text", "html": "

Every Monday we pick one thing…

", "plain": "Every Monday we pick one thing…" }, { "kind": "image", "alt": "Our board", "file": { "name": "board.png", "content_type": "image/png", "data_base64": "…" } }, { "kind": "code", "text": "git tag v1.4.0" } ], "dry_run": false } ``` - `title` up to 200 characters; 1–200 `blocks`. - `text` blocks are pasted as HTML: headings, bold, italics, lists and links survive. - Images are JPEG, PNG or WebP, 8 MB each, 30 at most, 40 MB in all. `cover` is optional (5:2 works best). - `dry_run: true` builds and checks the draft but never publishes, and doesn't count toward the pace. Articles otherwise share the posts' pace. ```json { "object": "ArticleJob", "id": "article-2026-11-07", "account_id": "11111111-1111-4111-8111-111111111111", "status": "building", "detail": "Starting." } ``` ## Follow One `GET /articles/{idempotency_key}` (`accounts.read`): | `status` | HTTP | Meaning | | --- | --- | --- | | `building` | 202 | Still being built. Ask again in a minute. | | `published` | 200 | Live, with `url` and `article_id`. Final. | | `draft` | 200 | Dry run: built and checked, `draft_url`, nothing published. Final. | | `not_sent` | 422 (409 for `account_busy`) | Nothing was published; `code` and `detail` say why. Safe to retry with the same key. | | `unknown` | 200 | Publish was pressed but X didn't confirm. Check the account's Articles before sending again. | The same key never builds twice. One Article builds per account at a time; other X calls on that account answer `409 errors/account_busy` until it ends. --- # X API: Write Receipts > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact > Idempotency keys, replays, and what became of a write X didn't confirm in time. ## Idempotency-Key Posts, replies and Articles require an `Idempotency-Key` header; follows (and unfollows), reposts (and their undo), pins and profile edits accept one. Send one with a profile edit that changes pictures or the handle: it can run past the request's 140 seconds, and the receipt has its answer. A key is 1–200 characters of `A-Z a-z 0-9 . _ : -`, scoped to your workspace: - Same key, same request, after success: the stored answer is replayed with `Idempotent-Replayed: true`. - Same key while the first request runs, or after an unsure outcome: `409 errors/in_progress`. - Same key after a definite failure: the request runs again. - Same key, another request: `422 errors/idempotency_key_reused`. ## What Became Of A Write `GET /writes/{key}` (a key with `accounts.read` or `accounts.write`; any other answers `403 insufficient_permissions`): ```json { "object": "WriteStatus", "key": "launch-post-1", "state": "done", "status": 201, "response": { "object": "PostCreated", "provider": "X", "post_id": "1850000000000000001" } } ``` `state` is `done` (sent: `response` is the stored answer), `failed` (nothing was sent: `response` is the problem), `pending` (still running, or not sure; `response` is `null`), or `none` (no write with that key). The browser's answer is kept for 48 hours, also after the request stopped waiting (posts wait 140 seconds). For a pending write, `GET /writes/{key}` asks for it: a final answer is stored and returned, an unsure one stays `pending`. A write the browser never received becomes `failed` (`422 errors/never_started`) 10 minutes after it started. Lempile also settles pending writes by itself, every few minutes, read or not: a request cut off after its key was taken (its HTTP answer lost, a `5xx`) ends as `done` or `failed` from the browser's own answer within minutes. Only a write the browser itself left unsure (Lempile restarted while it ran), or one older than 48 hours, stays `pending`: check the account, then release it below. ## Releasing One `POST /writes/{key}/not-sent` (`accounts.write`): after you checked on X that a pending write isn't there, it becomes `failed`, its key can be sent again, and it stops counting toward the pace. A write Lempile has as sent stays sent (`409`); one under 5 minutes old or still running answers `409` too. Likes, deletes and Articles have no receipt (follow an Article with `GET /articles/{key}`). --- # X API: Errors And Limits > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact > Every X error, what it means for what was sent, and each account's pace. Errors are problem JSON: `{ "type": "errors/…", "title", "status", "detail" }`, with `retry_at` when waiting helps and the browser's own `code` when it came from there: a post or reply the browser refused before pressing Post or Reply is `errors/not_sent` with `code` naming why (`replies_limited`, `post_not_accepted`, `browser_busy`…). A few answers use `{ "error", "message" }` (a missing key, `402`, an unknown route). The rule to read every answer by: **a `4xx` means nothing was done on X; a `5xx` after the click means not sure: check before sending again.** ## Pace | Limit | Applies to | Answer | | --- | --- | --- | | 45 seconds between writes | posts, replies, Articles (not dry runs) | `429 errors/too_fast` | | 70 writes in 24 hours | posts, replies, Articles | `429 errors/daily_limit` | | 200 answers in 24 hours | replies sent with `answer: true` | `429 errors/answers_daily_limit` | | The account's browser is on another job | any call | `429 errors/browser_busy`; for posts and replies, `422 errors/not_sent` with `code: "browser_busy"` (nothing sent) | Likes, reposts and their undo, follows and unfollows, pins, profile edits and deletes aren't paced. ## Any Route | HTTP | Type | Meaning | | --- | --- | --- | | `401` | `unauthorized` | Missing or invalid API key. | | `401` | `errors/disconnected_account`, `errors/reauth_required` | The account is disconnected, or X is signed out in its browser: sign it in again in the dashboard. | | `402` | `subscription_required` | The workspace has no active trial or subscription. | | `403` | `forbidden`, `errors/insufficient_permissions` | The key lacks `accounts.read` or `accounts.write`. | | `403` | `errors/action_required`, `errors/account_restricted` | The account needs attention in the dashboard. | | `404` | `errors/resource_not_found` | No such account in this workspace, or not an X account. | | `409` | `errors/account_busy` | An X Article is being built on this account. | | `422` | `errors/x_app_not_loaded` | X never loaded in the account's browser, even after a retry. Nothing was done. | | `422` | `errors/proxy_auth_failed`, `errors/proxy_unreachable` | The account's proxy is down. Nothing was done. | | `423` | `errors/x_account_locked` | X shows the account its lock page (x.com/account/access). Nothing was done until someone passes X's check. | | `503` | `errors/service_unavailable`, `errors/no_client_session` | The account isn't ready, or its browser can't be reached. | | `503` | `errors/maintenance` | Planned maintenance, with `retry_at` and `Retry-After`. | | `504` | `errors/timeout` | X didn't answer in time. For a write: not sure, read the receipt. | ## Lists On X X lists come in one page: a `cursor` on `GET /posts/{post_id}/comments` or `GET /users/{identifier}/posts` answers `400 errors/invalid_parameters`, and every answer's `cursor` is `null`. ## Writes | HTTP | Type | Meaning | | --- | --- | --- | | `400` | `errors/missing_idempotency_key`, `errors/invalid_idempotency_key` | See [Write Receipts](https://lempile.com/docs/x/write-receipts). | | `409` | `errors/in_progress` | The same key is still running or unsure. | | `413` | `errors/payload_too_large` | `POST /posts`: the files are over 50 MiB (52,428,800 bytes) in all. `POST /articles`: the body is over 60 MiB (62,914,560 bytes). `PATCH /users/me/edit`: the body is over 24 MiB (25,165,824 bytes). Nothing was claimed or sent. | | `429` | `errors/files_busy` | `POST /posts` with files, `POST /articles`, `PATCH /users/me/edit`: other big files are being sent right now. Nothing was sent; send it again at `retry_at`, same key. | | `422` | `errors/idempotency_key_reused` | The same key was used for another request. | | `422` | `errors/not_sent` | Posts and replies: the browser stopped before Post or Reply. `code` says why (`post_not_accepted`: X kept a long post in its box without Premium; `replies_limited`: the author limits who can reply; `gif_not_found`; `browser_busy`; `quote_unavailable`: X didn't open the post's Quote box; `quote_not_attached`: X's quote box doesn't show the quoted post; `paid_label_unavailable`: X's Paid partnership label didn't turn on (or went off before Post); `detail` says what X showed; `media_upload_failed`: X refused a file; `media_upload_timeout`: X didn't finish taking a file) and `detail` in words. Nothing was sent. | | `502` | `errors/not_sent` | A dry run asked for `quote` or `paid_partnership` and the account's browser didn't confirm it (`code`: `quote_unconfirmed`, `paid_label_unconfirmed`). Nothing was posted. | | `422` | `errors/post_button_disabled`, `errors/reply_button_disabled` | X kept its button disabled. Nothing was sent. | | `502` | `errors/*_unconfirmed` | Likes, reposts, follows and unfollows, pins, profile edits: pressed, but X didn't show it kept. Check on X; repeating changes nothing. | ## Profile Edits `PATCH /users/me/edit` checks every field before the browser opens, then passes the browser's own answer through. Pictures and a handle can take a few minutes: past 140 seconds the answer is `504 errors/timeout` while the browser goes on, and the receipt (`GET /writes/{key}`) gets its answer. | HTTP | Type | Meaning | | --- | --- | --- | | `400` | `errors/invalid_parameters` | A field X wouldn't take: `name` empty, on two lines or over 50 characters; `bio` over 160; `location` over 30 or on two lines; a `website` that isn't one https address (or is empty); a `username` that isn't 4–15 letters, digits or `_`; `dry_run` that isn't `true` or `false`; a picture that isn't a JPEG or PNG (a GIF or WebP is refused), is empty, isn't valid base64, or is over 2 MB (`avatar`) or 5 MB (`banner`). Nothing was changed. | | `400` | `errors/invalid_*` | The browser's own check of one field, the same rules. Nothing was changed. | | `403` | `errors/password_required` | X asks for the account's password to change the handle. Lempile never types it: the handle wasn't changed. | | `409` | `errors/username_taken` | X says the handle isn't free (a handle is only free once the account that had it let it go). The handle wasn't changed. | | `422` | `errors/username_field_not_found` | X's Change username page shows no Username field: X refuses a new handle while an X Premium check is under review. Nothing was changed. | | `422` | `errors/username_refused`, `errors/username_check_failed`, `errors/username_save_unavailable`, `errors/username_not_kept` | X refused the handle, never said if it was free, offered no Save, or kept the old one. | | `422` | `errors/profile_photo_input_not_found`, `errors/profile_photo_not_taken` | X's file picker or crop window for a picture didn't show. Nothing was saved. | | `422` | `errors/profile_field_not_found`, `errors/profile_fields_changed`, `errors/profile_save_unavailable`, `errors/typing_failed` | X's Edit profile wasn't as expected. Nothing was saved. | | `422` | `errors/profile_value_not_kept` | Saved, but X keeps another value. `detail` names the field and quotes any sheet X showed (`X said: …`). | | `501` | `errors/feature_not_implemented` | A field an X profile doesn't have (`headline`, `experience`, `picture_settings`…), or a `type` naming a network Lempile doesn't edit. On an X account, `type: "LINKEDIN"` is `400 errors/invalid_parameters`. Nothing was changed. | | `502` | `errors/profile_unconfirmed`, `errors/username_unconfirmed` | Saved, but not read back: not sure. Read the profile (`GET /users/me`) before trying again. | An answer that failed on the handle after the Edit profile part was saved carries `done`, what X keeps from that part. Sending the same edit again types nothing that's already as asked; pictures are given again. ## Page Capture `POST /accounts/{account_id}/capture` answers `400 errors/invalid_parameters` for an address it doesn't open (it lists them; an X post is exactly `https://x.com//status/`, no query) and for a `clip.selector` on an X post. When the page gave no picture the answer is still `200`, with `ok: false` and the browser's `code`; nothing was clicked or typed. See [Page Capture](https://lempile.com/docs/x/page-capture). | `code` | Meaning | | --- | --- | | `x_post_author_mismatch` | X shows the post under another handle than the address's, or no author it could read. | | `x_post_protected` | The post is from a protected account. | | `x_post_deleted` | X says the post doesn't exist: deleted, or never posted. | | `x_post_age_restricted` | X shows the post only behind an age or sensitive-content warning, never clicked through. | | `x_post_unavailable` | X shows its "This post is unavailable" notice. | | `x_post_not_loaded` | X ran but didn't show the post within 25 seconds. Try again later. | | `x_signed_out`, `x_app_not_loaded` | X is signed out in the account's browser, or didn't load. | | `left_allowed_hosts`, `url_not_allowed` | The page went to another address after loading, or the browser's own check refused the address. | | `capture_blank` | The picture came out blank, or X drew the post's box empty: it isn't returned. | | `counts_not_hidden` | Asked without counts (`x_post: { counts: false }`), but the views row and action bar couldn't be hidden: no picture. | | `element_not_found`, `browser_busy`, `no_picture`, `capture_failed` | No element for the selector, a busy browser (try again in a minute), or no picture. | The route pages list each route's own errors, such as `errors/not_own_post`, `errors/delete_unavailable`, `errors/follow_limited` or `errors/analytics_unavailable`. --- # X API API reference > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact Base URL: `https://api.lempile.com`. Authentication: your API key in the `X-API-KEY` header. OpenAPI document: [x.json](https://lempile.com/docs-assets/openapi/x.json). ## Accounts - [List accounts](https://lempile.com/docs/x/reference/list-accounts): `GET /accounts` - [Retrieve an account](https://lempile.com/docs/x/reference/get-account): `GET /accounts/{account_id}` - [Delete an account](https://lempile.com/docs/x/reference/delete-account): `DELETE /accounts/{account_id}` ## Posts - [Create a post](https://lempile.com/docs/x/reference/create-post): `POST /posts` - [Search GIFs](https://lempile.com/docs/x/reference/search-gifs): `GET /posts/gifs` - [Retrieve a post](https://lempile.com/docs/x/reference/get-post): `GET /posts/{post_id}` - [Delete a post](https://lempile.com/docs/x/reference/delete-post): `DELETE /posts/{post_id}` - [Pin a post](https://lempile.com/docs/x/reference/pin-post): `POST /accounts/{account_id}/posts/{status_id}/pin` - [Unpin a post](https://lempile.com/docs/x/reference/unpin-post): `POST /accounts/{account_id}/posts/{status_id}/unpin` ## Replies - [List replies](https://lempile.com/docs/x/reference/list-replies): `GET /posts/{post_id}/comments` - [Reply to a post](https://lempile.com/docs/x/reference/send-reply): `POST /posts/{post_id}/comments` ## Likes, reposts and follows - [Like a post](https://lempile.com/docs/x/reference/like-post): `POST /posts/reaction` - [Repost a post, or undo a repost](https://lempile.com/docs/x/reference/repost-post): `POST /posts/repost` - [List likers](https://lempile.com/docs/x/reference/list-likers): `GET /posts/{post_id}/reactions` - [Follow an account, or unfollow it](https://lempile.com/docs/x/reference/follow-user): `POST /users/follow` - [List followers](https://lempile.com/docs/x/reference/list-followers): `GET /users/followers` - [List whom the account follows](https://lempile.com/docs/x/reference/list-following): `GET /users/me/following` ## Search and reads - [Search posts](https://lempile.com/docs/x/reference/search-posts): `GET /posts/search` - [List a profile's posts](https://lempile.com/docs/x/reference/list-user-posts): `GET /users/{identifier}/posts` - [List the account's own posts](https://lempile.com/docs/x/reference/list-own-posts): `GET /users/me/posts` ## Profile and analytics - [Retrieve the profile](https://lempile.com/docs/x/reference/get-own-profile): `GET /users/me` - [Edit the profile](https://lempile.com/docs/x/reference/edit-profile): `PATCH /users/me/edit` - [Retrieve analytics](https://lempile.com/docs/x/reference/get-analytics): `GET /accounts/{account_id}/analytics` ## Page capture - [Capture a page](https://lempile.com/docs/x/reference/capture-page): `POST /accounts/{account_id}/capture` ## Articles - [Publish an Article](https://lempile.com/docs/x/reference/create-article): `POST /articles` - [Retrieve an Article job](https://lempile.com/docs/x/reference/get-article): `GET /articles/{key}` ## Write receipts - [Retrieve a write receipt](https://lempile.com/docs/x/reference/get-write): `GET /writes/{key}` - [Mark a write not sent](https://lempile.com/docs/x/reference/release-write): `POST /writes/{key}/not-sent` --- # X API: List accounts > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `GET https://api.lempile.com/accounts` The workspace's connected accounts, X and LinkedIn. An X account has `provider: "x"` and its handle in `public_identifier`. Read from Lempile's database: no browser opens. Scope: `accounts.read`. ## Authentication Send your X API API key in the `X-API-KEY` header. ## Example request ```bash curl -sS "https://api.lempile.com/accounts" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ## Responses ### 200 The accounts. ```json { "object": "list", "count": 0, "items": [ { "id": "string", "provider": "x", "display_name": "string", "external_account_id": "string", "public_identifier": "string", "username": "string", "profile_url": "string", "profile_picture_url": "string", "status": "string", "connected_at": "string", "created_at": "string" } ] } ``` ### 401 Missing or invalid API key (`{error, message}`), `errors/disconnected_account`, or `errors/reauth_required` when X is signed out in the account's browser. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 402 `subscription_required`: the workspace has no active trial or subscription. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` --- # X API: Retrieve an account > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `GET https://api.lempile.com/accounts/{account_id}` One account, in Unipile's shape. `sources[].status` is `OK` (ready), `CREDENTIALS` (sign-in or a check needed), `CONNECTING` or `ERROR`. No browser opens. Scope: `accounts.read`. ## Authentication Send your X API API key in the `X-API-KEY` header. ## Path parameters - `account_id` (string, required): Lempile id, X user id or handle. Example: `janedemo`. ## Example request ```bash curl -sS "https://api.lempile.com/accounts/janedemo" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ## Responses ### 200 The account. ```json { "object": "Account", "id": "11111111-1111-4111-8111-111111111111", "type": "X", "name": "Jane Demo", "created_at": "2026-10-08T09:00:00Z", "sources": [ { "id": "x_browser_session", "status": "OK" } ] } ``` ### 401 Missing or invalid API key (`{error, message}`), `errors/disconnected_account`, or `errors/reauth_required` when X is signed out in the account's browser. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 402 `subscription_required`: the workspace has no active trial or subscription. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 404 `errors/resource_not_found`: no such account in this workspace, or it isn't an X account. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` --- # X API: Delete an account > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `DELETE https://api.lempile.com/accounts/{account_id}` Disconnects the account from the workspace. Its X account itself is untouched. Scope: `accounts.write`. ## Authentication Send your X API API key in the `X-API-KEY` header. ## Path parameters - `account_id` (string, required): Lempile id, X user id or handle. ## Example request ```bash curl -sS -X DELETE "https://api.lempile.com/accounts/{account_id}" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ## Responses ### 200 Deleted. ```json { "object": "AccountDeleted" } ``` ### 401 Missing or invalid API key (`{error, message}`), `errors/disconnected_account`, or `errors/reauth_required` when X is signed out in the account's browser. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 402 `subscription_required`: the workspace has no active trial or subscription. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 404 `errors/resource_not_found`: no such account in this workspace, or it isn't an X account. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` --- # X API: Create a post > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `POST https://api.lempile.com/posts` Posts from the account's own X, in its own browser: words, up to 4 images or one video, or a GIF from X's GIF search; a quote of another post (with files); X's Paid partnership label on a sponsored post. To reply, use `POST /posts/{post_id}/comments`. Paced per account (see Errors and limits): at least 45 seconds between writes and 70 writes in 24 hours. The request waits up to 140 seconds; if X doesn't confirm by then, the answer is `504 errors/timeout` and the receipt tells you what happened. Scope: `accounts.write`. ## Authentication Send your X API API key in the `X-API-KEY` header. ## Headers - `Idempotency-Key` (string, required): 1–200 characters of `A-Z a-z 0-9 . _ : -`. The same key with the same request replays the first answer; see Write receipts. Example: `post-2026-11-07-01`. ## Request body `multipart/form-data` (required) - `account_id` (string, required): The X account (also accepted as `?account_id=`). - `text` (string, required): The post's words. More than 280 characters needs X Premium on the account: without it X keeps the post in its box and the answer is `422 errors/not_sent`. - `attachments` (array of string (binary)): Multipart only: up to 4 images (JPEG, PNG, WebP or GIF, 8 MiB = 8,388,608 bytes each), or one MP4 of up to 50 MiB (52,428,800 bytes) on its own. Over 50 MiB in all: `413 errors/payload_too_large`, nothing sent. - `gif` (string): A GIF from X's own GIF search, as JSON `{"query": "...", "url": "..."}` (a string in a form field): `query` 2–40 letters, digits, spaces, `'` or `-`; `url` a result from `GET /posts/gifs`. Not with attachments. - `quote` (string): The post this one quotes: its id or its link (`https://x.com//status/`, twitter.com too). Made with X's own Quote, so it can carry attachments. Not with `gif`. X only. - `paid_partnership` (boolean): X's own Paid partnership label on the post (Content Disclosures → Paid Partnership), for a sponsored post, a quote included. No label shown in X's post box, no post: `422 errors/not_sent`, `code: paid_label_unavailable`. X only. - `dry_run` (boolean): Does everything but press Post: answers `200 PostDryRun` with what the box showed (`quote`, `paid_partnership`, `media`), nothing is posted. `true` or `false` only. `application/json` (required) - `account_id` (string, required): The X account (also accepted as `?account_id=`). - `text` (string, required): The post's words. More than 280 characters needs X Premium on the account: without it X keeps the post in its box and the answer is `422 errors/not_sent`. - `gif` (string): A GIF from X's own GIF search, as JSON `{"query": "...", "url": "..."}` (a string in a form field): `query` 2–40 letters, digits, spaces, `'` or `-`; `url` a result from `GET /posts/gifs`. Not with attachments. - `quote` (string): The post this one quotes: its id or its link (`https://x.com//status/`, twitter.com too). Made with X's own Quote, so it can carry attachments. Not with `gif`. X only. - `paid_partnership` (boolean): X's own Paid partnership label on the post (Content Disclosures → Paid Partnership), for a sponsored post, a quote included. No label shown in X's post box, no post: `422 errors/not_sent`, `code: paid_label_unavailable`. X only. - `dry_run` (boolean): Does everything but press Post: answers `200 PostDryRun` with what the box showed (`quote`, `paid_partnership`, `media`), nothing is posted. `true` or `false` only. ## Example request ```bash curl -sS -X POST "https://api.lempile.com/posts" \ -H "X-API-KEY: $LEMPILE_API_KEY" \ -H "Idempotency-Key: post-2026-11-07-01" \ -H "Content-Type: application/json" \ -d '{ "account_id": "janedemo", "text": "Shipping today." }' ``` ## Responses ### 200 Dry run: everything but the Post button. ```json { "object": "PostDryRun", "provider": "X", "not_sent": true, "gif": {}, "quote": { "post_id": "string", "author": "string", "shown": true }, "paid_partnership": { "shown": true, "app": "x-web" }, "media": { "ready_s": 0, "status": "string" } } ``` ### 201 Posted. ```json { "object": "PostCreated", "provider": "X", "post_id": "1850000000000000001" } ``` ### 400 `errors/missing_parameters`, `errors/invalid_parameters`, `errors/missing_idempotency_key` or `errors/invalid_idempotency_key`. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 401 Missing or invalid API key (`{error, message}`), `errors/disconnected_account`, or `errors/reauth_required` when X is signed out in the account's browser. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 402 `subscription_required`: the workspace has no active trial or subscription. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 404 `errors/resource_not_found`: no such account in this workspace, or it isn't an X account. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 409 `errors/in_progress`: the same key is still running or its outcome isn't known yet. `errors/account_busy`: an X Article is being built on this account. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 413 `errors/payload_too_large`: the files are over 50 MiB (52,428,800 bytes) in all. Refused before the key was taken or anything was sent; send a smaller file. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 422 `errors/not_sent` (the browser stopped before Post; `code` says why: `post_not_accepted` when X kept the post in its box, `gif_not_found`, `browser_busy`…), `errors/post_button_disabled`, `errors/idempotency_key_reused`, `errors/x_app_not_loaded`, `errors/proxy_auth_failed` or `errors/proxy_unreachable`. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 423 `errors/x_account_locked`: X shows the account its lock page (x.com/account/access). Nothing was done; someone has to pass X's check. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 429 `errors/too_fast`, `errors/daily_limit`, `errors/browser_busy`, or `errors/files_busy` (another post's big files are being sent; nothing was sent), with `retry_at`. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 503 `errors/service_unavailable` (the account isn't ready, or the browser runner can't be reached), `errors/no_client_session`, or `errors/maintenance` with `retry_at`. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 504 `errors/timeout`: Post was pressed but X didn't confirm in time. Read the receipt before sending again. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` --- # X API: Search GIFs > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `GET https://api.lempile.com/posts/gifs` X's own GIF search, as the composer shows it. Read-only: nothing is typed into a post or sent. Pass a result's `url` (with your `query`) as `gif` on `POST /posts`. Scope: `accounts.read`. ## Authentication Send your X API API key in the `X-API-KEY` header. ## Query parameters - `account_id` (string, required): The connected X account: its Lempile id, its X user id, or its handle. Example: `janedemo`. - `q` (string, required): What to search, 2–40 characters. Example: `ship it`. - `limit` (integer): 1–24, default 12. Default: `12`. ## Example request ```bash curl -sS "https://api.lempile.com/posts/gifs?account_id=janedemo&q=ship+it" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ## Responses ### 200 GIFs. ```json { "object": "GifList", "provider": "X", "query": "string", "items": [ { "url": "string", "title": "string", "width": 0, "height": 0 } ] } ``` ### 401 Missing or invalid API key (`{error, message}`), `errors/disconnected_account`, or `errors/reauth_required` when X is signed out in the account's browser. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 402 `subscription_required`: the workspace has no active trial or subscription. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 404 `errors/resource_not_found`: no such account in this workspace, or it isn't an X account. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 422 `errors/gif_search_unavailable` or `errors/gif_search_empty`. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 423 `errors/x_account_locked`: X shows the account its lock page (x.com/account/access). Nothing was done; someone has to pass X's check. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 503 `errors/service_unavailable` (the account isn't ready, or the browser runner can't be reached), `errors/no_client_session`, or `errors/maintenance` with `retry_at`. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` --- # X API: Retrieve a post > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `GET https://api.lempile.com/posts/{post_id}` One X post with its counts, read in the account's browser. `quote_counter`, `bookmark_counter` and `impressions_counter` are `null` when X's own data wasn't available and the page was read instead. Scope: `accounts.read`. ## Authentication Send your X API API key in the `X-API-KEY` header. ## Path parameters - `post_id` (string, required): The post's id (its status digits). Example: `1850000000000000001`. ## Query parameters - `account_id` (string, required): The connected X account: its Lempile id, its X user id, or its handle. Example: `janedemo`. ## Example request ```bash curl -sS "https://api.lempile.com/posts/1850000000000000001?account_id=janedemo" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ## Responses ### 200 The post. ```json { "object": "Post", "provider": "X", "id": "1850000000000000001", "author": "Jane Demo", "author_details": { "id": "janedemo", "public_identifier": "janedemo", "profile_url": "https://x.com/janedemo", "profile_picture_url": "https://pbs.twimg.com/profile_images/0/demo.jpg" }, "date": "2026-11-06T09:12:00.000Z", "text": "Shipping today.", "share_url": "https://x.com/janedemo/status/1850000000000000001", "reply_counter": 3, "comment_counter": 3, "reaction_counter": 12, "repost_counter": 1, "quote_counter": 0, "bookmark_counter": 2, "impressions_counter": 840, "user_reacted": false } ``` ### 400 `errors/invalid_post_id`. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 401 Missing or invalid API key (`{error, message}`), `errors/disconnected_account`, or `errors/reauth_required` when X is signed out in the account's browser. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 402 `subscription_required`: the workspace has no active trial or subscription. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 404 `errors/post_not_found`, or the account isn't found. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 423 `errors/x_account_locked`: X shows the account its lock page (x.com/account/access). Nothing was done; someone has to pass X's check. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 503 `errors/service_unavailable` (the account isn't ready, or the browser runner can't be reached), `errors/no_client_session`, or `errors/maintenance` with `retry_at`. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` --- # X API: Delete a post > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `DELETE https://api.lempile.com/posts/{post_id}` Deletes one of the account's own posts or replies, through X's menu on it, then opens it again to check it's gone. Never someone else's post. Not paced. Scope: `accounts.write`. ## Authentication Send your X API API key in the `X-API-KEY` header. ## Path parameters - `post_id` (string, required): The post's id. Example: `1850000000000000001`. ## Query parameters - `account_id` (string, required): The connected X account: its Lempile id, its X user id, or its handle. Example: `janedemo`. ## Example request ```bash curl -sS -X DELETE "https://api.lempile.com/posts/1850000000000000001?account_id=janedemo" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ## Responses ### 200 Deleted, and checked gone. ```json { "object": "PostDeleted", "post_id": "string" } ``` ### 401 Missing or invalid API key (`{error, message}`), `errors/disconnected_account`, or `errors/reauth_required` when X is signed out in the account's browser. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 402 `subscription_required`: the workspace has no active trial or subscription. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 403 `errors/not_own_post`: not this account's post. Nothing was deleted. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 404 `errors/post_not_found`: missing or already deleted. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 422 `errors/delete_unavailable`: X's menu, its Delete item or the confirmation didn't show. Nothing was deleted. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 423 `errors/x_account_locked`: X shows the account its lock page (x.com/account/access). Nothing was done; someone has to pass X's check. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 503 `errors/service_unavailable` (the account isn't ready, or the browser runner can't be reached), `errors/no_client_session`, or `errors/maintenance` with `retry_at`. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 504 `errors/timeout`: Delete was confirmed but the post may still be there. Open it before trying again. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` --- # X API: Pin a post > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `POST https://api.lempile.com/accounts/{account_id}/posts/{status_id}/pin` Pins one of the account's own posts to its profile. X keeps one pinned post: a new pin replaces it (`previous_pinned_id`). Answers only once the profile shows it. `{"dry_run": true}` opens X's menu, reads it and closes it. Scope: `accounts.write`. ## Authentication Send your X API API key in the `X-API-KEY` header. ## Path parameters - `account_id` (string, required): Lempile id, X user id or handle. Example: `janedemo`. - `status_id` (string, required): The post's id (5–25 digits). Example: `1850000000000000001`. ## Headers - `Idempotency-Key` (string): Optional. With a key, the write gets a receipt (`GET /writes/{key}`) and a repeat replays the first answer. Example: `post-2026-11-07-01`. ## Request body `application/json` - `dry_run` (boolean) ## Example request ```bash curl -sS -X POST "https://api.lempile.com/accounts/janedemo/posts/1850000000000000001/pin" \ -H "X-API-KEY: $LEMPILE_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "dry_run": false }' ``` ## Responses ### 200 Done, or already so. ```json { "object": "PostPin", "provider": "X", "status": "pinned", "status_id": "1850000000000000001", "previous_pinned_id": "1840000000000000002", "already": false } ``` ### 400 `errors/not_own_post`. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 401 Missing or invalid API key (`{error, message}`), `errors/disconnected_account`, or `errors/reauth_required` when X is signed out in the account's browser. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 402 `subscription_required`: the workspace has no active trial or subscription. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 404 `errors/post_not_found`. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 422 `errors/pin_unavailable` or `errors/profile_not_loaded`. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 423 `errors/x_account_locked`: X shows the account its lock page (x.com/account/access). Nothing was done; someone has to pass X's check. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 502 `errors/pin_unconfirmed`: check the profile. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 503 `errors/service_unavailable` (the account isn't ready, or the browser runner can't be reached), `errors/no_client_session`, or `errors/maintenance` with `retry_at`. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 504 `errors/timeout`. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` --- # X API: Unpin a post > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `POST https://api.lempile.com/accounts/{account_id}/posts/{status_id}/unpin` Unpins the account's pinned post. Answers only once the profile shows it. `{"dry_run": true}` opens X's menu, reads it and closes it. Scope: `accounts.write`. ## Authentication Send your X API API key in the `X-API-KEY` header. ## Path parameters - `account_id` (string, required): Lempile id, X user id or handle. Example: `janedemo`. - `status_id` (string, required): The post's id (5–25 digits). Example: `1850000000000000001`. ## Headers - `Idempotency-Key` (string): Optional. With a key, the write gets a receipt (`GET /writes/{key}`) and a repeat replays the first answer. Example: `post-2026-11-07-01`. ## Request body `application/json` - `dry_run` (boolean) ## Example request ```bash curl -sS -X POST "https://api.lempile.com/accounts/janedemo/posts/1850000000000000001/unpin" \ -H "X-API-KEY: $LEMPILE_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "dry_run": false }' ``` ## Responses ### 200 Done, or already so. ```json { "object": "PostPin", "provider": "X", "status": "unpinned", "status_id": "1850000000000000001", "previous_pinned_id": "1850000000000000001", "already": false } ``` ### 400 `errors/not_own_post`. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 401 Missing or invalid API key (`{error, message}`), `errors/disconnected_account`, or `errors/reauth_required` when X is signed out in the account's browser. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 402 `subscription_required`: the workspace has no active trial or subscription. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 404 `errors/post_not_found`. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 422 `errors/pin_unavailable` or `errors/profile_not_loaded`. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 423 `errors/x_account_locked`: X shows the account its lock page (x.com/account/access). Nothing was done; someone has to pass X's check. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 502 `errors/pin_unconfirmed`: check the profile. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 503 `errors/service_unavailable` (the account isn't ready, or the browser runner can't be reached), `errors/no_client_session`, or `errors/maintenance` with `retry_at`. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 504 `errors/timeout`. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` --- # X API: List replies > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `GET https://api.lempile.com/posts/{post_id}/comments` The replies an X post's page shows. `sort_by`: `MOST_RECENT` (the default) puts them newest first by `date`; `MOST_RELEVANT` keeps X's own order. `comment_id`: a reply's id, whose own replies come back instead. X's replies come in one page: a `cursor` answers `400 errors/invalid_parameters`, and every answer's `cursor` is `null`. Scope: `accounts.read`. ## Authentication Send your X API API key in the `X-API-KEY` header. ## Path parameters - `post_id` (string, required): The post. Example: `1850000000000000001`. ## Query parameters - `account_id` (string, required): The connected X account: its Lempile id, its X user id, or its handle. Example: `janedemo`. - `limit` (integer): Up to 100, default 50 on X. - `sort_by` (string): `MOST_RECENT` (default): newest first. `MOST_RELEVANT`: X's own order. One of: `MOST_RECENT`, `MOST_RELEVANT`. Default: `"MOST_RECENT"`. - `comment_id` (string): A reply's id: its own replies come back instead. ## Example request ```bash curl -sS "https://api.lempile.com/posts/1850000000000000001/comments?account_id=janedemo" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ## Responses ### 200 Replies. ```json { "object": "CommentList", "items": [ { "object": "Comment", "provider": "X", "id": "string", "author": "string", "author_details": { "id": "string", "public_identifier": "string", "profile_url": "string", "profile_picture_url": "string" }, "date": "2026-10-29T09:00:00Z", "text": "string", "share_url": "string", "reply_counter": 0, "comment_counter": 0, "reaction_counter": 0, "repost_counter": 0, "quote_counter": 0, "bookmark_counter": 0, "impressions_counter": 0, "user_reacted": false, "post_id": "string" } ], "cursor": null, "total_items": 0 } ``` ### 400 `errors/invalid_parameters`: a `cursor` (X's replies come in one page), or an invalid `limit`, `sort_by` or `comment_id`. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 401 Missing or invalid API key (`{error, message}`), `errors/disconnected_account`, or `errors/reauth_required` when X is signed out in the account's browser. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 402 `subscription_required`: the workspace has no active trial or subscription. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 404 `errors/resource_not_found`: no such account in this workspace, or it isn't an X account. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 423 `errors/x_account_locked`: X shows the account its lock page (x.com/account/access). Nothing was done; someone has to pass X's check. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 503 `errors/service_unavailable` (the account isn't ready, or the browser runner can't be reached), `errors/no_client_session`, or `errors/maintenance` with `retry_at`. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` --- # X API: Reply to a post > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `POST https://api.lempile.com/posts/{post_id}/comments` Replies under an X post (or under a reply, with `comment_id`) from the account's own X. If the post was edited, the reply goes under its latest version. Paced like posts; `answer: true` replies to someone who answered the account have their own 200 a day. Scope: `accounts.write`. ## Authentication Send your X API API key in the `X-API-KEY` header. ## Path parameters - `post_id` (string, required): The post to reply under. Example: `1850000000000000001`. ## Headers - `Idempotency-Key` (string, required): 1–200 characters of `A-Z a-z 0-9 . _ : -`. The same key with the same request replays the first answer; see Write receipts. Example: `post-2026-11-07-01`. ## Request body `application/json` (required) - `account_id` (string, required) - `text` (string, required) - `comment_id` (string): A reply's id (digits, as a string): the reply goes under it instead. - `answer` (boolean): This answers someone who replied to the account: counts toward the separate 200-a-day cap. - `navigation` (string): `timeline` finds the post in the account's Following feed first, as a person scrolling would, then falls back to its page; `direct` opens the post's page. Default: the post's page. One of: `timeline`, `direct`. - `author_handle` (string): The post author's X handle, which `timeline` looks for in the feed. - `dry_run` (boolean): Everything but the Reply button: the browser reaches the post, types the text, attaches the video and checks Reply could be pressed, then closes the tab. Nothing is sent: the answer is `200` `CommentDryRun` and the key is free again. Not with `comment_id`. Part of the request's `Idempotency-Key`. `multipart/form-data` (required) - `account_id` (string, required) - `text` (string, required) - `attachments` (string (binary)): One MP4 video of 50 MiB (52,428,800 bytes) at most, under the reply. It goes only once X shows it ready (up to 3 minutes). Not with `comment_id`. Part of the request's `Idempotency-Key`. - `answer` (string): This answers someone who replied to the account: counts toward the separate 200-a-day cap. One of: `true`, `false`. - `navigation` (string): As in the JSON body. One of: `timeline`, `direct`. - `author_handle` (string): As in the JSON body. - `dry_run` (string): As in the JSON body. One of: `true`, `false`. ## Example request ```bash curl -sS -X POST "https://api.lempile.com/posts/1850000000000000001/comments" \ -H "X-API-KEY: $LEMPILE_API_KEY" \ -H "Idempotency-Key: post-2026-11-07-01" \ -H "Content-Type: application/json" \ -d '{ "account_id": "janedemo", "text": "Congrats on the launch." }' ``` ## Responses ### 200 A dry run (`dry_run`): nothing was sent. `media` is what X showed for the video: its words and the seconds until Ready. ```json { "object": "CommentDryRun", "provider": "X", "not_sent": true, "media": { "status": "film.mp4: Ready", "ready_s": 21.4 } } ``` ### 201 Replied. With a video, `media` is what X showed for it; `warnings` says what the browser didn't confirm (`video_unconfirmed`, `dry_run_ignored`): the reply is out, check it on X. ```json { "object": "CommentSent", "provider": "X", "comment_id": "1850000000000000099", "via": "timeline" } ``` ### 400 Missing or invalid parameters or Idempotency-Key. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 401 Missing or invalid API key (`{error, message}`), `errors/disconnected_account`, or `errors/reauth_required` when X is signed out in the account's browser. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 402 `subscription_required`: the workspace has no active trial or subscription. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 404 `errors/resource_not_found`: no such account in this workspace, or it isn't an X account. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 409 `errors/in_progress` or `errors/account_busy`. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 422 `errors/not_sent` (the browser stopped before Reply; `code` says why, e.g. `replies_limited` when the author limits who can reply), `errors/reply_button_disabled`, `errors/idempotency_key_reused`, `errors/x_app_not_loaded`, proxy errors. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 423 `errors/x_account_locked`: X shows the account its lock page (x.com/account/access). Nothing was done; someone has to pass X's check. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 429 `errors/too_fast`, `errors/daily_limit`, `errors/answers_daily_limit` or `errors/browser_busy`, with `retry_at`. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 503 `errors/service_unavailable` (the account isn't ready, or the browser runner can't be reached), `errors/no_client_session`, or `errors/maintenance` with `retry_at`. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 504 `errors/timeout`: Reply was pressed but X didn't confirm. Read the receipt. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` --- # X API: Like a post > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `POST https://api.lempile.com/posts/reaction` Likes one X post. To like a reply, pass its id as `comment_id` (or as `post_id`). A post the account already liked stays as it is (`already: true`). Not paced; no receipt. Scope: `accounts.write`. ## Authentication Send your X API API key in the `X-API-KEY` header. ## Request body `application/json` (required) - `account_id` (string, required) - `post_id` (string, required) - `reaction_type` (string): X has only `like`. One of: `like`. Default: `"like"`. - `navigation` (string): `timeline` finds the post in the account's Following feed first, as a person scrolling would, then falls back to its page; `direct` opens the post's page. Default: the post's page. One of: `timeline`, `direct`. - `author_handle` (string): The post author's X handle, which `timeline` looks for in the feed. - `comment_id` (string): A reply's id: that reply is liked. ## Example request ```bash curl -sS -X POST "https://api.lempile.com/posts/reaction" \ -H "X-API-KEY: $LEMPILE_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "account_id": "janedemo", "post_id": "1850000000000000001" }' ``` ## Responses ### 200 Liked. ```json { "object": "ReactionAdded", "provider": "X", "post_id": "string", "reaction_type": "like", "already": false, "via": "string" } ``` ### 400 `errors/unsupported_reaction` or invalid parameters. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 401 Missing or invalid API key (`{error, message}`), `errors/disconnected_account`, or `errors/reauth_required` when X is signed out in the account's browser. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 402 `subscription_required`: the workspace has no active trial or subscription. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 404 `errors/post_not_found`. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 422 `errors/like_unavailable` or `errors/like_not_kept` (X undid the like). ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 423 `errors/x_account_locked`: X shows the account its lock page (x.com/account/access). Nothing was done; someone has to pass X's check. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 502 `errors/like_unconfirmed`: open the post before liking again. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 503 `errors/service_unavailable` (the account isn't ready, or the browser runner can't be reached), `errors/no_client_session`, or `errors/maintenance` with `retry_at`. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 504 `errors/timeout`. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` --- # X API: Repost a post, or undo a repost > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `POST https://api.lempile.com/posts/repost` A plain repost of one X post. A post the account already reposted stays as it is (`already: true`). With `undo: true`, takes the account's repost of that post back instead: X's green Repost button, then **Undo repost**, answered once the post shows its plain Repost button (`PostUnreposted`; a post it hasn't reposted answers `already: true` with nothing pressed). An undo's receipt fingerprint differs from the repost's, so one key never covers both. Not paced. Scope: `accounts.write`. ## Authentication Send your X API API key in the `X-API-KEY` header. ## Headers - `Idempotency-Key` (string): Optional. With a key, the write gets a receipt (`GET /writes/{key}`) and a repeat replays the first answer. Example: `post-2026-11-07-01`. ## Request body `application/json` (required) - `account_id` (string, required) - `post_id` (string, required): The post to repost, or (with `undo`) the post the account reposted. - `navigation` (string): `timeline` finds the post in the account's Following feed first, as a person scrolling would, then falls back to its page; `direct` opens the post's page. Default: the post's page. One of: `timeline`, `direct`. - `author_handle` (string): The post author's X handle, which `timeline` looks for in the feed. - `undo` (boolean): `true` takes the account's repost back. `true` or `false` only: any other value answers `400`. X only (a LinkedIn post answers `501`). Default: `false`. ## Example request ```bash curl -sS -X POST "https://api.lempile.com/posts/repost" \ -H "X-API-KEY: $LEMPILE_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "account_id": "janedemo", "post_id": "1850000000000000001" }' ``` ## Responses ### 200 Reposted, or (with `undo`) the repost taken back. ```json { "object": "PostReposted", "provider": "X", "post_id": "string", "already": false, "via": "string" } ``` ### 400 `errors/invalid_parameters`: no X post id, or `undo` that isn't `true` or `false`. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 401 Missing or invalid API key (`{error, message}`), `errors/disconnected_account`, or `errors/reauth_required` when X is signed out in the account's browser. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 402 `subscription_required`: the workspace has no active trial or subscription. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 404 `errors/post_not_found`. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 422 `errors/repost_unavailable` (X didn't offer Repost, or Undo repost), `errors/not_reposted` or `errors/not_unreposted`. Nothing changed. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 423 `errors/x_account_locked`: X shows the account its lock page (x.com/account/access). Nothing was done; someone has to pass X's check. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 501 `errors/feature_not_implemented`: `undo` on a LinkedIn post. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 502 `errors/repost_unconfirmed`: check the post; doing it again changes nothing. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 503 `errors/service_unavailable` (the account isn't ready, or the browser runner can't be reached), `errors/no_client_session`, or `errors/maintenance` with `retry_at`. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 504 `errors/timeout`. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` --- # X API: List likers > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `GET https://api.lempile.com/posts/{post_id}/reactions` Who liked one of the account's own posts. X shows a post's likers to its author only. Read-only. Scope: `accounts.read`. ## Authentication Send your X API API key in the `X-API-KEY` header. ## Path parameters - `post_id` (string, required): One of the account's own posts. Example: `1850000000000000001`. ## Query parameters - `account_id` (string, required): The connected X account: its Lempile id, its X user id, or its handle. Example: `janedemo`. - `limit` (integer): 1–200, default 100. Default: `100`. ## Example request ```bash curl -sS "https://api.lempile.com/posts/1850000000000000001/reactions?account_id=janedemo" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ## Responses ### 200 Likers. ```json { "object": "ReactionList", "provider": "X", "post_id": "string", "items": [ { "object": "Reaction", "value": "LIKE", "author": { "id": "string", "public_identifier": "string", "name": "string", "profile_url": "string" } } ], "cursor": null, "total_items": 0 } ``` ### 401 Missing or invalid API key (`{error, message}`), `errors/disconnected_account`, or `errors/reauth_required` when X is signed out in the account's browser. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 402 `subscription_required`: the workspace has no active trial or subscription. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 404 `errors/resource_not_found`: no such account in this workspace, or it isn't an X account. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 423 `errors/x_account_locked`: X shows the account its lock page (x.com/account/access). Nothing was done; someone has to pass X's check. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 503 `errors/service_unavailable` (the account isn't ready, or the browser runner can't be reached), `errors/no_client_session`, or `errors/maintenance` with `retry_at`. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` --- # X API: Follow an account, or unfollow it > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `POST https://api.lempile.com/users/follow` Follows one X account. An account already followed (or asked to follow) stays as it is (`already: true`). With `undo: true`, unfollows it instead: the profile's own Following button, then X's **Unfollow**, answered once the profile shows its Follow button again (`UserUnfollowed`; an account it doesn't follow answers `already: true` with nothing pressed). An unfollow's receipt fingerprint differs from the follow's, so one key never covers both. Not paced. Scope: `accounts.write`. ## Authentication Send your X API API key in the `X-API-KEY` header. ## Headers - `Idempotency-Key` (string): Optional. With a key, the write gets a receipt (`GET /writes/{key}`) and a repeat replays the first answer. Example: `post-2026-11-07-01`. ## Request body `application/json` (required) - `account_id` (string, required) - `identifier` (string, required): The X handle to follow (or, with `undo`, to unfollow), with or without `@`. - `undo` (boolean): `true` unfollows the account. `true` or `false` only: any other value answers `400`. X only (a LinkedIn account answers `501`). Default: `false`. ## Example request ```bash curl -sS -X POST "https://api.lempile.com/users/follow" \ -H "X-API-KEY: $LEMPILE_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "account_id": "janedemo", "identifier": "@marclou" }' ``` ## Responses ### 200 Followed, or (with `undo`) unfollowed. ```json { "object": "UserFollowed", "provider": "X", "identifier": "string", "already": false } ``` ### 400 `errors/invalid_parameters` (no X handle, or `undo` that isn't `true` or `false`), `errors/cannot_follow_self` or `errors/cannot_unfollow_self`. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 401 Missing or invalid API key (`{error, message}`), `errors/disconnected_account`, or `errors/reauth_required` when X is signed out in the account's browser. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 402 `subscription_required`: the workspace has no active trial or subscription. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 404 `errors/user_not_found`. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 422 `errors/profile_not_loaded`, `errors/follow_unavailable` or `errors/follow_not_kept`; with `undo`, `errors/unfollow_unavailable` (X showed no Following button) or `errors/unfollow_unconfirmed` (X didn't ask to confirm). Nothing changed. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 423 `errors/x_account_locked`: X shows the account its lock page (x.com/account/access). Nothing was done; someone has to pass X's check. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 429 `errors/follow_limited`: X says the account can't follow more people right now. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 501 `errors/feature_not_implemented`: a LinkedIn account. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 502 `errors/follow_unconfirmed` or `errors/unfollow_unconfirmed`: check the profile; doing it again changes nothing. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 503 `errors/service_unavailable` (the account isn't ready, or the browser runner can't be reached), `errors/no_client_session`, or `errors/maintenance` with `retry_at`. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 504 `errors/timeout`. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` --- # X API: List followers > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `GET https://api.lempile.com/users/followers` The account's own newest X followers, newest first. Read-only. Scope: `accounts.read`. ## Authentication Send your X API API key in the `X-API-KEY` header. ## Query parameters - `account_id` (string, required): The connected X account: its Lempile id, its X user id, or its handle. Example: `janedemo`. - `limit` (integer): 1–1000, default 100. Default: `100`. ## Example request ```bash curl -sS "https://api.lempile.com/users/followers?account_id=janedemo" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ## Responses ### 200 Followers. ```json { "object": "UserFollowerList", "provider": "X", "items": [ { "object": "UserFollower", "id": "string", "public_identifier": "string", "name": "string", "profile_url": "string" } ], "cursor": null } ``` ### 401 Missing or invalid API key (`{error, message}`), `errors/disconnected_account`, or `errors/reauth_required` when X is signed out in the account's browser. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 402 `subscription_required`: the workspace has no active trial or subscription. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 404 `errors/resource_not_found`: no such account in this workspace, or it isn't an X account. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 423 `errors/x_account_locked`: X shows the account its lock page (x.com/account/access). Nothing was done; someone has to pass X's check. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 503 `errors/service_unavailable` (the account isn't ready, or the browser runner can't be reached), `errors/no_client_session`, or `errors/maintenance` with `retry_at`. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` --- # X API: List whom the account follows > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `GET https://api.lempile.com/users/me/following` The accounts the X account follows, newest follow first: what a rebrand unfollows (`POST /users/follow` with `undo: true`). X's own data first, the account's Following page when that fails; nothing is clicked. Also at `/users/following`, the twin of `/users/followers`. Read-only. Scope: `accounts.read`. ## Authentication Send your X API API key in the `X-API-KEY` header. ## Query parameters - `account_id` (string, required): The connected X account: its Lempile id, its X user id, or its handle. Example: `janedemo`. - `limit` (integer): 1–1000, default 100. Default: `100`. ## Example request ```bash curl -sS "https://api.lempile.com/users/me/following?account_id=janedemo" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ## Responses ### 200 Whom it follows. ```json { "object": "UserFollowingList", "provider": "X", "items": [ { "object": "UserFollowing", "id": "marclou", "public_identifier": "marclou", "name": "Marc Lou", "profile_url": "https://x.com/marclou" } ], "cursor": null } ``` ### 401 Missing or invalid API key (`{error, message}`), `errors/disconnected_account`, or `errors/reauth_required` when X is signed out in the account's browser. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 402 `subscription_required`: the workspace has no active trial or subscription. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 404 `errors/resource_not_found`: no such account in this workspace, or it isn't an X account. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 423 `errors/x_account_locked`: X shows the account its lock page (x.com/account/access). Nothing was done; someone has to pass X's check. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 501 `errors/feature_not_implemented`: a LinkedIn account. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 503 `errors/service_unavailable` (the account isn't ready, or the browser runner can't be reached), `errors/no_client_session`, or `errors/maintenance` with `retry_at`. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` --- # X API: Search posts > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `GET https://api.lempile.com/posts/search` The latest posts for a search, as the account sees them on X's Latest tab: newest first, reposts left out. Read-only. Scope: `accounts.read`. ## Authentication Send your X API API key in the `X-API-KEY` header. ## Query parameters - `account_id` (string, required): The connected X account: its Lempile id, its X user id, or its handle. Example: `janedemo`. - `q` (string, required): X search words and operators, up to 300 characters. Example: `"just launched" min_faves:50`. - `limit` (integer): 1–50, default 20. Default: `20`. ## Example request ```bash curl -sS "https://api.lempile.com/posts/search?account_id=janedemo&q=%22just+launched%22+min_faves%3A50" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ## Responses ### 200 Posts. ```json { "object": "PostList", "provider": "X", "query": "string", "items": [ { "object": "Post", "provider": "X", "id": "string", "author": "string", "author_details": { "id": "string", "public_identifier": "string", "profile_url": "string", "profile_picture_url": "string" }, "date": "2026-10-29T09:00:00Z", "text": "string", "share_url": "string", "reply_counter": 0, "comment_counter": 0, "reaction_counter": 0, "repost_counter": 0, "quote_counter": 0, "bookmark_counter": 0, "impressions_counter": 0, "user_reacted": false } ], "cursor": null } ``` ### 401 Missing or invalid API key (`{error, message}`), `errors/disconnected_account`, or `errors/reauth_required` when X is signed out in the account's browser. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 402 `subscription_required`: the workspace has no active trial or subscription. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 404 `errors/resource_not_found`: no such account in this workspace, or it isn't an X account. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 422 `errors/search_not_loaded`: X showed neither posts nor its empty-results notice. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 423 `errors/x_account_locked`: X shows the account its lock page (x.com/account/access). Nothing was done; someone has to pass X's check. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 503 `errors/service_unavailable` (the account isn't ready, or the browser runner can't be reached), `errors/no_client_session`, or `errors/maintenance` with `retry_at`. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` --- # X API: List a profile's posts > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `GET https://api.lempile.com/users/{identifier}/posts` An X profile's newest posts, reposts left out. It comes in one page: a `cursor` answers `400 errors/invalid_parameters`, and the answer's `cursor` is always `null`; an empty list means no post showed within 25 seconds. Scope: `accounts.read`. ## Authentication Send your X API API key in the `X-API-KEY` header. ## Path parameters - `identifier` (string, required): The X handle (with or without `@`). Example: `marclou`. ## Query parameters - `account_id` (string, required): The connected X account: its Lempile id, its X user id, or its handle. Example: `janedemo`. - `limit` (integer): Default 20, at most 100. Default: `20`. ## Example request ```bash curl -sS "https://api.lempile.com/users/marclou/posts?account_id=janedemo" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ## Responses ### 200 Posts. ```json { "object": "PostList", "provider": "X", "query": "string", "items": [ { "object": "Post", "provider": "X", "id": "string", "author": "string", "author_details": { "id": "string", "public_identifier": "string", "profile_url": "string", "profile_picture_url": "string" }, "date": "2026-10-29T09:00:00Z", "text": "string", "share_url": "string", "reply_counter": 0, "comment_counter": 0, "reaction_counter": 0, "repost_counter": 0, "quote_counter": 0, "bookmark_counter": 0, "impressions_counter": 0, "user_reacted": false } ], "cursor": null } ``` ### 400 `errors/invalid_parameters`: a `cursor` (X lists come in one page). ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 401 Missing or invalid API key (`{error, message}`), `errors/disconnected_account`, or `errors/reauth_required` when X is signed out in the account's browser. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 402 `subscription_required`: the workspace has no active trial or subscription. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 404 `errors/user_not_found`, or the account isn't found. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 423 `errors/x_account_locked`: X shows the account its lock page (x.com/account/access). Nothing was done; someone has to pass X's check. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 503 `errors/service_unavailable` (the account isn't ready, or the browser runner can't be reached), `errors/no_client_session`, or `errors/maintenance` with `retry_at`. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` --- # X API: List the account's own posts > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `GET https://api.lempile.com/users/me/posts` The account's own posts, replies or reposts, newest first, from its profile's tabs: what a rebrand deletes (`DELETE /posts/{post_id}`) or undoes (`POST /posts/repost` with `undo: true` and the item's `reposted_id`). X's own data first; when it can't be had, the tab itself, read while it's scrolled like a person. Nothing is clicked. On a LinkedIn account this is `/users/{identifier}/posts`. Scope: `accounts.read`. ## Authentication Send your X API API key in the `X-API-KEY` header. ## Query parameters - `account_id` (string, required): The connected X account: its Lempile id, its X user id, or its handle. Example: `janedemo`. - `kind` (string): `posts` (the Posts tab: the account's posts, the pinned one marked `pinned`), `replies` (the Replies tab: its replies, each with `in_reply_to`) or `reposts` (each with `reposted_id`). One of: `posts`, `replies`, `reposts`. Default: `"posts"`. - `limit` (integer): 1–100, default 20. Default: `20`. - `cursor` (string): The previous page's `cursor`. It still works once you deleted the post it names: the page goes on from the older ones. ## Example request ```bash curl -sS "https://api.lempile.com/users/me/posts?account_id=janedemo" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ## Responses ### 200 The items, and the next page's cursor (`null` at the end). ```json { "object": "OwnPostList", "provider": "X", "account_id": "11111111-1111-4111-8111-111111111111", "kind": "reposts", "items": [ { "object": "OwnPost", "id": "1850000000000000003", "kind": "repost", "text": "Shipped my app", "created_at": "2026-11-07T09:00:00.000Z", "reposted_id": "1700000000000000009" } ], "cursor": "1850000000000000003" } ``` ### 400 `errors/missing_parameters` or `errors/invalid_parameters`: a `kind`, `limit` or `cursor` it doesn't take. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 401 Missing or invalid API key (`{error, message}`), `errors/disconnected_account`, or `errors/reauth_required` when X is signed out in the account's browser. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 402 `subscription_required`: the workspace has no active trial or subscription. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 404 `errors/resource_not_found`: no such account in this workspace, or it isn't an X account. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 422 `errors/timeline_not_loaded`: the profile showed neither posts nor its empty notice (never an empty list), or `errors/x_app_not_loaded`. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 423 `errors/x_account_locked`: X shows the account its lock page (x.com/account/access). Nothing was done; someone has to pass X's check. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 503 `errors/service_unavailable` (the account isn't ready, or the browser runner can't be reached), `errors/no_client_session`, or `errors/maintenance` with `retry_at`. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 504 `errors/timeout`: nothing was changed; try again. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` --- # X API: Retrieve the profile > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `GET https://api.lempile.com/users/me` The account's own X profile as X's Edit profile window and Change username page show it (Unipile's `AccountOwnerProfile` fields where it has them). The browser reads them and presses nothing: it's a dry run of the edit. Empty fields are `null`. When X shows another handle than Lempile has on record, the record follows. On a LinkedIn account this is LinkedIn's own profile read. Scope: `accounts.read`. ## Authentication Send your X API API key in the `X-API-KEY` header. ## Query parameters - `account_id` (string, required): The connected X account: its Lempile id, its X user id, or its handle. Example: `janedemo`. ## Example request ```bash curl -sS "https://api.lempile.com/users/me?account_id=janedemo" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ## Responses ### 200 The profile. ```json { "object": "AccountOwnerProfile", "provider": "X", "account_id": "11111111-1111-4111-8111-111111111111", "name": "LAUNCH WIRE", "username": "launchwire", "public_identifier": "launchwire", "public_profile_url": "https://x.com/launchwire", "bio": "Every launch worth knowing, as it ships.", "location": null, "website": "https://launchwire.example", "profile_picture_url": "https://pbs.twimg.com/profile_images/2/new.jpg", "cover_picture_url": "https://pbs.twimg.com/profile_banners/9/1700000000", "can_change_username": true } ``` ### 401 Missing or invalid API key (`{error, message}`), `errors/disconnected_account`, or `errors/reauth_required` when X is signed out in the account's browser. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 402 `subscription_required`: the workspace has no active trial or subscription. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 404 `errors/resource_not_found`: no such account in this workspace, or it isn't an X account. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 422 `errors/profile_field_not_found` or `errors/x_app_not_loaded`: X's Edit profile didn't show. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 423 `errors/x_account_locked`: X shows the account its lock page (x.com/account/access). Nothing was done; someone has to pass X's check. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 503 `errors/service_unavailable` (the account isn't ready, or the browser runner can't be reached), `errors/no_client_session`, or `errors/maintenance` with `retry_at`. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 504 `errors/timeout`: nothing was changed; try again. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` --- # X API: Edit the profile > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `PATCH https://api.lempile.com/users/me/edit` Unipile's "Edit own profile" for an X account: `name`, `bio`, `location`, `website`, `avatar`, `banner` and `username`, any of them (the others stay as they are). `POST` works too. The browser reads X's Edit profile, gives it the pictures (through X's crop window, as is), types each field that isn't already as asked, checks the others unchanged, presses Save and reads everything back on a fresh window; the handle comes last, on X's Change username page, checked free, saved and read back. On a verified account a new name, avatar or handle removes the checkmark until X reviews it again: X asks at Save, and Lempile confirms that notice. After a new handle, Lempile's record of the account follows in the same request. With `website` alone the answer is the Website edit's, as it has been since Nov 3 2026: `{ website, previous_website, already }`, or `{ website, would }` for a dry run. Pictures and a handle can take a few minutes: the request waits 140 seconds, then answers `504 errors/timeout` while the browser goes on (up to 10 minutes); send an `Idempotency-Key` and read `GET /writes/{key}`. Scope: `accounts.write`. ## Authentication Send your X API API key in the `X-API-KEY` header. ## Headers - `Idempotency-Key` (string): Optional. With a key, the write gets a receipt (`GET /writes/{key}`) and a repeat replays the first answer. Example: `post-2026-11-07-01`. ## Request body `multipart/form-data` (required) - `account_id` (string, required): Body only. - `type` (string): One of: `X`, `TWITTER`. - `name` (string): One line. Counted as X counts it (an emoji is 2). - `bio` (string): Line breaks kept; `""` clears it. Unipile's `summary` is taken too. - `location` (string): One line; `""` clears it. Words, not Unipile's LinkedIn place id. - `website` (string (uri)): One https address, a host with a dot, no spaces or credentials. It can't be emptied. - `username` (string): The new handle, with or without `@`. It comes last, on X's Change username page. - `dry_run` (boolean): Reads every window and answers `ProfileEditDryRun`: nothing is given, typed or pressed. `true` or `false` only. - `avatar` (string (binary)): A JPEG or PNG of at most 2 MB. Unipile's `picture` is taken too. - `banner` (string (binary)): The header photo: a JPEG or PNG of at most 5 MB. Unipile's `cover_picture` is taken too. `application/json` (required) - `account_id` (string, required): Body only. - `type` (string): One of: `X`, `TWITTER`. - `name` (string): One line. Counted as X counts it (an emoji is 2). - `bio` (string): Line breaks kept; `""` clears it. Unipile's `summary` is taken too. - `location` (string): One line; `""` clears it. Words, not Unipile's LinkedIn place id. - `website` (string (uri)): One https address, a host with a dot, no spaces or credentials. It can't be emptied. - `custom_link` (object): Unipile's form of `website`; must match it when both are given. - `url` (string) - `type` (any) - `username` (string): The new handle, with or without `@`. It comes last, on X's Change username page. - `dry_run` (boolean): Reads every window and answers `ProfileEditDryRun`: nothing is given, typed or pressed. `true` or `false` only. - `avatar` (ProfilePicture) - `name` (string) - `content_type` (string): Optional: the type is read from the file's bytes. One of: `image/jpeg`, `image/png`. - `data_base64` (string, required): The file's bytes in base64, no `data:` prefix. - `banner` (ProfilePicture) - `name` (string) - `content_type` (string): Optional: the type is read from the file's bytes. One of: `image/jpeg`, `image/png`. - `data_base64` (string, required): The file's bytes in base64, no `data:` prefix. ## Example request ```bash curl -sS -X PATCH "https://api.lempile.com/users/me/edit" \ -H "X-API-KEY: $LEMPILE_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "account_id": "janedemo", "type": "X", "website": "https://example.com/?ref=x" }' ``` ## Responses ### 200 Saved and read back, or a dry run. ```json { "object": "ProfileEdited", "provider": "X", "account_id": "string", "changed": {}, "previous": {}, "already": [ "string" ], "avatar_changed": false, "banner_changed": false, "username": "string", "website": "string", "previous_website": "string" } ``` ### 400 `errors/invalid_parameters` or the browser's `errors/invalid_*`: a field X wouldn't take (a picture that isn't a JPEG or PNG, is empty, isn't valid base64 or is too large; a handle that isn't 4–15 letters, digits or `_`; `dry_run` that isn't `true` or `false`…). Nothing was changed. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 401 Missing or invalid API key (`{error, message}`), `errors/disconnected_account`, or `errors/reauth_required` when X is signed out in the account's browser. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 402 `subscription_required`: the workspace has no active trial or subscription. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 403 `errors/password_required`: X asks for the account's password to change the handle; Lempile never types it. `errors/insufficient_permissions`: the key lacks `accounts.write`. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 404 `errors/resource_not_found`: no such account in this workspace, or it isn't an X account. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 409 `errors/username_taken`: X says the handle isn't free. `errors/in_progress`: the same key is still running. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 413 `errors/payload_too_large`: the body is over 24 MiB (25,165,824 bytes); a picture is 8 MiB at most. Refused before it was read; nothing was changed. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 422 `errors/username_field_not_found` (no Username field on X's Change username page, as while an X Premium check is under review), `errors/username_refused`, `errors/username_check_failed`, `errors/username_not_kept`, `errors/profile_photo_input_not_found`, `errors/profile_photo_not_taken`, `errors/profile_field_not_found`, `errors/typing_failed`, `errors/profile_fields_changed`, `errors/profile_save_unavailable`, `errors/profile_value_not_kept` (`detail` quotes what X said) or `errors/idempotency_key_reused`. A refusal after the Edit profile part was saved carries `done`. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 423 `errors/x_account_locked`: X shows the account its lock page (x.com/account/access). Nothing was done; someone has to pass X's check. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 429 `errors/files_busy`: other big files are being sent right now. Nothing was changed; send it again at `retry_at`. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 501 `errors/feature_not_implemented`: a field an X profile doesn't have, or a `type` naming a network Lempile doesn't edit. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 502 `errors/profile_unconfirmed` or `errors/username_unconfirmed`: saved but not read back. Read the profile before trying again. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 503 `errors/service_unavailable` (the account isn't ready, or the browser runner can't be reached), `errors/no_client_session`, or `errors/maintenance` with `retry_at`. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 504 `errors/timeout`: still running, or not sure. Read the receipt. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` --- # X API: Retrieve analytics > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `GET https://api.lempile.com/accounts/{account_id}/analytics` The X account's own analytics by UTC day, read from its analytics page (x.com/i/account_analytics, which needs X Premium). Complete days only: `to` is capped at yesterday (UTC). Each count is X's daily series; `engagements`, `engagement_rate` and `shares` are always `null` (X has them by the hour only). Read-only. Scope: `accounts.read`. ## Authentication Send your X API API key in the `X-API-KEY` header. ## Path parameters - `account_id` (string, required): Lempile id, X user id or handle. Example: `janedemo`. ## Query parameters - `from` (string (date), required): First day, `YYYY-MM-DD`. Example: `2026-10-01`. - `to` (string (date), required): Last day, `YYYY-MM-DD`; at most 365 days after `from`. Example: `2026-10-31`. ## Example request ```bash curl -sS "https://api.lempile.com/accounts/janedemo/analytics?from=2026-10-01&to=2026-10-31" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ## Responses ### 200 Analytics. ```json { "account_id": "string", "object": "AccountAnalytics", "provider": "X", "from": "string", "to": "string", "read_at": "2026-10-29T09:00:00Z", "days": [ { "date": "2026-10-29", "impressions": 0, "likes": 0, "replies": 0, "reposts": 0, "quotes": 0, "bookmarks": 0, "profile_visits": 0, "posts": 0, "replies_sent": 0, "quotes_sent": 0, "new_follows": 0, "unfollows": 0, "engagements": 0, "engagement_rate": 0, "shares": 0 } ], "totals": { "date": "2026-10-29", "impressions": 0, "likes": 0, "replies": 0, "reposts": 0, "quotes": 0, "bookmarks": 0, "profile_visits": 0, "posts": 0, "replies_sent": 0, "quotes_sent": 0, "new_follows": 0, "unfollows": 0, "engagements": 0, "engagement_rate": 0, "shares": 0 }, "followers": { "total": 0, "verified": 0, "active": 0 } } ``` ### 400 `errors/invalid_parameters`. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 401 Missing or invalid API key (`{error, message}`), `errors/disconnected_account`, or `errors/reauth_required` when X is signed out in the account's browser. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 402 `subscription_required`: the workspace has no active trial or subscription. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 404 `errors/resource_not_found`: no such account in this workspace, or it isn't an X account. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 422 `errors/analytics_unavailable`: X doesn't show analytics to this account yet (e.g. under X's follower floor). ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 423 `errors/x_account_locked`: X shows the account its lock page (x.com/account/access). Nothing was done; someone has to pass X's check. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 502 `errors/analytics_not_loaded` (no Premium, or the page didn't finish) or `errors/analytics_failed`. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 503 `errors/service_unavailable` (the account isn't ready, or the browser runner can't be reached), `errors/no_client_session`, or `errors/maintenance` with `retry_at`. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` --- # X API: Capture a page > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `POST https://api.lempile.com/accounts/{account_id}/capture` A JPEG of one page, opened in the X account's own browser and proxy. Read-only: a new tab, cookie banners and X's overlays hidden with CSS (never clicked), the picture, the tab closed. Not a write: no `Idempotency-Key`, no receipt, not paced. It opens only: - **A public X post**, exactly `https://x.com//status/` (handle 1–15 letters, digits or `_`, not `i`; 1–25 digits; no query, fragment or trailing slash; `x.com` only). The picture is the post's own article, read from the account's own signed-in X, taken only when X shows it under that handle, ending at its action bar. No `clip.selector`; with `x_post: { counts: false }` the time and views row and the action bar are left out too. - **A status page**: `https://`, `https:///` or `https:///incidents/` (8–40 letters or digits) on `www.vercel-status.com`, `www.githubstatus.com`, `status.supabase.com`, `www.cloudflarestatus.com`, `status.openai.com`, `status.claude.com`, `www.netlifystatus.com`, `status.render.com`, `status.flyio.net`, `status.clerk.com`, `resend-status.com`. - **The account's own X**: `https://x.com/` and `https://x.com/i/account_analytics`. - **The account's own notifications**, exactly `https://x.com/notifications` (no tab, query, fragment or trailing slash), from its own signed-in X. The picture is one "followed you" notification, never the page: the newest with at least `x_notifications.min_others` others. Every name in it is blurred (an emoji in a name too), so is any other text that isn't X's own words, and every avatar unless `x_notifications.blur_avatars` is `false` (CSS in that tab only: nothing posted, typed or clicked); right before and after the picture the browser checks that only X's own words ("and 12 others followed you") stay readable, else `names_not_blurred`. `notification` says how many others X counted. No `clip.selector`. Opening the page clears the account's unread badge on X, as any visit does. - **News pages**: any page on `blog.google`, `developers.google.com`, `blogs.bing.com`, `www.seroundtable.com`, `techcrunch.com`; `https://news.ycombinator.com/item?id=`; and any page on a site Lempile added to your workspace's list. - **Story sources**: any page on the company blogs and changelogs `openai.com`, `deepmind.google`, `developers.googleblog.com`, `github.blog`, `vercel.com`, `blog.cloudflare.com`, `supabase.com`, `stripe.com`, `huggingface.co`, `cursor.com`, `blog.replit.com`, `railway.com`, `neon.com`, `developer.apple.com`, `blogs.nvidia.com`, `aws.amazon.com`; any page on the outlets `www.theverge.com`, `arstechnica.com`, `www.wired.com`, `www.theregister.com`, `9to5mac.com`, `www.bloomberg.com`, `www.theinformation.com`, `www.404media.co`, `www.platformer.news`; and only `github.com///releases`, `/releases/latest` or `/releases/tag/`; `replit.com/blog` and `/blog/`; `www.npmjs.com/package/` (or `@/`, optionally `/v/`); any page on `pypistats.org`; `apps.apple.com//app//id`; `www.producthunt.com/posts/`, `/products/` or `/products//launches/` (no query or fragment on those). The picture is the article's headline area (kicker, title, dek, byline, lead picture or chart; a blog, changelog or data page with no lead picture goes on into its first lines), or `clip.selector`; a page with no headline is pictured from its top (`crop` says which). Fixed and sticky layers (cookie and consent banners, newsletter pop-ups, sticky headers, paywall overlays) are hidden with CSS; a bot check, a paywall or a consent wall over the headline answers `page_blocked`. Hosts match exactly. The browser checks the address again before opening it and after the page loads. When the page gave no picture the answer is still `200`, with `ok: false` and the browser's `code`. Scope: `accounts.write`. ## Authentication Send your X API API key in the `X-API-KEY` header. ## Path parameters - `account_id` (string, required): Lempile id, X user id or handle. Example: `janedemo`. ## Request body `application/json` (required) - `url` (string (uri), required): One of the addresses the capture opens, exactly. - `width` (integer): CSS pixels (under 768, X and most sites draw their phone layout). Default: `520`. - `dpr` (integer): Default: `2`. - `clip` (object) - `maxHeight` (integer): CSS pixels: the picture stops there. `max_height` works too. Default: `1600`. - `selector` (string): The picture is that element. Not on an X post. On a story source page it replaces the headline's area. - `x_post` (object): X posts only: on another address it answers `400`. - `counts` (boolean): `false` leaves out the post's time and views row and its action bar (no views, replies, reposts, likes or bookmarks); the picture ends 16 px under its last content. Default: `true`. - `x_notifications` (object): `https://x.com/notifications` only: on another address it answers `400`. - `min_others` (integer): The fewest others the "followed you" notification must count. Default: `0`. - `blur_avatars` (boolean): `false` leaves the avatars sharp. The names are always blurred. Default: `true`. ## Example request ```bash curl -sS -X POST "https://api.lempile.com/accounts/janedemo/capture" \ -H "X-API-KEY: $LEMPILE_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "url": "https://x.com/OpenAI/status/1986000000000000001", "width": 520, "dpr": 2 }' ``` ## Responses ### 200 The picture (`ok: true`), or why there is none (`ok: false` with `code`). ```json { "object": "PageCapture", "ok": true, "account_id": "11111111-1111-4111-8111-111111111111", "url": "https://x.com/OpenAI/status/1986000000000000001", "final_url": "https://x.com/OpenAI/status/1986000000000000001", "title": "OpenAI on X: \"…\" / X", "width": 1040, "height": 1224, "jpeg_base64": "/9j/4AAQSkZJRg…", "captured_at": "2026-11-07T18:20:00.000Z" } ``` ### 400 `errors/invalid_parameters`: an address it doesn't open (the detail lists them), a field out of range, or `clip.selector` on an X post. `errors/missing_parameters`: no `url`. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 401 Missing or invalid API key (`{error, message}`), `errors/disconnected_account`, or `errors/reauth_required` when X is signed out in the account's browser. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 402 `subscription_required`: the workspace has no active trial or subscription. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 403 `errors/insufficient_permissions`: the key lacks `accounts.write`. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 404 `errors/resource_not_found`: no such account in this workspace, or it isn't an X account. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 422 `errors/proxy_auth_failed` or `errors/proxy_unreachable`: the account's proxy is down. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 423 `errors/x_account_locked`: X shows the account its lock page (x.com/account/access). Nothing was done; someone has to pass X's check. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 503 `errors/service_unavailable` (the account isn't ready, or the browser runner can't be reached), `errors/no_client_session`, or `errors/maintenance` with `retry_at`. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 504 `errors/timeout`: no picture within 90 seconds. Nothing was clicked or typed. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` --- # X API: Publish an Article > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `POST https://api.lempile.com/articles` Builds one X Article in a new draft (title, every block in order, cover), reads the draft back, and publishes it only if X kept exactly those blocks; otherwise nothing is published and the draft stays in the account's Drafts. It takes minutes, so this answers `202` and `GET /articles/{key}` says where it is. The same key never builds twice. Paced like posts unless `dry_run`. Scope: `accounts.write`. ## Authentication Send your X API API key in the `X-API-KEY` header. ## Headers - `Idempotency-Key` (string, required): 1–200 characters of `A-Z a-z 0-9 . _ : -`. The same key with the same request replays the first answer; see Write receipts. Example: `post-2026-11-07-01`. ## Request body `application/json` (required) - `account_id` (string, required) - `title` (string, required) - `cover` (ArticleFile) - `name` (string, required) - `content_type` (string, required): One of: `image/jpeg`, `image/png`, `image/webp`. - `data_base64` (string, required) - `blocks` (array of ArticleBlock, required): Images: 30 at most, 8 MB each, 40 MB in all. - Option 1: object - `kind` (any, required) - `html` (string, required) - `plain` (string) - Option 2: object - `kind` (any, required) - `alt` (string) - `file` (ArticleFile, required) - `name` (string, required) - `content_type` (string, required): One of: `image/jpeg`, `image/png`, `image/webp`. - `data_base64` (string, required) - Option 3: object - `kind` (any, required) - `text` (string, required) - `dry_run` (boolean): Builds and checks the draft but never publishes. ## Example request ```bash curl -sS -X POST "https://api.lempile.com/articles" \ -H "X-API-KEY: $LEMPILE_API_KEY" \ -H "Idempotency-Key: post-2026-11-07-01" \ -H "Content-Type: application/json" \ -d '{ "account_id": "string", "title": "string", "cover": { "name": "string", "content_type": "image/jpeg", "data_base64": "string" }, "blocks": [ { "kind": "text", "html": "string", "plain": "string" } ], "dry_run": false }' ``` ## Responses ### 202 Building. ```json { "object": "ArticleJob", "id": "article-2026-11-07", "account_id": "11111111-1111-4111-8111-111111111111", "status": "building", "detail": "Starting." } ``` ### 400 Invalid body or Idempotency-Key. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 401 Missing or invalid API key (`{error, message}`), `errors/disconnected_account`, or `errors/reauth_required` when X is signed out in the account's browser. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 402 `subscription_required`: the workspace has no active trial or subscription. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 404 `errors/resource_not_found`: no such account in this workspace, or it isn't an X account. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 409 `account_busy`: another Article is building on this account. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 413 `errors/payload_too_large`: the body is over 60 MiB (62,914,560 bytes); images are 8 MiB each, 40 MiB in all. Refused before it was read; nothing was published. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 422 `not_sent`: nothing was published; `code` and `detail` say why. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 423 `errors/x_account_locked`: X shows the account its lock page (x.com/account/access). Nothing was done; someone has to pass X's check. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 429 `errors/too_fast` or `errors/daily_limit`, or `errors/files_busy` (other big files are being sent; nothing was published), with `retry_at`. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 503 `errors/service_unavailable` (the account isn't ready, or the browser runner can't be reached), `errors/no_client_session`, or `errors/maintenance` with `retry_at`. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` --- # X API: Retrieve an Article job > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `GET https://api.lempile.com/articles/{key}` Where one Article is, by the `Idempotency-Key` it was sent with: `building` (202), `published` (200, `url`, `article_id`), `draft` (200, a dry run, `draft_url`), `not_sent` (422, or 409 for `account_busy`) or `unknown` (200: Publish was pressed but X didn't confirm; check the account's Articles before sending again). Scope: `accounts.read`. ## Authentication Send your X API API key in the `X-API-KEY` header. ## Path parameters - `key` (string, required): The Idempotency-Key the Article was sent with. Example: `article-2026-11-07`. ## Example request ```bash curl -sS "https://api.lempile.com/articles/article-2026-11-07" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ## Responses ### 200 Published, draft or unknown. ```json { "object": "ArticleJob", "id": "string", "account_id": "string", "status": "building", "url": "string", "article_id": "string", "draft_url": "string", "code": "string", "detail": "string" } ``` ### 202 Still building. ```json { "object": "ArticleJob", "id": "string", "account_id": "string", "status": "building", "url": "string", "article_id": "string", "draft_url": "string", "code": "string", "detail": "string" } ``` ### 401 Missing or invalid API key (`{error, message}`), `errors/disconnected_account`, or `errors/reauth_required` when X is signed out in the account's browser. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 402 `subscription_required`: the workspace has no active trial or subscription. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 404 `errors/not_found`: no Article with this key. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 422 Not sent. ```json { "object": "ArticleJob", "id": "string", "account_id": "string", "status": "building", "url": "string", "article_id": "string", "draft_url": "string", "code": "string", "detail": "string" } ``` --- # X API: Retrieve a write receipt > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `GET https://api.lempile.com/writes/{key}` What became of one write sent with an `Idempotency-Key` (`POST /posts`, replies, and follows, reposts, pins and profile edits sent with a key). `state` is `done` (sent: `response` is the stored answer), `failed` (nothing was sent), `pending` (still running, or not sure) or `none`. The browser's answer is kept 48 hours, also after the request stopped waiting. Scope: `accounts.read` or `accounts.write`. ## Authentication Send your X API API key in the `X-API-KEY` header. ## Path parameters - `key` (string, required): The write's Idempotency-Key. Example: `post-2026-11-07-01`. ## Example request ```bash curl -sS "https://api.lempile.com/writes/post-2026-11-07-01" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ## Responses ### 200 The receipt. ```json { "object": "WriteStatus", "key": "post-2026-11-07-01", "state": "done", "status": 201, "response": { "object": "PostCreated", "provider": "X", "post_id": "1850000000000000001" } } ``` ### 401 Missing or invalid API key (`{error, message}`), `errors/disconnected_account`, or `errors/reauth_required` when X is signed out in the account's browser. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 402 `subscription_required`: the workspace has no active trial or subscription. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 403 `insufficient_permissions`: the key has neither `accounts.read` nor `accounts.write`. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` --- # X API: Mark a write not sent > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `POST https://api.lempile.com/writes/{key}/not-sent` After you checked on X that a pending write isn't there: marks it not sent, so the key can be sent again and it stops counting toward the pace. A write Lempile has as sent stays sent (`409`), and one under 5 minutes old or still running answers `409`. Scope: `accounts.write`. ## Authentication Send your X API API key in the `X-API-KEY` header. ## Path parameters - `key` (string, required): The write's Idempotency-Key. ## Example request ```bash curl -sS -X POST "https://api.lempile.com/writes/{key}/not-sent" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ## Responses ### 200 Marked not sent (or already not sent). ```json { "object": "WriteStatus", "key": "string", "state": "none", "status": 0, "response": {} } ``` ### 401 Missing or invalid API key (`{error, message}`), `errors/disconnected_account`, or `errors/reauth_required` when X is signed out in the account's browser. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 402 `subscription_required`: the workspace has no active trial or subscription. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 404 No write with this key. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` ### 409 Sent, too recent, or still running. ```json { "type": "errors/not_sent", "title": "string", "status": 0, "detail": "string", "retry_at": "2026-10-29T09:00:00Z", "code": "string" } ``` --- # Instagram API: Overview > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact > Instagram direct messages, profiles, followers, posts, comments and likes from your own connected Instagram accounts, on Unipile's v1 paths, fields and errors. Lempile's Instagram API works with **your own Instagram accounts**. Each account signs in once, then lives in its own browser, behind its own IP. A call does in that browser what the account's owner would do on instagram.com: read the inbox, send a message, read a profile, follow, like, comment or post. Paths, fields, status codes and error types are Unipile's (v1). A client written for Unipile's Instagram routes changes two things: its base URL and its API key. Anything Lempile doesn't do answers Unipile's own `501 errors/feature_not_implemented`, so such a client can tell. Route by route: [Unipile Compatibility](https://lempile.com/docs/instagram/unipile-compatibility). Instagram is in early access: connecting an account needs your workspace to be open for it. Write to support@lempile.com to join. ## Before You Start 1. **Connect an Instagram account**: in the dashboard's Accounts page, through a hosted link, or with `POST /accounts`. The first sign-in from a new IP usually brings a code from Instagram (by email, SMS, WhatsApp or an authenticator app). See [Accounts And Connecting](https://lempile.com/docs/instagram/accounts). 2. **Create an API key** in the dashboard: **Access Tokens → Generate a token**. Reads need `accounts.read`; writes need `accounts.write`. 3. **Send the key** in the `X-API-KEY` header, to `https://api.lempile.com/api/v1` (Unipile's own path). `https://api.lempile.com/v1` and `https://api.lempile.com` reach the same routes. Every route names the account with `account_id`: its Lempile id (a UUID), its Instagram user id (the number) or its username. ## Your First Message List the account's chats, then answer one: ```bash curl -sS "https://api.lempile.com/api/v1/chats?account_id=$ACCOUNT_ID&limit=5" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ```bash curl -sS -X POST "https://api.lempile.com/api/v1/chats/$CHAT_ID/messages" \ -H "X-API-KEY: $LEMPILE_API_KEY" \ -H "Idempotency-Key: answer-jane-1" \ -H "Content-Type: application/json" \ -d '{ "account_id": "'"$ACCOUNT_ID"'", "text": "Thanks, talk tomorrow." }' ``` ```json { "object": "MessageSent", "message_id": "340282366841710301244276026398105347911_cAAAAB3xYz9wQkLmNo" } ``` Add `"dry_run": true` to check a message without sending it (see [Dry Runs](#dry-runs)). ## IDs | Thing | Its id | Also accepted | | --- | --- | --- | | A person | `provider_id`: Instagram's user id, a number (`"48210937561"`). `public_identifier` is the username. | The username, `@username` or the profile link, wherever a person is named. A number works only for a person one of the account's reads has already shown (a profile, a comment, a like, a follower, a conversation); any other answers `400`: pass the username. | | A person, to message | `provider_messaging_id`: Instagram's separate messaging id. Unipile's `POST /chats` asks for it in `attendees_ids`. | `provider_id`, the username or the profile link. | | A chat | Instagram's own chat id: the number in `instagram.com/direct/t//`. | That link. | | A message | `_`. `provider_id` is Instagram's message id alone. | | | An attachment | `_`, from 0. | | | A post | `provider_id`: Instagram's media id, a number. | The shortcode, or the post or reel link, on every route that takes a post. | | A follow | The person's `provider_id` (Unipile calls it an invitation). | | A message id carries its chat, so `GET /messages/{message_id}` and its attachments and reactions need nothing else. ## How Writes Behave - **A key per write.** Messages, new chats, comments, posts, follows and unfollows need an `Idempotency-Key` header. Likes, message reactions, answers to follow requests and profile edits take one too; sent without one, Lempile makes one and gives it back in the answer's `Idempotency-Key` header. The same key with the same request answers the first answer again, with `Idempotent-Replayed: true`, so a retry never writes twice. See [Errors And Limits](https://lempile.com/docs/instagram/errors-and-limits#write-receipts). - **Not sure means not sure.** When Instagram doesn't confirm in time, a write answers `504 errors/request_timeout`, and it may or may not be on Instagram. Read `GET /writes/{key}` before sending it again. - **A `4xx` means nothing was done on Instagram.** A `5xx` after the send means not sure. - **A human pace.** Each account has its own limits per kind of write, 10 writes an hour in all, and a warm-up after it signs in (below). ## Pace Every account is paced on its own. Two API keys using one account share its pace. | Write | Per account | | --- | --- | | Start a chat (`POST /chats`) | 20 a day, 3 minutes apart | | Send in a chat (`POST /chats/{chat_id}/messages`) | 80 a day, 20 seconds apart | | Follow, unfollow | 20 a day, 2 minutes apart | | Comment | 20 a day, 2 minutes apart | | Like a post or comment | 60 a day, 30 seconds apart | | React to a message | 60 a day | | Create a post | 3 a day | | All writes together | 10 an hour, 100 a day | A newly connected account starts lower: no new chats, follows, comments or posts for 72 hours after its first sign-in, then limits that grow over four weeks ([Warm-up](https://lempile.com/docs/instagram/errors-and-limits#warm-up)). Reads have no Lempile limit, but each one opens Instagram in the account's browser: read at a human rate. "A day" is the last 24 hours. A write past a limit answers `429 errors/too_many_requests` with `retry_after` (seconds to wait) and `retry_at` (when). Nothing was sent, and it doesn't count. Dry runs aren't paced. When Instagram itself says "Try again later", that call answers `429 errors/too_many_requests` with `retry_after: 86400`: wait a day before writing from the account again. When it says "We restrict certain activity", the call answers `403 errors/account_restricted`. ## Dry Runs Every write takes `"dry_run": true` in its body (or `?dry_run=true` in the address, handy on a `DELETE`). Lempile checks every field, opens the account's page up to the last step, checks that Instagram would let the account do it, and stops there. The answer is `200` with `not_sent: true`, and `checks`, the list of what was checked: ```json { "object": "MessageDryRun", "not_sent": true, "checks": [] } ``` A dry run of something already so (a post already liked, a person already followed, the same bio, a message already reacted to) also answers `200` with `not_sent: true`, and its `checks` hold `{ "check": "already", "already": true, "ok": true }`. A dry run needs no `Idempotency-Key`, keeps no receipt and counts toward no pace. A message's dry run never types anything: on Instagram, typing in a chat shows the other person "typing…" as it happens. A comment's dry run types and clears the comment box, because Instagram shows nothing while someone types a comment. ## What Instagram's Own Rules Mean - **Message requests.** A message to someone who doesn't follow the account lands in their requests, not their inbox. Until they accept, Instagram allows one message, text only: a second answers `422 errors/cant_send_message`. Requests the account receives are chats with `folder: ["PENDING"]`. - **Some people can't be messaged.** Their settings, or a block, stop the account: `422 errors/user_unreachable`. Nobody by that name: `422 errors/invalid_recipient`. - **"Seen".** Reading a conversation's messages opens it, and Instagram then normally shows the other person "Seen", exactly as when the owner opens it. Lempile avoids that where Instagram's own page allows; an answer that did open a conversation says `marks_seen: true`. Listing chats never opens one. - **One reaction per message.** A new reaction replaces the account's last one. - **Private accounts.** Following one sends a follow request; it shows as `has_sent_invitation: true` until they accept. - **A blocked or signed-out account.** When Instagram signs the account out, it answers `401 errors/disconnected_account` until it signs in again. When Instagram blocks an action or asks for a check, it answers `403 errors/account_restricted`: someone has to look at the account on Instagram. ## What's Here | Page | Routes | | --- | --- | | [Accounts And Connecting](https://lempile.com/docs/instagram/accounts) | `GET /accounts`, `POST /accounts`, checkpoints, hosted links, reconnect, statuses | | [Chats And Messages](https://lempile.com/docs/instagram/chats-and-messages) | chats, messages, attachments, reactions, attendees, sending, starting a chat | | [Users](https://lempile.com/docs/instagram/users) | profiles, followers, following, follow and unfollow, follow requests, profile edit | | [Posts](https://lempile.com/docs/instagram/posts) | a post, a person's posts, comments, likes, creating a post | | [Webhooks](https://lempile.com/docs/instagram/webhooks) | `messaging` events, `account_status` events (signed out, security check, suspended) | | [Errors And Limits](https://lempile.com/docs/instagram/errors-and-limits) | every error, the pace, write receipts | | [Unipile Compatibility](https://lempile.com/docs/instagram/unipile-compatibility) | every Unipile v1 Instagram route, and what Lempile does with it | --- # Instagram API: Accounts And Connecting > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact > Connecting an Instagram account (dashboard, hosted link or API), Instagram's sign-in codes, reconnecting, and account statuses. An Instagram account in Lempile is one Instagram login, signed in once in its own browser, behind its own IP. No other account uses that IP. Lempile keeps the account signed in; you never handle its cookies. ## List And Read Accounts `GET /accounts` lists the workspace's accounts, every network together. An Instagram account has `provider: "instagram"`. `GET /accounts/{account_id}` answers Unipile's `Account`: ```bash curl -sS "https://api.lempile.com/api/v1/accounts/$ACCOUNT_ID" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ```json { "object": "Account", "type": "INSTAGRAM", "id": "00000000-0000-4000-8000-0000000000c1", "name": "janedemo", "created_at": "2026-11-25T18:20:41.000Z", "sources": [{ "id": "instagram_browser_session", "status": "OK" }] } ``` Neither route opens the account's browser. | `sources[].status` | Meaning | | --- | --- | | `OK` | Signed in and ready. | | `CONNECTING` | Signing in. | | `CREDENTIALS` | Instagram signed the account out (a new password, or a session Instagram ended), asked for a check, or restricted the account. Connect it again, or look at it on Instagram. | | `ERROR` | Lempile can't reach the account's browser or IP right now. | `GET /accounts/{id}` also shows `lifecycle`: `status` (`running`, `connecting`, `disconnected`, `deleted`), `reason` (such as `signed_out`, `checkpoint` or `restricted`) and `since`. The `account_status` webhook sends each change ([Webhooks](https://lempile.com/docs/instagram/webhooks#account-status-events)). An account Instagram suspended or disabled shows `restriction` (why, and since when) in `GET /accounts`, and stays `restricted` until a person clears it: every call on it answers `403 errors/account_restricted`, and a new sign-in is refused. Appeal on Instagram, then write to support@lempile.com. ## Three Ways To Connect 1. **The dashboard**: Accounts, then Instagram. You type the username and password, then Instagram's code when it asks for one. 2. **A hosted link** (`POST /hosted/accounts/link`): Lempile's own page does the same for someone else, for example a customer of yours. 3. **The API** (`POST /accounts`): your own screens collect the username, the password and Instagram's code, and pass them on. In all three, the sign-in runs in the account's own browser, from the account's own IP, and the person answers Instagram's own checks (a code, or an approval in the Instagram app). Instagram is in early access. A workspace that isn't open for it yet gets `403 errors/feature_not_subscribed` on `POST /accounts`, `POST /accounts/{account_id}` and `POST /hosted/accounts/link`. Write to support@lempile.com to join. ## Connect With The API ```bash curl -sS -X POST "https://api.lempile.com/api/v1/accounts" \ -H "X-API-KEY: $LEMPILE_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "provider": "INSTAGRAM", "username": "janedemo", "password": "…" }' ``` Lempile answers within 60 seconds. Either the account is in: ```json { "object": "AccountCreated", "account_id": "00000000-0000-4000-8000-0000000000c1" } ``` or Instagram asks for something first (status `202`): ```json { "object": "Checkpoint", "account_id": "00000000-0000-4000-8000-0000000000c1", "checkpoint": { "type": "OTP", "source": "EMAIL", "can_try_another_way": true } } ``` | `checkpoint.type` | What Instagram wants | | --- | --- | | `OTP` | A code Instagram sent by `EMAIL`, `SMS` or `WHATSAPP` (`source`). | | `2FA` | The account's two-factor code: from an authenticator app (`source: "APP"`) or by SMS. | | `IN_APP_VALIDATION` | Someone approves the sign-in in the Instagram app on the account's phone. `number` is the number to tap there, when Instagram shows one. Then read the account until it's `OK`. | | `CONNECTING` | Instagram is still signing in after 60 seconds (a slow page, for example). Read `GET /accounts/{account_id}` until it's `OK`. A new `POST /accounts` meanwhile answers `425 errors/auth_in_progress`, with the checkpoint when Instagram asked for one. | `username` may also be the account's email or phone number. Other answers: | Status | `type` | When | | --- | --- | --- | | `400` | `errors/missing_parameters`, `errors/invalid_parameters` | A field is missing or isn't valid. | | `401` | `errors/invalid_credentials` | Instagram refused the username or password. | | `403` | `errors/password_reset_required`, `errors/action_required` | Instagram wants a new password, or something done on Instagram itself. | | `409` | `errors/already_exists` | The account is already connected in this workspace. | | `429` | `errors/too_many_requests` | Instagram asks to wait (`retry_after`). | | `503` | `errors/service_unavailable` | Lempile can't start the sign-in right now (no free IP for a new account, or its browser server is busy). Nothing was done. | Only username and password sign in. A `sessionid` cookie answers `501`: Instagram ends a session that moves to a new device and IP. ### Answer A Checkpoint ```bash curl -sS -X POST "https://api.lempile.com/api/v1/accounts/checkpoint" \ -H "X-API-KEY: $LEMPILE_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "provider": "INSTAGRAM", "account_id": "'"$ACCOUNT_ID"'", "code": "482913" }' ``` The answer is `AccountCreated`, or another `Checkpoint` when Instagram asks for one more thing. | `code` | | | --- | --- | | the code | The code Instagram sent. | | `TRY_ANOTHER_WAY` | Presses Instagram's own "Try another way": another kind of check. `409 errors/checkpoint_switching_not_available` when Instagram offers none. | A wrong code answers `401 errors/invalid_checkpoint_solution`: send the right one. An `OTP` or `2FA` answer must be the code's digits (4 to 8), else `400`. `POST /accounts/checkpoint/resend` (`provider`, `account_id`) asks Instagram to send the code again, as its own "Send again" does: ```json { "object": "CheckpointResend", "account_id": "00000000-0000-4000-8000-0000000000c1", "success": true } ``` A sign-in waits 5 minutes for its checkpoints. After that, an answer gets `408 errors/request_timeout`: start again with `POST /accounts`. ## Hosted Links ```bash curl -sS -X POST "https://api.lempile.com/api/v1/hosted/accounts/link" \ -H "X-API-KEY: $LEMPILE_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "type": "create", "providers": ["INSTAGRAM"], "api_url": "https://api.lempile.com/api/v1", "expiresOn": "2026-11-26T18:00:00.000Z" }' ``` ```json { "object": "HostedAuthUrl", "url": "https://lempile.com/connect/instagram?token=…" } ``` - Whoever opens the link signs in on Lempile's page, with Instagram's code when it asks. The new account joins your key's workspace. - A link lasts 24 hours at most. Treat it as a secret: anyone with it can connect an account to your workspace until it expires. - To connect an existing account again, send `"type": "reconnect"` and `"reconnect_account": ""`. ## Reconnect When an account shows `CREDENTIALS`, sign it in again: in the dashboard, with a reconnect link, or with `POST /accounts/{account_id}` and the same body as `POST /accounts`. It answers `AccountReconnected` or a `Checkpoint`. The account keeps its id and its IP. ## Remove `DELETE /accounts/{account_id}` removes the account from Lempile. --- # Instagram API: Chats And Messages > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact > The Instagram inbox in Unipile's Chat, Message and ChatAttendee objects: listing, reading, sending, starting a chat, files, reactions, and when Instagram shows Seen. The account's Instagram inbox (its direct messages), in Unipile's `Chat`, `Message` and `ChatAttendee` objects. Every call names the account with `account_id`, in the query for reads and in the body for writes. ## Chat And Message IDs - A chat's id is Instagram's own: the number in `instagram.com/direct/t//`. Every route also takes that link. - A message's id is `_`, for example `340282366841710301244276026398105347911_cAAAAB3xYz9wQkLmNo`. Its `provider_id` is Instagram's message id alone. Because the id carries its chat, `GET /messages/{message_id}` needs nothing else. - An attachment's id is `_`, from 0. ## Which Calls Open A Conversation Instagram normally shows the other person "Seen" once a conversation is opened, exactly as when the owner opens it. Lempile reads a conversation from the inbox page's own load where it can, and opens it only when the inbox doesn't hold what the call needs. An answer that opened a conversation with messages the account hadn't seen says `marks_seen: true`. | Never opens one | Opens one only when the inbox can't answer | Always opens it | | --- | --- | --- | | `GET /chats` | One chat, its messages, its attendees, its sync; `GET /messages` and `GET /messages/{message_id}`; `GET /chat_attendees` and an attendee, their picture, chats and messages | Every write in a chat | ## List Chats ```bash curl -sS "https://api.lempile.com/api/v1/chats?account_id=$ACCOUNT_ID&limit=20" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ```json { "object": "ChatList", "items": [ { "object": "Chat", "id": "340282366841710301244276026398105347911", "account_id": "00000000-0000-4000-8000-0000000000c1", "account_type": "INSTAGRAM", "provider_id": "340282366841710301244276026398105347911", "attendee_provider_id": "48210937561", "name": null, "type": 0, "timestamp": "2026-11-25T17:41:07.000Z", "unread_count": 1, "archived": 0, "muted_until": null, "read_only": 0, "folder": ["INBOX_INSTAGRAM_GENERAL"], "pinned": 0 } ], "cursor": "" } ``` | Parameter | | | --- | --- | | `account_id` | Required. | | `limit` | 1 to 250 (default 20). | | `cursor` | The previous page's `cursor`. `null` when there's no more. | | `unread`, `before`, `after` | Not yet: `501`. | - Newest activity first, as Instagram lists them. - `folder` is `["INBOX_INSTAGRAM_GENERAL"]` for the inbox, `["PENDING"]` for a message request the account received. - `type` is `0` for one person, `1` for a group. `attendee_provider_id` is the other person in a one-to-one chat. - `account_id` is the account's Lempile id, whichever form you sent. ## One Chat ```bash curl -sS "https://api.lempile.com/api/v1/chats/$CHAT_ID?account_id=$ACCOUNT_ID" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` The `Chat`, with its latest message as `lastMessage` (or `null`). ## Messages ```bash curl -sS "https://api.lempile.com/api/v1/chats/$CHAT_ID/messages?account_id=$ACCOUNT_ID&limit=20" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ```json { "object": "MessageList", "items": [ { "object": "Message", "id": "340282366841710301244276026398105347911_cAAAAB3xYz9wQkLmNo", "message_id": "340282366841710301244276026398105347911_cAAAAB3xYz9wQkLmNo", "provider_id": "cAAAAB3xYz9wQkLmNo", "account_id": "00000000-0000-4000-8000-0000000000c1", "chat_id": "340282366841710301244276026398105347911", "chat_provider_id": "340282366841710301244276026398105347911", "sender_id": "48210937561", "sender_attendee_id": "48210937561", "text": "See you at 10?", "attachments": [], "timestamp": "2026-11-25T17:41:07.000Z", "is_sender": 0, "reactions": [], "seen": 1, "seen_by": {}, "hidden": 0, "deleted": 0, "edited": 0, "is_event": 0, "delivered": 1, "behavior": null, "original": "", "message_type": null } ], "cursor": "" } ``` - Newest first. `limit` 1 to 250 (default 20); `cursor` for the next page. `before`, `after` and `sender_id`: not yet, `501`. - `is_sender` is `1` for the account's own messages. - `message_type` is `STORY_MENTION` when the person mentioned the account in their story, `STORY_REPLY` when they answered one of its stories, and `null` for a plain message. - `reactions`: `{ value, sender_id, is_sender }`, one per person. - `attachments`: pictures (`img`), videos (`video`), voice notes (`audio`, `voice_note: true`), a shared post, reel or story (`media_share`, with its `post` or `story`), and a shared profile (`profile`). Each has a `url`, Instagram's own link, which expires; `GET /messages/{message_id}/attachments/{attachment_id}` reads the file itself. `GET /messages/{message_id}?account_id=` answers one `Message`. It's looked for among its chat's newest 300 messages; an older one answers `404`. `GET /messages?account_id=&limit=` answers the messages of the newest chats, newest first. It opens those chats. ## Send A Message ```bash curl -sS -X POST "https://api.lempile.com/api/v1/chats/$CHAT_ID/messages" \ -H "X-API-KEY: $LEMPILE_API_KEY" \ -H "Idempotency-Key: answer-jane-1" \ -H "Content-Type: application/json" \ -d '{ "account_id": "'"$ACCOUNT_ID"'", "text": "Thanks, talk tomorrow." }' ``` `201`: ```json { "object": "MessageSent", "message_id": "340282366841710301244276026398105347911_cAAAAB3xYz9wQkLmNo" } ``` | Field | | | --- | --- | | `account_id` | Required. | | `text` | Up to 1,000 characters (Instagram's own limit). Needed unless there are files. | | `attachments` | Files, in a `multipart/form-data` body: JPEG or PNG pictures (8 MB each), MP4 or MOV videos (25 MB), and voice notes as M4A, AAC or MP3 (10 MB). 10 files and 25 MB at most in all. Any other type: `415`. A voice note may also come as `voice_message`. | | `quote_id` | A message id of this chat: answers that message, as Instagram's Reply does. | | `dry_run` | `true`: everything up to the message box, nothing typed or sent. | LinkedIn's and WhatsApp's fields (`mentions`, `thread_id`, `typing_duration`, `video_message`) answer `400`: nothing is sent. - `Idempotency-Key` is required (a dry run needs none). - Lempile reads the message back from the chat before it answers, so `message_id` is the message as Instagram has it. - 20 seconds between messages in chats, 80 a day per account. ## Start A Chat ```bash curl -sS -X POST "https://api.lempile.com/api/v1/chats" \ -H "X-API-KEY: $LEMPILE_API_KEY" \ -H "Idempotency-Key: hello-sam-1" \ -H "Content-Type: application/json" \ -d '{ "account_id": "'"$ACCOUNT_ID"'", "attendees_ids": ["sam.example"], "text": "Hi Sam, thanks for the follow." }' ``` `201`: ```json { "object": "ChatStarted", "chat_id": "340282366841710301244276026398105347911", "message_id": "340282366841710301244276026398105347911_cAAAAB3xYz9wQkLmNo" } ``` - `attendees_ids` names one person: their `provider_messaging_id` (as Unipile asks), their `provider_id`, username, `@username` or profile link. Group chats aren't supported yet: two or more answer `501`. - When a chat with that person already exists, the message goes there. - Someone who doesn't follow the account gets a **message request**. Until they accept, Instagram allows one message, text only: a second answers `422 errors/cant_send_message`. - 3 minutes between new chats, 20 a day per account. - The same fields as a message in a chat: `text`, `attachments`, `dry_run`. `quote_id` and LinkedIn's fields (`linkedin`, `subject`, `video_message`) answer `400`. ## React To A Message ```bash curl -sS -X POST "https://api.lempile.com/api/v1/messages/$MESSAGE_ID/reaction" \ -H "X-API-KEY: $LEMPILE_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "account_id": "'"$ACCOUNT_ID"'", "reaction": "❤️" }' ``` ```json { "object": "MessageReactionAdded", "success": true } ``` Instagram keeps one reaction per person on a message: a new one replaces the account's last. `DELETE /messages/{message_id}/reaction` (same body) takes it off and answers `MessageReactionRemoved`. ## Attendees `GET /chats/{chat_id}/attendees?account_id=` answers the people in a chat; `GET /chat_attendees?account_id=` everyone the account has a chat with (`limit`, `cursor`). ```json { "object": "ChatAttendeeList", "items": [ { "object": "ChatAttendee", "id": "48210937561", "account_id": "00000000-0000-4000-8000-0000000000c1", "provider_id": "48210937561", "name": "Sam Example", "is_self": 0, "picture_url": "https://…", "profile_url": "https://www.instagram.com/sam.example/", "specifics": { "provider": "INSTAGRAM", "public_identifier": "sam.example", "relationship_status": { "following": true, "followed_by": true, "has_received_invitation": false, "has_sent_invitation": false } } } ] } ``` An attendee's id is the person's `provider_id`. | Route | Answers | | --- | --- | | `GET /chat_attendees/{attendee_id}` | One `ChatAttendee`. | | `GET /chat_attendees/{attendee_id}/picture` | Their profile picture, as an image. | | `GET /chat_attendees/{attendee_id}/chats` | A `ChatList`: the account's one-to-one chat with them. | | `GET /chat_attendees/{attendee_id}/messages` | A `MessageList`: the messages of that chat. | ## Read A Chat Again `GET /chats/{chat_id}/sync?account_id=` reads the chat from Instagram now: ```json { "object": "ChatHistorySync", "chat_id": "340282366841710301244276026398105347911", "status": "SYNC_DONE" } ``` A chat Instagram no longer has answers `status: "CHAT_DELETED"`, as on Unipile. ## Not On Instagram's Web Deleting, editing or forwarding a message, and deleting, muting, archiving or marking a chat read (`PATCH /chats/{chat_id}`) answer `501`, as on Unipile. --- # Instagram API: Users > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact > Instagram profiles in Unipile's UserProfile, the account's own profile, followers and following, follow and unfollow, follow requests, and editing the bio and picture. A person is named by their `provider_id` (Instagram's user id, a number), their username, `@username` or profile link. Instagram's web opens profiles by username, so a number works only for a person one of the account's reads has already shown (a profile, a comment, a like, a follower or a conversation). Any other number answers `400 errors/invalid_parameters`: pass the username. ## A Profile ```bash curl -sS "https://api.lempile.com/api/v1/users/sam.example?account_id=$ACCOUNT_ID" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ```json { "object": "UserProfile", "provider": "INSTAGRAM", "provider_id": "48210937561", "provider_messaging_id": "104857600000001", "public_identifier": "sam.example", "full_name": "Sam Example", "profile_picture_url": "https://…", "profile_picture_url_large": "https://…", "biography": "Ceramics, Lyon.", "category": "Artist", "followers_count": 1840, "mutual_followers_count": 3, "following_count": 312, "posts_count": 96, "profile_type": "PROFESSIONNAL", "is_verified": false, "is_private": false, "external_links": ["https://sam.example.com"], "relationship_status": { "following": false, "followed_by": true, "has_sent_invitation": false, "has_received_invitation": false } } ``` - `profile_type` is `PERSONNAL`, `BUSINESS` or `PROFESSIONNAL` (a creator account), spelled as Unipile spells them. - `relationship_status` is the account's side: `following` (the account follows them), `followed_by` (they follow the account), `has_sent_invitation` (the account asked to follow a private account), `has_received_invitation` (they asked to follow the account). - `provider_messaging_id` is what Unipile's `POST /chats` asks for in `attendees_ids`. - `business` (category, address, phone, email) when the account shows them. - Each read opens the profile in the account's browser. Instagram doesn't tell people who viewed their profile. ## The Account's Own Profile `GET /users/me?account_id=` answers the same fields with `"object": "AccountOwnerProfile"`. ## Followers And Following ```bash curl -sS "https://api.lempile.com/api/v1/users/followers?account_id=$ACCOUNT_ID&user_id=sam.example&limit=25" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ```json { "object": "UserFollowersList", "items": [ { "object": "UserFollower", "id": "50112233445", "messaging_id": "", "username": "lou.sample", "name": "Lou Sample", "profile_picture_url": "https://…", "is_private": false, "is_verified": false } ], "cursor": "" } ``` - Without `user_id`, the account's own followers. - 25 a page at most, as on Unipile: a `limit` from 26 to 250 gets 25, more than 250 answers `400`. Instagram can give fewer, and for a verified account it gives a small fixed sample and no next page. - `messaging_id` is always `""` (Unipile no longer fills it for Instagram). - A private account's followers can only be read when the account follows it. `GET /users/following?account_id=&user_id=` answers whom someone follows, with the same items. `limit` is 25 by default and goes up to 1,000, as on Unipile (more answers `400`); one page holds 100 at most, and `cursor` reads on. ## Follow And Unfollow ```bash curl -sS -X POST "https://api.lempile.com/api/v1/users/invite" \ -H "X-API-KEY: $LEMPILE_API_KEY" \ -H "Idempotency-Key: follow-sam-1" \ -H "Content-Type: application/json" \ -d '{ "account_id": "'"$ACCOUNT_ID"'", "provider_id": "sam.example" }' ``` ```json { "object": "UserInvitationSent", "invitation_id": "48210937561" } ``` - `Idempotency-Key` is required, for unfollows too. - `provider_id` is the person's `provider_id` or username. Their `provider_messaging_id` doesn't work here (as on Unipile). - Following a private account sends a follow request: they decide. - `invitation_id` is the person's `provider_id`. `DELETE /users/invite/sent/{provider_id}?account_id=` unfollows, or takes back a follow request not yet accepted: ```json { "object": "InvitationCanceled" } ``` Follows and unfollows: 2 minutes apart, 20 a day per account. ## Follow Requests A private account receives follow requests. `GET /users/invite/received?account_id=` lists them (`InvitationList`, with `limit`, 10 by default and 100 at most, and `cursor`). Each request's `id` is the person's `provider_id`. ```bash curl -sS -X POST "https://api.lempile.com/api/v1/users/invite/received/48210937561" \ -H "X-API-KEY: $LEMPILE_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "provider": "INSTAGRAM", "account_id": "'"$ACCOUNT_ID"'", "action": "accept" }' ``` ```json { "object": "UserInvitationHandled", "status": "ACCEPTED" } ``` `action` is `accept` or `decline`. ## Edit The Profile `PATCH /users/me/edit` (`multipart/form-data`) changes the account's bio and picture, through Instagram's own Edit profile page: | Field | | | --- | --- | | `type` | `INSTAGRAM`. | | `account_id` | Required. | | `summary` | The bio, 150 characters at most. | | `picture` | A JPEG or PNG file, 8 MB at most. One that isn't square is cropped to a centred square, as Instagram's own uploader does. | ```json { "object": "ProfileEdited" } ``` Send `summary`, `picture` or both: only the bio and the picture change here, as on Unipile. LinkedIn's fields (`headline`, `location`, `experience`…) answer `400`. --- # Instagram API: Posts > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact > Instagram posts and reels in Unipile's Post object: a person's posts, one post, its comments and likes, commenting, liking, and creating a feed post. A post's id is its `provider_id`, Instagram's media id (a number). Reels are posts too. Every route that takes a post also takes its shortcode or its link (`https://www.instagram.com/p//`, or `/reel//`). ## A Person's Posts ```bash curl -sS "https://api.lempile.com/api/v1/users/sam.example/posts?account_id=$ACCOUNT_ID&limit=12" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ```json { "object": "PostList", "items": [ { "object": "Post", "provider": "INSTAGRAM", "provider_id": "3502987465123456789", "has_audio": false, "has_liked": false, "like_count": 128, "comment_count": 9, "like_and_view_counts_disabled": false, "comments_disabled": false, "accessibility_caption": null, "caption": { "edited": false, "has_translation": false, "created_at": 1796149267, "text": "New glazes, out of the kiln today." }, "preview_image": { "url": "https://…", "width": 1080, "height": 1350 }, "owner": { "id": "48210937561", "username": "sam.example", "profile_pic_url": "https://…", "is_verified": false, "is_private": false }, "location": { "name": "Lyon, France", "lat": 45.764, "lng": 4.8357 } } ], "cursor": "", "paging": { "page_count": 1 } } ``` - Newest first, as the profile shows them. `limit` 1 to 100 (10 by default), `cursor` for the next page. - `video` (`url`, `width`, `height`) on a video or reel; `has_audio` says whether it has sound. - `caption.created_at` is when it was posted, in seconds since 1970. - A private account's posts can only be read when the account follows it. ## One Post ```bash curl -sS "https://api.lempile.com/api/v1/posts/DBx1yZaN0pQ?account_id=$ACCOUNT_ID" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` The same `Post`. ## Comments ```bash curl -sS "https://api.lempile.com/api/v1/posts/3502987465123456789/comments?account_id=$ACCOUNT_ID&limit=20" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ```json { "object": "CommentList", "items": [ { "object": "Comment", "id": "18034567890123456", "provider_id": "18034567890123456", "author": { "provider_id": "50112233445", "messaging_id": "", "public_identifier": "lou.sample", "pk": "50112233445", "profile_pic_url": "https://…", "is_verified": false }, "text": "That blue!", "created_at": 1796150012, "is_covered": false, "child_comment_count": 1, "restricted_status": null, "has_liked_comment": false, "giphy_media_info": null, "parent_comment_id": null, "comment_like_count": 2 } ], "cursor": "", "total_items": 9, "paging": { "start": null, "page_count": 1, "total_count": 9 } } ``` - In the order the post's page loads them. `limit` 1 to 100 (20 by default), `cursor` for more. `sort_by=MOST_RELEVANT` answers `501`: Instagram's web picks its own order. - `comment_id` (a comment's `provider_id`): that comment's replies. - An author's id is `null` when Instagram's page didn't show it. ## Comment On A Post ```bash curl -sS -X POST "https://api.lempile.com/api/v1/posts/3502987465123456789/comments" \ -H "X-API-KEY: $LEMPILE_API_KEY" \ -H "Idempotency-Key: comment-sam-1" \ -H "Content-Type: application/json" \ -d '{ "account_id": "'"$ACCOUNT_ID"'", "text": "Lovely work, @sam.example" }' ``` `201`: ```json { "object": "CommentSent", "comment_id": "18034567890123999" } ``` - `Idempotency-Key` is required. - `text`: 1 to 1,250 characters. `@username` mentions the person. - `comment_id`: answer that comment instead. - Typed in the post's own comment box. Its dry run types the comment and clears it: Instagram shows nobody a comment being typed. - 2 minutes apart, 20 a day per account. ## Likes `GET /posts/{post_id}/reactions?account_id=` lists who liked a post (with `comment_id`, a comment), as the likes list loads: ```json { "object": "PostReactionList", "items": [ { "object": "PostReaction", "value": "LIKE", "post_id": "3502987465123456789", "comment_id": null, "author": { "id": "50112233445", "type": "INDIVIDUAL", "name": "Lou Sample", "headline": "", "profile_url": "https://www.instagram.com/lou.sample/", "profile_picture_url": "https://…", "network_distance": null, "public_identifier": "lou.sample", "is_verified": false, "is_private": false } } ], "paging": { "cursor": null, "start": null, "page_count": 1, "total_count": 128 } } ``` `limit` 1 to 100 (20 by default), `cursor` for more. An author's id is `null` when Instagram's page didn't show it. `POST /posts/reaction` likes a post, or a comment with `comment_id`: ```bash curl -sS -X POST "https://api.lempile.com/api/v1/posts/reaction" \ -H "X-API-KEY: $LEMPILE_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "account_id": "'"$ACCOUNT_ID"'", "post_id": "3502987465123456789", "reaction_type": "like" }' ``` ```json { "object": "ReactionAdded" } ``` `reaction_type` is `like`, the only reaction Instagram has. 30 seconds apart, 60 a day per account. ## Create A Post `POST /posts` (`multipart/form-data`) publishes a feed post through Instagram's own Create: | Field | | | --- | --- | | `account_id` | Required. | | `text` | The caption, 2,200 characters at most (Instagram's limit). `@username` mentions someone. | | `attachments` | At least one file: JPEG or PNG pictures (8 MB each), MP4 or MOV videos (50 MB). 10 files and 50 MB at most in all. | | `location` | A place to tag. The best match is used; no match leaves the post untagged. | `Idempotency-Key` is required. Instagram picks a video's cover: `video_thumbnail` answers `501`. ```json { "object": "PostCreated", "post_id": "3502987465123457001", "status": "PUBLISHED" } ``` `201` once Instagram shows the post. `202` with `status: "PROCESSING"` when Instagram is still processing it (a video, often): read the account's posts a little later. 3 posts a day per account. A long video can take longer than the 140 seconds a request waits. Send `Prefer: respond-async` to get `202` as soon as Lempile starts the post, with `Preference-Applied: respond-async`, the key in the `Idempotency-Key` header and its receipt in the `Location` header (`/api/v1/writes/{key}`): ```json { "object": "PostCreated", "post_id": null, "provider": "INSTAGRAM", "status": "PROCESSING" } ``` Then read `GET /writes/{key}` until its `state` is `done` (`response` is the post) or `failed` ([Write Receipts](https://lempile.com/docs/instagram/errors-and-limits#write-receipts)). A story (`post_type: "story"`) answers `501`: Instagram's web can't make one. --- # Instagram API: Webhooks > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact > Instagram webhooks in Unipile's payloads: messaging events, account status events (signed out, security check, suspended), registering, delivery, retries and signatures. Lempile calls your address when something happens on an Instagram account: - `messaging`: `message_received`, `message_read`, `message_reaction`. - `account_status`: the account was connected, signed out, stopped by a security check, suspended, reconnected or removed ([below](#account-status-events)). A webhook belongs to the workspace of the key that registered it. ## Register A Webhook ```bash curl -sS -X POST "https://api.lempile.com/api/v1/webhooks" \ -H "X-API-KEY: $LEMPILE_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "request_url": "https://hooks.example.com/instagram", "name": "inbox", "source": "messaging", "events": ["message_received", "message_reaction"], "account_ids": ["00000000-0000-4000-8000-0000000000c1"], "headers": [{ "key": "X-Team", "value": "support" }] }' ``` `201`: ```json { "object": "WebhookCreated", "webhook_id": "8c0b6a7e-3f52-4d1e-9a40-2b7c5d9e1f03", "secret": "whsec_…" } ``` | Field | | | --- | --- | | `request_url` | An `https://` address on the public internet (no IP address, `localhost` or internal name). | | `source` | `messaging` or `account_status`. | | `events` | The events to send. A `messaging` webhook without `events` gets `message_received` only, as on Unipile. Unipile's `message_edited`, `message_deleted` and `message_delivered` are accepted, but Instagram accounts never send them. | | `account_ids` | `messaging` only: up to 50 of the workspace's Instagram accounts, by their Lempile id (as `GET /accounts` shows it). Without it, every Instagram account of the workspace. | | `format` | `messaging` only: `json` (the default) or `form` (a form body: each value as text, objects as JSON, empty values left out). | | `data` | `messaging` only: up to 40 `{ key, name }`. The payload then holds only these keys, each under its new `name`. | | `enabled` | `messaging` only: `false` registers it switched off. Default `true`. | | `name` | Your name for it, sent as `webhook_name`. | | `headers` | Up to 10 `{ key, value }` headers added to every call. | `secret` signs every call (below). It's shown this once: store it. `GET /webhooks` lists the workspace's webhooks, header values masked. A `messaging` one also shows `account_ids` (each `{ id, name, type }`), `format`, `data` and `type: "AUTO"`. `DELETE /webhooks/{webhook_id}` removes one (`WebhookDeleted`). `messaging` webhooks here are for Instagram accounts; LinkedIn's are on [Lempile Direct](https://lempile.com/docs/direct/webhooks). ## Messaging Events ```json { "account_id": "00000000-0000-4000-8000-0000000000c1", "account_type": "INSTAGRAM", "account_info": { "feature": "classic", "type": "INSTAGRAM", "user_id": "61234567890" }, "event": "message_received", "chat_id": "340282366841710301244276026398105347911", "timestamp": "2026-11-25T17:41:07.000Z", "webhook_name": "inbox", "message_id": "340282366841710301244276026398105347911_cAAAAB3xYz9wQkLmNo", "message": "See you at 10?", "sender": { "attendee_id": "48210937561", "attendee_name": "Sam Example", "attendee_provider_id": "48210937561", "attendee_profile_url": "https://www.instagram.com/sam.example/", "attendee_public_identifier": null, "attendee_specifics": { "provider": "INSTAGRAM" } }, "attendees": [ { "attendee_id": "48210937561", "attendee_name": "Sam Example", "attendee_provider_id": "48210937561", "attendee_profile_url": "https://www.instagram.com/sam.example/", "attendee_public_identifier": null, "attendee_specifics": { "provider": "INSTAGRAM" } } ], "attachments": [], "is_sender": false, "subject": null, "provider_chat_id": "340282366841710301244276026398105347911", "provider_message_id": "cAAAAB3xYz9wQkLmNo", "is_event": 0, "chat_pinned": 0, "quoted": null, "reply_to": null, "is_forwarded": null, "is_view_once": null, "chat_content_type": null, "message_type": "MESSAGE", "is_group": false, "folder": [], "event_type": null } ``` - Ids are the API's: `chat_id` and `message_id` work as they are in `GET /chats/{chat_id}` and `GET /messages/{message_id}`. `provider_message_id` is Instagram's message id alone. - The account's own messages arrive as `message_received` too, as on Unipile, with `is_sender: true` (`sender.attendee_provider_id` is then `account_info.user_id`). - `message_read` adds `read_by` (who saw it). `message_reaction` adds `reaction` and `reaction_sender`. - `attachments`: each `{ attachment_id, attachment_type, attachment_size, attachment_unavailable, attachment_url }`, as Unipile's webhooks send them. - Messages from before the account was connected never arrive as events. - An event is sent once per webhook, even when Instagram's inbox is read again. Once it's delivered, Lempile keeps its ids, not the message's text. ### When They Arrive Instagram's web app tells nobody about a new message, so each account's own browser reads its inbox about every 10 minutes (each account at its own times), and not between 23:00 and 07:00 in the account's own time zone. An event arrives up to about 10 minutes after the message; a message sent at night arrives in the morning. Reading the inbox opens no conversation, so it never shows anyone "Seen". ## Account Status Events An `account_status` webhook (`source: "account_status"`) reports every account of the workspace, Instagram's included: one call each time an account's status changes. Register it with `events` to get only some (Unipile's names, such as `credentials` or `creation_success`, or Lempile's, such as `account.status.disconnected`); without `events`, it gets all of them. ```json { "event": "account.status.disconnected", "account_id": "00000000-0000-4000-8000-0000000000c1", "account_type": "INSTAGRAM", "status": "disconnected", "previous_status": "running", "reason": "restricted", "occurred_at": "2026-11-29T11:39:12.000Z", "AccountStatus": { "account_id": "00000000-0000-4000-8000-0000000000c1", "account_type": "INSTAGRAM", "message": "CREDENTIALS" } } ``` `AccountStatus` is Unipile's own object, unchanged; the fields above it are Lempile's. `X-Lempile-Event` repeats `event`. | What happened | `status` / `reason` | `AccountStatus.message` | What to do | | --- | --- | --- | --- | | The account was connected | `running` / `connected` | `CREATION_SUCCESS` | | | It was connected again | `running` / `reconnected` | `RECONNECTED` | | | Lempile cleared a suspension, and the account still works | `running` / `recovered` | `OK` | | | A sign-in started | `connecting` / `signing_in` | `CONNECTING` | | | A sign-in failed | `disconnected` / `signin_failed` | `CREDENTIALS` | Connect it again. | | Instagram signed it out | `disconnected` / `signed_out` | `CREDENTIALS` | Connect it again. | | Instagram asks for a security check | `disconnected` / `checkpoint` | `CREDENTIALS` | Open the account on Instagram, then connect it again. | | Instagram suspended or disabled it | `disconnected` / `restricted` | `CREDENTIALS` | See below. | | It was removed from Lempile | `deleted` / `deleted` | `DELETED` | | Lempile sees what Instagram shows the next time it opens the account: one of your calls, or the account's inbox read (about every 10 minutes, not between 23:00 and 07:00 in the account's time zone). A change at night reaches you in the morning. Lempile never opens an account only to check its status. **Suspended accounts.** When Instagram shows its "suspended" or "disabled" page, Lempile marks the account `restricted` and keeps it so until a person clears it: every call on it answers `403 errors/account_restricted`, and a new sign-in is refused. Appeal on Instagram; once Instagram gives the account back, write to support@lempile.com. Lempile then clears it, and the webhook gets `running` / `recovered`, or `disconnected` / `signed_out` when Instagram also signed the account out (connect it again; it keeps its `account_id`). Nothing recovers an Instagram account by itself: unlike LinkedIn accounts, there's no automatic retry, and no `degraded` or `errored` status. A signed-out account stays `disconnected` until someone connects it again. `GET /accounts/{id}` shows the same thing at any time, without opening the account's browser: `sources[].status` (`OK`, `CONNECTING`, `CREDENTIALS`, `ERROR`), and `lifecycle` with the `status` and `reason` above ([Accounts](https://lempile.com/docs/instagram/accounts)). ## Delivery - Lempile sends a `POST`: JSON, or a form with `format: "form"`. Answer with a `2xx`. - No answer, a `5xx`, `408`, `425` or `429`: the event is sent again 30 seconds, 2 minutes, 10 minutes, 30 minutes and 2 hours later (six tries in all), then given up. Any other answer stops it. A redirect is never followed. ### Check A Call Came From Lempile Each call carries `X-Lempile-Signature: t=,v1=.">`, made with the webhook's `secret`: ```js import { createHmac, timingSafeEqual } from "node:crypto"; function fromLempile(header, rawBody, secret) { const { t, v1 } = Object.fromEntries(header.split(",").map((part) => part.split("="))); const expected = createHmac("sha256", secret).update(`${t}.${rawBody}`).digest("hex"); const fresh = Math.abs(Date.now() / 1000 - Number(t)) < 300; return fresh && expected.length === v1.length && timingSafeEqual(Buffer.from(expected), Buffer.from(v1)); } ``` Check it on the raw body, before parsing it. Refuse a call more than 5 minutes old: someone may be sending an old one again. --- # Instagram API: Errors And Limits > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact > Every Instagram error in Unipile's types, what it means for what was sent, each account's pace, and write receipts. Errors are Unipile's problem JSON: `{ "type": "errors/…", "title", "status", "detail" }`, with `retry_after` (seconds) and `retry_at` when waiting helps. `detail` says in words what happened and whether anything was done. Two exceptions answer `{ "error": "…", "message": "…" }` instead: a missing or invalid API key (`401`) and an inactive subscription (`402`). The rule to read every answer by: **a `4xx` means nothing was done on Instagram; a `5xx` after a write was sent means not sure: check before sending it again.** ## Any Route | HTTP | Type | Meaning | | --- | --- | --- | | `400` | `errors/invalid_parameters` | A field Lempile won't take (`detail` names it). Nothing was opened. | | `401` | `unauthorized` (in `error`) | Missing or invalid API key. | | `401` | `errors/disconnected_account` | Instagram signed the account out. Connect it again. | | `402` | `subscription_required` (in `error`) | The workspace has no active trial or subscription. | | `403` | `errors/insufficient_permissions` | The key lacks `accounts.read` (reads) or `accounts.write` (writes). | | `403` | `errors/account_restricted` | Instagram blocked the action, restricted the account, or asks for a check. Someone has to look at the account on Instagram. | | `403` | `errors/action_required` | The account waits for something done on Instagram itself (a check, a new sign-in); the answer's `account_status` and `reason` say what. | | `403` | `errors/feature_not_subscribed` | Connecting: Instagram isn't open to this workspace yet (early access). Nothing was done. | | `404` | `errors/resource_not_found` | No such account in this workspace, or no such chat, message, person or post. | | `429` | `errors/too_many_requests` | The account's pace, or Instagram's own "Try again later". Wait `retry_after` seconds. Nothing was done. | | `501` | `errors/feature_not_implemented` | Not done for Instagram (see [Unipile Compatibility](https://lempile.com/docs/instagram/unipile-compatibility)), or an account of another network on an Instagram-only route. Nothing was done. | | `503` | `errors/service_unavailable` | The account isn't ready yet, or its browser can't be reached right now. Nothing was done. | | `504` | `errors/request_timeout` | Instagram didn't answer in time (a read waits 100 seconds, a write 140). A read changed nothing: try again. A write: not sure. | ## Writes | HTTP | Type | Meaning | | --- | --- | --- | | `400` | `errors/missing_idempotency_key`, `errors/invalid_idempotency_key` | Messages, new chats, comments, posts, follows and unfollows need an `Idempotency-Key`. Nothing was sent. | | `415` | `errors/unsupported_media_type` | A file Instagram doesn't take: send JPEG or PNG images, MP4 or MOV videos, or (in a message) M4A, AAC or MP3 audio. Nothing was sent. | | `409` | `errors/in_progress` | The same key is still running, or its outcome isn't known yet. | | `422` | `errors/idempotency_key_reused` | The key was used for another request. Nothing was sent. | | `422` | `errors/invalid_recipient` | No Instagram account by that name or id. | | `422` | `errors/user_unreachable` | Instagram won't let the account message this person (their settings, or a block). | | `422` | `errors/cant_send_message` | A message request is waiting for their answer: until they accept, one text message only. | | `502` | `errors/service_unavailable` | The browser's answer was lost after the write started: not sure. | | `504` | `errors/request_timeout` | Instagram didn't confirm in time: not sure if it was sent. | After a `502` or `504` on a write, read its receipt (below) before sending it again. ## Pace Each account has its own pace, shared by every key that uses it. "A day" is the last 24 hours. | Write | Per account | | --- | --- | | Start a chat | 20 a day, 3 minutes apart | | Send in a chat | 80 a day, 20 seconds apart | | Follow, unfollow | 20 a day, 2 minutes apart | | Comment | 20 a day, 2 minutes apart | | Like a post or comment | 60 a day, 30 seconds apart | | React to a message | 60 a day | | Create a post | 3 a day | | All writes together | 10 an hour, 100 a day | A write past a limit answers `429`: ```json { "type": "errors/too_many_requests", "title": "Too Many Requests", "status": 429, "detail": "Wait: this Instagram account's last message in a chat went out less than 20 seconds ago.", "code": "too_fast", "retry_at": "2026-11-25T17:41:28.000Z", "retry_after": 14 } ``` `code` says which limit: `too_fast`, `daily_limit`, `hourly_limit` or `warmup_limit` (below). When several apply, the answer names the one that frees up last, so a write sent again at `retry_at` isn't refused by another. Nothing was sent, and the refused write counts toward nothing. Dry runs aren't paced. ### Warm-up A newly connected account starts slower, so Instagram doesn't see a new device go straight to messaging strangers. After a sign-in the account has a quiet period, then its limits grow week by week: | Write, a day | Quiet | Week 1 | Week 2 | Week 3 | Week 4 | | --- | --- | --- | --- | --- | --- | | Start a chat | none | 3 | 5 | 10 | 15 | | Send in a chat | 10 | 20 | 40 | 60 | 80 | | Follow, unfollow | none | 5 | 10 | 15 | 20 | | Comment | none | 3 | 5 | 10 | 15 | | Like a post or comment | 5 | 10 | 20 | 40 | 60 | | React to a message | 10 | 20 | 30 | 45 | 60 | | Create a post | none | 1 | 1 | 2 | 3 | | Edit the profile | none | 1 | 2 | 2 | 2 | | All writes together | 20 (4 an hour) | 30 (5 an hour) | 50 (6 an hour) | 75 (8 an hour) | 100 (10 an hour) | - **Quiet:** 72 hours after a sign-in in the account's first week on Lempile, 24 hours after a later sign-in (a reconnect). - **Weeks** count from when the account was first added. From week 5 only the pace above applies. - While warming up, the time between two writes of a kind is twice the pace's (a new chat every 6 minutes, a message every 40 seconds). - Answering follow requests is never limited. A write past a warm-up limit answers `429` with `"code": "warmup_limit"`. `retry_at` is when it has room, counting the next phase. Dry runs and reads aren't limited. Reads have no Lempile limit, but each one opens Instagram in the account's browser: read at a human rate. When Instagram itself says "Try again later", that call answers `429` with `retry_after: 86400`: wait a day before writing from the account again. When it says "We restrict certain activity", the call answers `403 errors/account_restricted`. Instagram's own word comes first: no pace above makes Instagram accept more. ## Write Receipts An `Idempotency-Key` is 1 to 200 characters of `A-Z a-z 0-9 . _ : -`, scoped to your workspace. Messages, new chats, comments, posts, follows and unfollows need one. Likes, message reactions, answers to follow requests and profile edits take one; sent without one, Lempile makes one and gives it back in the answer's `Idempotency-Key` header, so every write has a receipt. - Same key, same request, after success: the first answer again, with `Idempotent-Replayed: true`. Nothing is sent. - Same key while the first runs, or after an unsure outcome: `409 errors/in_progress`. - Same key after a definite failure (a `4xx`): the request runs again. - Same key, another request: `422 errors/idempotency_key_reused`. `GET /writes/{key}` says what became of a write: ```json { "object": "WriteStatus", "key": "answer-jane-1", "state": "done", "status": 201, "response": { "object": "MessageSent", "message_id": "340282366841710301244276026398105347911_cAAAAB3xYz9wQkLmNo" } } ``` `state` is `done` (sent: `response` is the answer), `failed` (nothing was sent: `response` is the problem), `pending` (still running, or not sure; `response` is `null`), or `none` (no write with that key: a dry run, for example). The browser's answer is kept 48 hours, also after the request stopped waiting. After a not-sure post, Lempile checks the account's own profile itself: the post is there (`done`, with its `post_id`), or two complete reads of the profile, 15 and 30 minutes after the post, find nothing new (`failed`, `422 errors/not_sent`: it can be sent again). While it checks, for 90 minutes at most, the receipt is `pending` with a `detail` and `check_ends_by`. When the check can't tell, the receipt stays `pending`: check on Instagram. `POST /writes/{key}/not-sent`: after you checked on Instagram that a pending write isn't there, it becomes `failed`, its key can be sent again, and it stops counting toward the pace. While Lempile is still checking the profile for a post, it answers `409` with `check_ends_by` and a `Retry-After` header: read the receipt then. It also answers `409` with `Retry-After` for a post Lempile can't speak for yet (it restarted during the post), up to 2 hours after the post. --- # Instagram API: Unipile Compatibility > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact > Every Unipile v1 route that works with Instagram, and what Lempile does with it: the same, the same with differences, 501, or not served yet. Every Unipile v1 route that works with an Instagram account, and what Lempile does with it. The base URL is `https://api.lempile.com/api/v1`, with Unipile's paths after it. - **Same**: Unipile's path, parameters, answer shape and status. - **Same, but**: answered, with the differences listed. - **501**: answers `501 errors/feature_not_implemented` with a `detail` saying why. Nothing is done, so a client can fall back. - **Not yet**: not served yet; answers `404` (`"Route not found."`). On every route, `account_id` also takes the account's Instagram id or username, and a person also takes a username, `@username` or profile link. A person's numeric Instagram id works once the account has seen that person (in a chat, a follower list, a profile read); otherwise it answers `400` and asks for the username. ## Accounts And Hosted Auth | Unipile route | Lempile | Notes | | --- | --- | --- | | `GET /accounts` | Same, but | Lempile's own list: `{ "object": "list", "count", "items" }`, every network of the workspace, each with `provider` (`instagram`) and `status`. No `cursor`, `total_count` or `status_counts`. | | `GET /accounts/{account_id}` | Same, but | `sources[].status` is `OK`, `CONNECTING`, `CREDENTIALS` or `ERROR`. | | `POST /accounts` (username and password) | Same, but | Answers within 60 seconds: `AccountCreated`, or a `Checkpoint` (`202`). The account gets its own Lempile IP. Early access: `403 errors/feature_not_subscribed` until Instagram is open to the workspace. | | `POST /accounts` (`sessionid` cookie) | 501 | Instagram ends a session that moves to a new device and IP. | | `POST /accounts` (`unilogin`) | 501 | | | `POST /accounts/checkpoint` | Same | `OTP`, `2FA`, `IN_APP_VALIDATION`; `TRY_ANOTHER_WAY`. 5 minutes per sign-in. | | `POST /accounts/checkpoint/resend` | Same | Instagram's own "Send again". | | `POST /accounts/{account_id}` (reconnect) | Same, but | Username and password only. The account keeps its id and its IP. | | `POST /hosted/accounts/link` | Same, but | The page is Lempile's (`lempile.com/connect/instagram?token=…`). 24 hours at most. A new account joins the key's workspace. | | `PATCH /accounts/{account_id}` | Not yet | | | `DELETE /accounts/{account_id}` | Same | | | `POST /accounts/{account_id}/restart` | Not yet | | | `GET /accounts/{account_id}/sync` | 501 | Unipile doesn't do it for Instagram either. Use `GET /chats/{chat_id}/sync`. | ## Messaging | Unipile route | Lempile | Notes | | --- | --- | --- | | `GET /chats` | Same, but | `account_id` required. `unread`, `before`, `after`: 501. Message requests have `folder: ["PENDING"]`. | | `GET /chats/{chat_id}` | Same, but | `account_id` required. Opens the conversation only when the inbox can't answer (`marks_seen`). Also takes the chat's `instagram.com/direct/t//` link. | | `GET /chats/{chat_id}/messages` | Same, but | `account_id` required. `before`, `after`, `sender_id`: 501. Opens the conversation only when the inbox can't answer (`marks_seen`). A message's `id` is `_`. | | `POST /chats/{chat_id}/messages` | Same, but | `Idempotency-Key` required. JSON or `multipart/form-data`. Text up to 1,000 characters. `quote_id` is Instagram's Reply. Voice notes as `.m4a` in `attachments` or `voice_message`. `mentions`, `thread_id`, `typing_duration`, `video_message`: `400`. | | `POST /chats` | Same, but | `Idempotency-Key` required. One attendee (groups: 501); `attendees_ids` also takes a `provider_id`, username or link. One text message per message request until it's accepted. `quote_id`, `linkedin`, `subject`, `video_message`: `400`. | | `GET /chats/{chat_id}/attendees` | Same | | | `GET /chats/{chat_id}/sync` | Same, but | Reads the chat from Instagram at once and answers when done (`status: "SYNC_DONE"`, or `"CHAT_DELETED"` for a chat Instagram no longer has). | | `GET /messages` | Same, but | `account_id` required. The newest chats' messages: opens a chat only when the inbox can't answer (`marks_seen`). | | `GET /messages/{message_id}` | Same, but | `account_id` required. Found among its chat's newest 300 messages, else `404`. | | `GET /messages/{message_id}/attachments/{attachment_id}` | Same | The file, read in the account's own session. | | `POST /messages/{message_id}/reaction` | Same | One reaction per person: a new one replaces the last. | | `DELETE /messages/{message_id}/reaction` | Same | Unipile names no providers for this route; Lempile serves it for Instagram. | | `GET /chat_attendees` | Same | | | `GET /chat_attendees/{attendee_id}` | Same | | | `GET /chat_attendees/{attendee_id}/picture` | Same | | | `GET /chat_attendees/{attendee_id}/chats` | Same | The account's one-to-one chat with that person. | | `GET /chat_attendees/{sender_id}/messages` | Same | | | `GET /chat_attendees/{attendee_id}/sync` | 501 | Use `GET /chats/{chat_id}/sync`. | | `DELETE /chats/{chat_id}`, `PATCH /chats/{chat_id}` | 501 | Unipile doesn't do them for Instagram either (WhatsApp, LinkedIn and Telegram only). | | `DELETE /messages/{message_id}`, `PATCH /messages/{message_id}`, `POST /messages/{message_id}/forward` | 501 | Unipile doesn't do them for Instagram either. | ## Users | Unipile route | Lempile | Notes | | --- | --- | --- | | `GET /users/{identifier}` | Same | Each read opens the profile in the account's browser. | | `GET /users/me` | Same, but | Unipile publishes no Instagram shape for it: Lempile answers the `UserProfile` fields with `object: "AccountOwnerProfile"`. | | `PATCH /users/me/edit` | Same, but | `summary` (the bio, 150 at most) and `picture`. LinkedIn's fields answer `400`. | | `GET /users/followers` | Same | 25 a page at most (a `limit` from 26 to 250 gets 25; more answers `400`). | | `GET /users/following` | Same, but | Items are `UserFollower`, as followers'. Unipile documents LinkedIn's relation shape for this route. 25 a page by default, 100 at most (a `limit` from 101 to 1,000 gets 100; more answers `400`). | | `POST /users/invite` | Same, but | Follows. `Idempotency-Key` required. `invitation_id` is the person's `provider_id`. A private account gets a follow request. | | `DELETE /users/invite/sent/{invitation_id}` | Same, but | Unfollows, or takes back a follow request. `Idempotency-Key` required. | | `GET /users/invite/received` | Same, but | The account's follow requests. Unipile publishes only LinkedIn's item shape; an item's `id` is the person's `provider_id`. | | `POST /users/invite/received/{invitation_id}` | Same | `accept` or `decline`. | | `GET /users/{identifier}/posts` | Same | | | `GET /users/{identifier}/comments`, `GET /users/{identifier}/reactions` | 501 | Instagram's web doesn't list them. | | `GET /users/invite/sent`, `GET /users/relations` | 501 | Unipile doesn't do them for Instagram either. | ## Posts | Unipile route | Lempile | Notes | | --- | --- | --- | | `GET /posts/{post_id}` | Same | `provider_id`, shortcode, or the post or reel link. | | `GET /posts/{post_id}/comments` | Same, but | In the order the post's page shows them: `sort_by=MOST_RELEVANT` is 501. Replies with `comment_id`. | | `POST /posts/{post_id}/comments` | Same, but | `Idempotency-Key` required. Replies with `comment_id`. | | `GET /posts/{post_id}/reactions` | Same, but | Unipile publishes only LinkedIn's shape: each like is a `PostReaction` with `value: "LIKE"`, `author.type: "INDIVIDUAL"` and an empty `headline`. | | `POST /posts/reaction` | Same | `like` only, on a post or a comment. | | `POST /posts` | Same, but | `Idempotency-Key` required. Feed posts, 1 to 10 pictures or videos. A story (`post_type: "story"`) or a `video_thumbnail`: 501, Instagram's web can't make them. | | `GET /posts/drafts/{draft_id}` | 501 | LinkedIn only on Unipile. | ## Webhooks | Unipile route or event | Lempile | Notes | | --- | --- | --- | | `POST /webhooks` | Same, but | Sources `messaging` and `account_status`. A `messaging` webhook takes `events` (default `message_received`, as Unipile), `account_ids` (Lempile ids, 50 at most), `format`, `data` and `enabled`. The answer adds `secret`, which signs every call (`X-Lempile-Signature`). | | `GET /webhooks` | Same, but | Header values masked. | | `DELETE /webhooks/{webhook_id}` | Same | | | `messaging` events | Same, but | `message_received`, `message_read`, `message_reaction`, about 10 minutes after the fact, not between 23:00 and 07:00 in the account's time zone. Retried 30 s, 2 min, 10 min, 30 min and 2 h later. `message_edited`, `message_deleted`, `message_delivered`: accepted, never sent. | | `account_status` events | Same, but | `CREATION_SUCCESS`, `RECONNECTED`, `OK`, `CONNECTING`, `CREDENTIALS` (signed out, a security check, or suspended), `DELETED`. Never `ERROR`, `CREATION_FAIL`, `STOPPED`, `PERMISSIONS`, `SYNC_SUCCESS`. Lempile adds `status`, `previous_status` and `reason` around Unipile's `AccountStatus`. Seen when Lempile next opens the account (a call, or the inbox read about every 10 minutes, not at night). | | `users` events (`new_relation`) | Never sent | Unipile doesn't send them for Instagram either. | ## Lempile's Own | | | | --- | --- | | `"dry_run": true` on every write | Everything up to the last step, nothing sent: `200` with `not_sent: true`. A message's dry run never types. When the write is already so (already liked, already following), the answer says so in `checks`. | | `Idempotency-Key` on every write | Required on messages, new chats, comments, posts, follows and unfollows; made by Lempile (and answered in the same header) for the other writes when none is sent. A retry never writes twice; replays say `Idempotent-Replayed: true`. | | `GET /writes/{key}` | What became of a write. See [Errors And Limits](https://lempile.com/docs/instagram/errors-and-limits#write-receipts). | | `marks_seen` | `true` on an answer that opened a conversation. | | `retry_at`, `code` on a `429` | When to try again, and which limit. | --- # Instagram API API reference > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact Base URL: `https://api.lempile.com`. Authentication: your API key in the `X-API-KEY` header. OpenAPI document: [instagram.json](https://lempile.com/docs-assets/openapi/instagram.json). ## Accounts - [List accounts](https://lempile.com/docs/instagram/reference/list-accounts): `GET /api/v1/accounts` - [Connect an account](https://lempile.com/docs/instagram/reference/connect-account): `POST /api/v1/accounts` - [Answer a checkpoint](https://lempile.com/docs/instagram/reference/solve-checkpoint): `POST /api/v1/accounts/checkpoint` - [Send the code again](https://lempile.com/docs/instagram/reference/resend-checkpoint): `POST /api/v1/accounts/checkpoint/resend` - [Retrieve an account](https://lempile.com/docs/instagram/reference/get-account): `GET /api/v1/accounts/{account_id}` - [Reconnect an account](https://lempile.com/docs/instagram/reference/reconnect-account): `POST /api/v1/accounts/{account_id}` - [Remove an account](https://lempile.com/docs/instagram/reference/delete-account): `DELETE /api/v1/accounts/{account_id}` - [Create a hosted link](https://lempile.com/docs/instagram/reference/create-hosted-link): `POST /api/v1/hosted/accounts/link` ## Chats and messages - [List chats](https://lempile.com/docs/instagram/reference/list-chats): `GET /api/v1/chats` - [Start a chat](https://lempile.com/docs/instagram/reference/start-chat): `POST /api/v1/chats` - [Retrieve a chat](https://lempile.com/docs/instagram/reference/get-chat): `GET /api/v1/chats/{chat_id}` - [List a chat's messages](https://lempile.com/docs/instagram/reference/list-chat-messages): `GET /api/v1/chats/{chat_id}/messages` - [Send a message](https://lempile.com/docs/instagram/reference/send-message): `POST /api/v1/chats/{chat_id}/messages` - [List a chat's attendees](https://lempile.com/docs/instagram/reference/list-chat-attendees): `GET /api/v1/chats/{chat_id}/attendees` - [Read a chat again](https://lempile.com/docs/instagram/reference/sync-chat): `GET /api/v1/chats/{chat_id}/sync` - [List messages](https://lempile.com/docs/instagram/reference/list-messages): `GET /api/v1/messages` - [Retrieve a message](https://lempile.com/docs/instagram/reference/get-message): `GET /api/v1/messages/{message_id}` - [Retrieve an attachment](https://lempile.com/docs/instagram/reference/get-attachment): `GET /api/v1/messages/{message_id}/attachments/{attachment_id}` - [React to a message](https://lempile.com/docs/instagram/reference/add-message-reaction): `POST /api/v1/messages/{message_id}/reaction` - [Remove a reaction](https://lempile.com/docs/instagram/reference/remove-message-reaction): `DELETE /api/v1/messages/{message_id}/reaction` ## Attendees - [List attendees](https://lempile.com/docs/instagram/reference/list-attendees): `GET /api/v1/chat_attendees` - [Retrieve an attendee](https://lempile.com/docs/instagram/reference/get-attendee): `GET /api/v1/chat_attendees/{attendee_id}` - [Retrieve an attendee's picture](https://lempile.com/docs/instagram/reference/get-attendee-picture): `GET /api/v1/chat_attendees/{attendee_id}/picture` - [List an attendee's chats](https://lempile.com/docs/instagram/reference/list-attendee-chats): `GET /api/v1/chat_attendees/{attendee_id}/chats` - [List an attendee's messages](https://lempile.com/docs/instagram/reference/list-attendee-messages): `GET /api/v1/chat_attendees/{attendee_id}/messages` ## Users - [Retrieve the account's own profile](https://lempile.com/docs/instagram/reference/get-own-profile): `GET /api/v1/users/me` - [Edit the profile](https://lempile.com/docs/instagram/reference/edit-profile): `PATCH /api/v1/users/me/edit` - [List followers](https://lempile.com/docs/instagram/reference/list-followers): `GET /api/v1/users/followers` - [List following](https://lempile.com/docs/instagram/reference/list-following): `GET /api/v1/users/following` - [Follow someone](https://lempile.com/docs/instagram/reference/follow): `POST /api/v1/users/invite` - [Unfollow someone](https://lempile.com/docs/instagram/reference/unfollow): `DELETE /api/v1/users/invite/sent/{invitation_id}` - [List follow requests](https://lempile.com/docs/instagram/reference/list-follow-requests): `GET /api/v1/users/invite/received` - [Answer a follow request](https://lempile.com/docs/instagram/reference/answer-follow-request): `POST /api/v1/users/invite/received/{invitation_id}` - [Retrieve a profile](https://lempile.com/docs/instagram/reference/get-user): `GET /api/v1/users/{identifier}` ## Posts - [List a profile's posts](https://lempile.com/docs/instagram/reference/list-user-posts): `GET /api/v1/users/{identifier}/posts` - [Create a post](https://lempile.com/docs/instagram/reference/create-post): `POST /api/v1/posts` - [Like a post](https://lempile.com/docs/instagram/reference/like-post): `POST /api/v1/posts/reaction` - [Retrieve a post](https://lempile.com/docs/instagram/reference/get-post): `GET /api/v1/posts/{post_id}` - [List comments](https://lempile.com/docs/instagram/reference/list-comments): `GET /api/v1/posts/{post_id}/comments` - [Comment on a post](https://lempile.com/docs/instagram/reference/send-comment): `POST /api/v1/posts/{post_id}/comments` - [List likes](https://lempile.com/docs/instagram/reference/list-likes): `GET /api/v1/posts/{post_id}/reactions` ## Webhooks - [List webhooks](https://lempile.com/docs/instagram/reference/list-webhooks): `GET /api/v1/webhooks` - [Register a webhook](https://lempile.com/docs/instagram/reference/create-webhook): `POST /api/v1/webhooks` - [Delete a webhook](https://lempile.com/docs/instagram/reference/delete-webhook): `DELETE /api/v1/webhooks/{webhook_id}` ## Write receipts - [Retrieve a write receipt](https://lempile.com/docs/instagram/reference/get-write): `GET /api/v1/writes/{key}` - [Mark a write not sent](https://lempile.com/docs/instagram/reference/release-write): `POST /api/v1/writes/{key}/not-sent` --- # Instagram API: List accounts > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `GET https://api.lempile.com/api/v1/accounts` The workspace's connected accounts, every network together. An Instagram account has `provider: "instagram"`; one Instagram restricted shows `restriction` (why, and since when). Read from Lempile's database: no browser opens. Scope: `accounts.read`. ## Authentication Send your Instagram API API key in the `X-API-KEY` header. ## Example request ```bash curl -sS "https://api.lempile.com/api/v1/accounts" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ## Responses ### 200 The accounts. ```json { "object": "list", "count": 0, "items": [ { "id": "string", "provider": "instagram", "display_name": "string", "public_identifier": "string", "status": "string", "restriction": {}, "connected_at": "string", "created_at": "string" } ] } ``` ### 401 A missing or invalid API key answers `{ "error": "unauthorized", "message" }`. `errors/disconnected_account` (problem JSON): Instagram signed the account out; connect it again. ```json { "error": "unauthorized", "message": "…" } ``` ### 402 `subscription_required` (in `error`): the workspace has no active trial or subscription. ```json { "error": "subscription_required", "message": "…" } ``` --- # Instagram API: Connect an account > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `POST https://api.lempile.com/api/v1/accounts` Signs an Instagram account in with its username and password, in its own new browser behind its own Lempile IP. Answers within 60 seconds: `AccountCreated`, or `202 Checkpoint` when Instagram asks for a code or an approval first (answer it with `POST /accounts/checkpoint`), or is still signing in (`CONNECTING`: read the account until it's `OK`). A sign-in waits 5 minutes for its checkpoints. `username` may also be the account's email or phone number. Only username and password sign in: a `sessionid` cookie answers `501`, because Instagram ends a session that moves to a new device and IP. Instagram is in early access: a workspace that isn't open for it yet gets `403 errors/feature_not_subscribed` (write to support@lempile.com). Scope: `accounts.write`. ## Authentication Send your Instagram API API key in the `X-API-KEY` header. ## Request body `application/json` (required) - `provider` (any, required) - `username` (string, required): The Instagram username. - `password` (string (password), required): The account's password. Used for this sign-in only. ## Example request ```bash curl -sS -X POST "https://api.lempile.com/api/v1/accounts" \ -H "X-API-KEY: $LEMPILE_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "provider": "INSTAGRAM", "username": "janedemo", "password": "…" }' ``` ## Responses ### 201 Signed in. ```json { "object": "AccountCreated", "account_id": "00000000-0000-4000-8000-0000000000c1" } ``` ### 202 Instagram asks for something first. ```json { "object": "Checkpoint", "account_id": "00000000-0000-4000-8000-0000000000c1", "checkpoint": { "type": "OTP", "source": "EMAIL", "can_try_another_way": true } } ``` ### 400 `errors/invalid_parameters`: a field Lempile won't take; `detail` names it. Nothing was opened. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 401 A missing or invalid API key answers `{ "error": "unauthorized", "message" }`. `errors/disconnected_account` (problem JSON): Instagram signed the account out; connect it again. `errors/invalid_credentials`: Instagram refused the username or password. ```json { "error": "unauthorized", "message": "…" } ``` ### 402 `subscription_required` (in `error`): the workspace has no active trial or subscription. ```json { "error": "subscription_required", "message": "…" } ``` ### 403 `errors/feature_not_subscribed` (Instagram isn't open to this workspace yet), `errors/password_reset_required` (Instagram wants a new password), `errors/action_required` (something done on Instagram itself) or `errors/insufficient_permissions` (the key lacks the scope). ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 409 `errors/already_exists`: the account is already connected in this workspace. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 425 `errors/auth_in_progress`: a sign-in of this account is still running; it carries the checkpoint when Instagram asked for one. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 429 `errors/too_many_requests`: Instagram asks to wait (`retry_after`). ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 501 `errors/feature_not_implemented`: a field or option Lempile doesn't do for Instagram (`detail` says which), or an account of another network. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 503 `errors/service_unavailable`: Lempile can't start the sign-in right now (no free IP for a new account, or its browser server is busy). Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 504 `errors/request_timeout`: Instagram didn't answer within 100 seconds. A read changed nothing: try again. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` --- # Instagram API: Answer a checkpoint > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `POST https://api.lempile.com/api/v1/accounts/checkpoint` Gives Instagram what a `Checkpoint` asked for: the code it sent (`OTP` and `2FA`: 4 to 8 digits), or `TRY_ANOTHER_WAY` (Instagram's "Try another way": another kind of check). Answers `AccountCreated`, or another `Checkpoint` when Instagram asks for one more thing. A sign-in waits 5 minutes for its checkpoints; after that, `408`: start again with `POST /accounts`. Scope: `accounts.write`. ## Authentication Send your Instagram API API key in the `X-API-KEY` header. ## Request body `application/json` (required) - `provider` (any, required) - `account_id` (string, required) - `code` (string, required): The code, or `TRY_ANOTHER_WAY`. ## Example request ```bash curl -sS -X POST "https://api.lempile.com/api/v1/accounts/checkpoint" \ -H "X-API-KEY: $LEMPILE_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "provider": "INSTAGRAM", "account_id": "00000000-0000-4000-8000-0000000000c1", "code": "482913" }' ``` ## Responses ### 201 Signed in. ```json { "object": "AccountCreated", "account_id": "string" } ``` ### 202 One more checkpoint. ```json { "object": "Checkpoint", "account_id": "string", "checkpoint": { "type": "OTP", "source": "string", "number": "string", "can_try_another_way": false } } ``` ### 400 `errors/invalid_parameters`: a field Lempile won't take; `detail` names it. Nothing was opened. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 401 A missing or invalid API key answers `{ "error": "unauthorized", "message" }`. `errors/disconnected_account` (problem JSON): Instagram signed the account out; connect it again. `errors/invalid_checkpoint_solution`: a wrong code; send the right one. ```json { "error": "unauthorized", "message": "…" } ``` ### 402 `subscription_required` (in `error`): the workspace has no active trial or subscription. ```json { "error": "subscription_required", "message": "…" } ``` ### 403 `errors/insufficient_permissions` (the key lacks the scope), `errors/account_restricted` (Instagram blocked the action, restricted the account or asks for a check: someone has to look at it on Instagram) or `errors/action_required` (the account waits for something done on Instagram itself; `account_status` and `reason` say what). ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 404 `errors/resource_not_found`: no such account in this workspace, or no such chat, message, person or post. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 408 `errors/request_timeout`: the sign-in waited 5 minutes for its checkpoints. Start again with `POST /accounts`. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 409 `errors/checkpoint_switching_not_available`: Instagram offers no other way. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 503 `errors/service_unavailable`: the account isn't ready yet, or its browser can't be reached right now. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 504 `errors/request_timeout`: Instagram didn't answer within 100 seconds. A read changed nothing: try again. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` --- # Instagram API: Send the code again > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `POST https://api.lempile.com/api/v1/accounts/checkpoint/resend` Asks Instagram to send the checkpoint's code again, as its own "Send again" does. Scope: `accounts.write`. ## Authentication Send your Instagram API API key in the `X-API-KEY` header. ## Request body `application/json` (required) - `provider` (any, required) - `account_id` (string, required) ## Example request ```bash curl -sS -X POST "https://api.lempile.com/api/v1/accounts/checkpoint/resend" \ -H "X-API-KEY: $LEMPILE_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "provider": "INSTAGRAM", "account_id": "string" }' ``` ## Responses ### 200 Sent again. ```json { "object": "CheckpointResend", "account_id": "00000000-0000-4000-8000-0000000000c1", "success": true } ``` ### 400 `errors/invalid_parameters`: a field Lempile won't take; `detail` names it. Nothing was opened. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 401 A missing or invalid API key answers `{ "error": "unauthorized", "message" }`. `errors/disconnected_account` (problem JSON): Instagram signed the account out; connect it again. ```json { "error": "unauthorized", "message": "…" } ``` ### 402 `subscription_required` (in `error`): the workspace has no active trial or subscription. ```json { "error": "subscription_required", "message": "…" } ``` ### 403 `errors/insufficient_permissions` (the key lacks the scope), `errors/account_restricted` (Instagram blocked the action, restricted the account or asks for a check: someone has to look at it on Instagram) or `errors/action_required` (the account waits for something done on Instagram itself; `account_status` and `reason` say what). ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 404 `errors/resource_not_found`: no such account in this workspace, or no such chat, message, person or post. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 503 `errors/service_unavailable`: the account isn't ready yet, or its browser can't be reached right now. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 504 `errors/request_timeout`: Instagram didn't answer within 100 seconds. A read changed nothing: try again. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` --- # Instagram API: Retrieve an account > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `GET https://api.lempile.com/api/v1/accounts/{account_id}` One account, in Unipile's `Account`. `sources[].status` is `OK` (signed in and ready), `CONNECTING` (signing in), `CREDENTIALS` (Instagram signed it out: connect it again) or `ERROR` (Lempile can't reach its browser or IP right now). No browser opens. Scope: `accounts.read`. ## Authentication Send your Instagram API API key in the `X-API-KEY` header. ## Path parameters - `account_id` (string, required): Lempile id, Instagram user id or username. Example: `00000000-0000-4000-8000-0000000000c1`. ## Example request ```bash curl -sS "https://api.lempile.com/api/v1/accounts/00000000-0000-4000-8000-0000000000c1" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ## Responses ### 200 The account. ```json { "object": "Account", "type": "INSTAGRAM", "id": "00000000-0000-4000-8000-0000000000c1", "name": "janedemo", "created_at": "2026-11-25T18:20:41.000Z", "sources": [ { "id": "instagram_browser_session", "status": "OK" } ] } ``` ### 401 A missing or invalid API key answers `{ "error": "unauthorized", "message" }`. `errors/disconnected_account` (problem JSON): Instagram signed the account out; connect it again. ```json { "error": "unauthorized", "message": "…" } ``` ### 402 `subscription_required` (in `error`): the workspace has no active trial or subscription. ```json { "error": "subscription_required", "message": "…" } ``` ### 404 `errors/resource_not_found`: no such account in this workspace, or no such chat, message, person or post. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` --- # Instagram API: Reconnect an account > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `POST https://api.lempile.com/api/v1/accounts/{account_id}` Signs an account that shows `CREDENTIALS` in again, with the same body as `POST /accounts`. Answers `AccountReconnected` or a `Checkpoint`. The account keeps its id and its IP. Instagram is in early access: a workspace that isn't open for it yet gets `403 errors/feature_not_subscribed` (write to support@lempile.com). Scope: `accounts.write`. ## Authentication Send your Instagram API API key in the `X-API-KEY` header. ## Path parameters - `account_id` (string, required): Lempile id, Instagram user id or username. Example: `00000000-0000-4000-8000-0000000000c1`. ## Request body `application/json` (required) - `provider` (any, required) - `username` (string, required): The Instagram username. - `password` (string (password), required): The account's password. Used for this sign-in only. ## Example request ```bash curl -sS -X POST "https://api.lempile.com/api/v1/accounts/00000000-0000-4000-8000-0000000000c1" \ -H "X-API-KEY: $LEMPILE_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "provider": "INSTAGRAM", "username": "string", "password": "string" }' ``` ## Responses ### 200 Signed in again. ```json { "object": "AccountReconnected", "account_id": "string" } ``` ### 202 Instagram asks for something first. ```json { "object": "Checkpoint", "account_id": "string", "checkpoint": { "type": "OTP", "source": "string", "number": "string", "can_try_another_way": false } } ``` ### 400 `errors/invalid_parameters`: a field Lempile won't take; `detail` names it. Nothing was opened. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 401 A missing or invalid API key answers `{ "error": "unauthorized", "message" }`. `errors/disconnected_account` (problem JSON): Instagram signed the account out; connect it again. `errors/invalid_credentials`: Instagram refused the username or password. ```json { "error": "unauthorized", "message": "…" } ``` ### 402 `subscription_required` (in `error`): the workspace has no active trial or subscription. ```json { "error": "subscription_required", "message": "…" } ``` ### 403 `errors/feature_not_subscribed` (Instagram isn't open to this workspace yet), `errors/password_reset_required` (Instagram wants a new password), `errors/action_required` (something done on Instagram itself) or `errors/insufficient_permissions` (the key lacks the scope). ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 404 `errors/resource_not_found`: no such account in this workspace, or no such chat, message, person or post. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 425 `errors/auth_in_progress`: a sign-in of this account is still running; it carries the checkpoint when Instagram asked for one. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 429 `errors/too_many_requests`: Instagram asks to wait (`retry_after`). ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 501 `errors/feature_not_implemented`: a field or option Lempile doesn't do for Instagram (`detail` says which), or an account of another network. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 503 `errors/service_unavailable`: Lempile can't start the sign-in right now (no free IP for a new account, or its browser server is busy). Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 504 `errors/request_timeout`: Instagram didn't answer within 100 seconds. A read changed nothing: try again. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` --- # Instagram API: Remove an account > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `DELETE https://api.lempile.com/api/v1/accounts/{account_id}` Removes the account from Lempile. The Instagram account itself is untouched. Scope: `accounts.write`. ## Authentication Send your Instagram API API key in the `X-API-KEY` header. ## Path parameters - `account_id` (string, required): Lempile id, Instagram user id or username. Example: `00000000-0000-4000-8000-0000000000c1`. ## Example request ```bash curl -sS -X DELETE "https://api.lempile.com/api/v1/accounts/00000000-0000-4000-8000-0000000000c1" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ## Responses ### 200 Removed. ```json { "object": "AccountDeleted" } ``` ### 401 A missing or invalid API key answers `{ "error": "unauthorized", "message" }`. `errors/disconnected_account` (problem JSON): Instagram signed the account out; connect it again. ```json { "error": "unauthorized", "message": "…" } ``` ### 402 `subscription_required` (in `error`): the workspace has no active trial or subscription. ```json { "error": "subscription_required", "message": "…" } ``` ### 403 `errors/insufficient_permissions` (the key lacks the scope), `errors/account_restricted` (Instagram blocked the action, restricted the account or asks for a check: someone has to look at it on Instagram) or `errors/action_required` (the account waits for something done on Instagram itself; `account_status` and `reason` say what). ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 404 `errors/resource_not_found`: no such account in this workspace, or no such chat, message, person or post. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` --- # Instagram API: Create a hosted link > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `POST https://api.lempile.com/api/v1/hosted/accounts/link` A link to Lempile's own sign-in page, for someone else to connect their Instagram account (with Instagram's code when it asks). The new account joins the key's workspace. A link lasts 24 hours at most; treat it as a secret. `"type": "reconnect"` with `reconnect_account` signs an existing account in again. Instagram is in early access: a workspace that isn't open for it yet gets `403 errors/feature_not_subscribed` (write to support@lempile.com). Scope: `accounts.write`. ## Authentication Send your Instagram API API key in the `X-API-KEY` header. ## Request body `application/json` (required) - `type` (string, required): One of: `create`, `reconnect`. - `providers` (array of any, required) - `api_url` (string): Your base URL, as Unipile asks for it. - `expiresOn` (string (date-time), required): At most 24 hours from now. - `reconnect_account` (string): With `type: "reconnect"`: the account's id. ## Example request ```bash curl -sS -X POST "https://api.lempile.com/api/v1/hosted/accounts/link" \ -H "X-API-KEY: $LEMPILE_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "type": "create", "providers": [ "INSTAGRAM" ], "api_url": "https://api.lempile.com/api/v1", "expiresOn": "2026-11-26T18:00:00.000Z" }' ``` ## Responses ### 201 The link. ```json { "object": "HostedAuthUrl", "url": "https://lempile.com/connect/instagram?token=…" } ``` ### 400 `errors/invalid_parameters`: a field Lempile won't take; `detail` names it. Nothing was opened. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 401 A missing or invalid API key answers `{ "error": "unauthorized", "message" }`. `errors/disconnected_account` (problem JSON): Instagram signed the account out; connect it again. ```json { "error": "unauthorized", "message": "…" } ``` ### 402 `subscription_required` (in `error`): the workspace has no active trial or subscription. ```json { "error": "subscription_required", "message": "…" } ``` ### 403 `errors/insufficient_permissions` (the key lacks the scope), `errors/account_restricted` (Instagram blocked the action, restricted the account or asks for a check: someone has to look at it on Instagram) or `errors/action_required` (the account waits for something done on Instagram itself; `account_status` and `reason` say what). ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 404 `errors/resource_not_found`: no such account in this workspace, or no such chat, message, person or post. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` --- # Instagram API: List chats > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `GET https://api.lempile.com/api/v1/chats` The account's Instagram inbox, newest activity first. A message request the account received has `folder: ["PENDING"]`. Opens no conversation, so nobody sees "Seen". Scope: `accounts.read`. ## Authentication Send your Instagram API API key in the `X-API-KEY` header. ## Query parameters - `account_id` (string, required): The connected Instagram account: its Lempile id (a UUID), its Instagram user id or its username. Example: `00000000-0000-4000-8000-0000000000c1`. - `limit` (integer): 1 to 250 (default 20). Default: `20`. - `cursor` (string): The previous page's `cursor`. - `unread` (string): Not yet: `501`. - `before` (string): Not yet: `501`. - `after` (string): Not yet: `501`. ## Example request ```bash curl -sS "https://api.lempile.com/api/v1/chats?account_id=00000000-0000-4000-8000-0000000000c1" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ## Responses ### 200 The chats. ```json { "object": "ChatList", "items": [ { "object": "Chat", "id": "string", "account_id": "string", "account_type": "INSTAGRAM", "provider_id": "string", "attendee_provider_id": "string", "name": "string", "type": 0, "timestamp": "2026-10-29T09:00:00Z", "unread_count": 0, "archived": 0, "muted_until": "string", "read_only": 0, "folder": [ "INBOX_INSTAGRAM_GENERAL" ], "pinned": 0, "lastMessage": { "object": "Message", "id": "string", "message_id": "string", "provider_id": "string", "account_id": "string", "chat_id": "string", "chat_provider_id": "string", "sender_id": "string", "sender_attendee_id": "string", "text": "string", "attachments": [ {} ], "timestamp": "2026-10-29T09:00:00Z", "is_sender": 0, "reactions": [ {} ], "seen": 0, "seen_by": {}, "hidden": 0, "deleted": 0, "edited": 0, "is_event": 0, "delivered": 0, "behavior": null, "original": "string", "message_type": "STORY_MENTION", "marks_seen": false }, "marks_seen": false } ], "cursor": "string" } ``` ### 400 `errors/invalid_parameters`: a field Lempile won't take; `detail` names it. Nothing was opened. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 401 A missing or invalid API key answers `{ "error": "unauthorized", "message" }`. `errors/disconnected_account` (problem JSON): Instagram signed the account out; connect it again. ```json { "error": "unauthorized", "message": "…" } ``` ### 402 `subscription_required` (in `error`): the workspace has no active trial or subscription. ```json { "error": "subscription_required", "message": "…" } ``` ### 403 `errors/insufficient_permissions` (the key lacks the scope), `errors/account_restricted` (Instagram blocked the action, restricted the account or asks for a check: someone has to look at it on Instagram) or `errors/action_required` (the account waits for something done on Instagram itself; `account_status` and `reason` say what). ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 404 `errors/resource_not_found`: no such account in this workspace, or no such chat, message, person or post. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 429 `errors/too_many_requests`: the account's pace (`code`: `too_fast`, `daily_limit` or `hourly_limit`; wait until `retry_at`), or Instagram's own "Try again later" (`retry_after: 86400`: wait a day before writing from the account again). Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 501 `errors/feature_not_implemented`: a field or option Lempile doesn't do for Instagram (`detail` says which), or an account of another network. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 503 `errors/service_unavailable`: the account isn't ready yet, or its browser can't be reached right now. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 504 `errors/request_timeout`: Instagram didn't answer within 100 seconds. A read changed nothing: try again. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` --- # Instagram API: Start a chat > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `POST https://api.lempile.com/api/v1/chats` Sends a first message to one person. When a chat with them already exists, the message goes there. Someone who doesn't follow the account gets a message request: until they accept, Instagram allows one message, text only. `quote_id`, `linkedin`, `subject` and `video_message` answer `400`. Paced per account: 3 minutes between new chats, 20 a day. Scope: `accounts.write`. ## Authentication Send your Instagram API API key in the `X-API-KEY` header. ## Headers - `Idempotency-Key` (string, required): 1–200 characters of `A-Z a-z 0-9 . _ : -`, scoped to your workspace. The same key with the same request replays the first answer; see Write receipts. A dry run needs none. Example: `answer-jane-1`. ## Request body `application/json` (required) - `account_id` (string, required) - `text` (string): Up to 1,000 characters (Instagram's own limit). Needed unless there are files. - `dry_run` (boolean): `true`: everything up to the last step, nothing sent: `200` with `not_sent: true`. Not paced, no receipt. When the write is already so (already liked, already following), `checks` holds `{ "check": "already", "already": true }`. - `attendees_ids` (array of string, required): One person: their `provider_messaging_id` (as Unipile asks), `provider_id`, username, `@username` or profile link. Two or more (a group): `501`. `multipart/form-data` (required) - `account_id` (string, required) - `text` (string): Up to 1,000 characters (Instagram's own limit). Needed unless there are files. - `attachments` (array of string (binary)): `multipart/form-data` only: JPEG or PNG pictures (8 MB each), MP4 or MOV videos (25 MB), voice notes as M4A, AAC or MP3 (10 MB). 10 files and 25 MB at most in all. Any other type: `415`. - `dry_run` (boolean): `true`: everything up to the last step, nothing sent: `200` with `not_sent: true`. Not paced, no receipt. When the write is already so (already liked, already following), `checks` holds `{ "check": "already", "already": true }`. - `attendees_ids` (array of string, required): One person: their `provider_messaging_id` (as Unipile asks), `provider_id`, username, `@username` or profile link. Two or more (a group): `501`. ## Example request ```bash curl -sS -X POST "https://api.lempile.com/api/v1/chats" \ -H "X-API-KEY: $LEMPILE_API_KEY" \ -H "Idempotency-Key: answer-jane-1" \ -H "Content-Type: application/json" \ -d '{ "account_id": "00000000-0000-4000-8000-0000000000c1", "attendees_ids": [ "sam.example" ], "text": "Hi Sam, thanks for the follow." }' ``` ## Responses ### 200 A dry run: nothing typed or sent. ```json { "object": "string", "not_sent": true, "checks": [ {} ] } ``` ### 201 Sent. ```json { "object": "ChatStarted", "chat_id": "340282366841710301244276026398105347911", "message_id": "340282366841710301244276026398105347911_cAAAAB3xYz9wQkLmNo" } ``` ### 400 `errors/invalid_parameters`: a field Lempile won't take; `detail` names it. Nothing was opened. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 401 A missing or invalid API key answers `{ "error": "unauthorized", "message" }`. `errors/disconnected_account` (problem JSON): Instagram signed the account out; connect it again. ```json { "error": "unauthorized", "message": "…" } ``` ### 402 `subscription_required` (in `error`): the workspace has no active trial or subscription. ```json { "error": "subscription_required", "message": "…" } ``` ### 403 `errors/insufficient_permissions` (the key lacks the scope), `errors/account_restricted` (Instagram blocked the action, restricted the account or asks for a check: someone has to look at it on Instagram) or `errors/action_required` (the account waits for something done on Instagram itself; `account_status` and `reason` say what). ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 404 `errors/resource_not_found`: no such account in this workspace, or no such chat, message, person or post. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 409 `errors/in_progress`: the same key is still running, or its outcome isn't known yet. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 415 `errors/unsupported_media_type`: a file Instagram doesn't take. Nothing was sent. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 422 `errors/idempotency_key_reused`, `errors/invalid_recipient` (no Instagram account by that name or id), `errors/user_unreachable` (Instagram won't let the account message this person) or `errors/cant_send_message` (a message request is waiting for their answer: until they accept, one text message only). Nothing was sent. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 429 `errors/too_many_requests`: the account's pace (`code`: `too_fast`, `daily_limit` or `hourly_limit`; wait until `retry_at`), or Instagram's own "Try again later" (`retry_after: 86400`: wait a day before writing from the account again). Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 501 `errors/feature_not_implemented`: a field or option Lempile doesn't do for Instagram (`detail` says which), or an account of another network. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 502 `errors/service_unavailable`: the browser's answer was lost after the write started. Not sure: read the receipt before sending again. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 503 `errors/service_unavailable`: the account isn't ready yet, or its browser can't be reached right now. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 504 `errors/request_timeout`: Instagram didn't confirm within 140 seconds. Not sure: read the receipt before sending again. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` --- # Instagram API: Retrieve a chat > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `GET https://api.lempile.com/api/v1/chats/{chat_id}` One `Chat`, with its latest message as `lastMessage` (or `null`). Opens the conversation only when the inbox can't answer (`marks_seen: true` when it opened messages the account hadn't seen). Scope: `accounts.read`. ## Authentication Send your Instagram API API key in the `X-API-KEY` header. ## Path parameters - `chat_id` (string, required): The chat's id (the number in `instagram.com/direct/t//`), or that link. Example: `340282366841710301244276026398105347911`. ## Query parameters - `account_id` (string, required): The connected Instagram account: its Lempile id (a UUID), its Instagram user id or its username. Example: `00000000-0000-4000-8000-0000000000c1`. ## Example request ```bash curl -sS "https://api.lempile.com/api/v1/chats/340282366841710301244276026398105347911?account_id=00000000-0000-4000-8000-0000000000c1" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ## Responses ### 200 The chat. ```json { "object": "Chat", "id": "string", "account_id": "string", "account_type": "INSTAGRAM", "provider_id": "string", "attendee_provider_id": "string", "name": "string", "type": 0, "timestamp": "2026-10-29T09:00:00Z", "unread_count": 0, "archived": 0, "muted_until": "string", "read_only": 0, "folder": [ "INBOX_INSTAGRAM_GENERAL" ], "pinned": 0, "lastMessage": { "object": "Message", "id": "string", "message_id": "string", "provider_id": "string", "account_id": "string", "chat_id": "string", "chat_provider_id": "string", "sender_id": "string", "sender_attendee_id": "string", "text": "string", "attachments": [ { "id": "string", "type": "img", "url": "string", "voice_note": false, "post": {}, "story": {} } ], "timestamp": "2026-10-29T09:00:00Z", "is_sender": 0, "reactions": [ { "value": "string", "sender_id": "string", "is_sender": false } ], "seen": 0, "seen_by": {}, "hidden": 0, "deleted": 0, "edited": 0, "is_event": 0, "delivered": 0, "behavior": null, "original": "string", "message_type": "STORY_MENTION", "marks_seen": false }, "marks_seen": false } ``` ### 400 `errors/invalid_parameters`: a field Lempile won't take; `detail` names it. Nothing was opened. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 401 A missing or invalid API key answers `{ "error": "unauthorized", "message" }`. `errors/disconnected_account` (problem JSON): Instagram signed the account out; connect it again. ```json { "error": "unauthorized", "message": "…" } ``` ### 402 `subscription_required` (in `error`): the workspace has no active trial or subscription. ```json { "error": "subscription_required", "message": "…" } ``` ### 403 `errors/insufficient_permissions` (the key lacks the scope), `errors/account_restricted` (Instagram blocked the action, restricted the account or asks for a check: someone has to look at it on Instagram) or `errors/action_required` (the account waits for something done on Instagram itself; `account_status` and `reason` say what). ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 404 `errors/resource_not_found`: no such account in this workspace, or no such chat, message, person or post. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 429 `errors/too_many_requests`: the account's pace (`code`: `too_fast`, `daily_limit` or `hourly_limit`; wait until `retry_at`), or Instagram's own "Try again later" (`retry_after: 86400`: wait a day before writing from the account again). Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 501 `errors/feature_not_implemented`: a field or option Lempile doesn't do for Instagram (`detail` says which), or an account of another network. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 503 `errors/service_unavailable`: the account isn't ready yet, or its browser can't be reached right now. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 504 `errors/request_timeout`: Instagram didn't answer within 100 seconds. A read changed nothing: try again. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` --- # Instagram API: List a chat's messages > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `GET https://api.lempile.com/api/v1/chats/{chat_id}/messages` Newest first. Opens the conversation only when the inbox can't answer (`marks_seen: true` when it opened messages the account hadn't seen). Scope: `accounts.read`. ## Authentication Send your Instagram API API key in the `X-API-KEY` header. ## Path parameters - `chat_id` (string, required): The chat's id (the number in `instagram.com/direct/t//`), or that link. Example: `340282366841710301244276026398105347911`. ## Query parameters - `account_id` (string, required): The connected Instagram account: its Lempile id (a UUID), its Instagram user id or its username. Example: `00000000-0000-4000-8000-0000000000c1`. - `limit` (integer): 1 to 250 (default 20). Default: `20`. - `cursor` (string): The previous page's `cursor`. - `before` (string): Not yet: `501`. - `after` (string): Not yet: `501`. - `sender_id` (string): Not yet: `501`. ## Example request ```bash curl -sS "https://api.lempile.com/api/v1/chats/340282366841710301244276026398105347911/messages?account_id=00000000-0000-4000-8000-0000000000c1" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ## Responses ### 200 The messages. ```json { "object": "MessageList", "items": [ { "object": "Message", "id": "string", "message_id": "string", "provider_id": "string", "account_id": "string", "chat_id": "string", "chat_provider_id": "string", "sender_id": "string", "sender_attendee_id": "string", "text": "string", "attachments": [ { "id": "string", "type": "img", "url": "string", "voice_note": false, "post": {}, "story": {} } ], "timestamp": "2026-10-29T09:00:00Z", "is_sender": 0, "reactions": [ { "value": "string", "sender_id": "string", "is_sender": false } ], "seen": 0, "seen_by": {}, "hidden": 0, "deleted": 0, "edited": 0, "is_event": 0, "delivered": 0, "behavior": null, "original": "string", "message_type": "STORY_MENTION", "marks_seen": false } ], "cursor": "string" } ``` ### 400 `errors/invalid_parameters`: a field Lempile won't take; `detail` names it. Nothing was opened. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 401 A missing or invalid API key answers `{ "error": "unauthorized", "message" }`. `errors/disconnected_account` (problem JSON): Instagram signed the account out; connect it again. ```json { "error": "unauthorized", "message": "…" } ``` ### 402 `subscription_required` (in `error`): the workspace has no active trial or subscription. ```json { "error": "subscription_required", "message": "…" } ``` ### 403 `errors/insufficient_permissions` (the key lacks the scope), `errors/account_restricted` (Instagram blocked the action, restricted the account or asks for a check: someone has to look at it on Instagram) or `errors/action_required` (the account waits for something done on Instagram itself; `account_status` and `reason` say what). ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 404 `errors/resource_not_found`: no such account in this workspace, or no such chat, message, person or post. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 429 `errors/too_many_requests`: the account's pace (`code`: `too_fast`, `daily_limit` or `hourly_limit`; wait until `retry_at`), or Instagram's own "Try again later" (`retry_after: 86400`: wait a day before writing from the account again). Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 501 `errors/feature_not_implemented`: a field or option Lempile doesn't do for Instagram (`detail` says which), or an account of another network. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 503 `errors/service_unavailable`: the account isn't ready yet, or its browser can't be reached right now. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 504 `errors/request_timeout`: Instagram didn't answer within 100 seconds. A read changed nothing: try again. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` --- # Instagram API: Send a message > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `POST https://api.lempile.com/api/v1/chats/{chat_id}/messages` Sends a message in the chat, in the account's own browser, then reads it back from the chat so `message_id` is the message as Instagram has it. `quote_id` answers one of the chat's messages, as Instagram's Reply does. A voice note goes in `attachments` or `voice_message`. `mentions`, `thread_id`, `typing_duration` and `video_message` (LinkedIn's or WhatsApp's) answer `400`. Paced per account: 20 seconds between messages in chats, 80 a day. Scope: `accounts.write`. ## Authentication Send your Instagram API API key in the `X-API-KEY` header. ## Path parameters - `chat_id` (string, required): The chat's id (the number in `instagram.com/direct/t//`), or that link. Example: `340282366841710301244276026398105347911`. ## Headers - `Idempotency-Key` (string, required): 1–200 characters of `A-Z a-z 0-9 . _ : -`, scoped to your workspace. The same key with the same request replays the first answer; see Write receipts. A dry run needs none. Example: `answer-jane-1`. ## Request body `application/json` (required) - `account_id` (string, required) - `text` (string): Up to 1,000 characters (Instagram's own limit). Needed unless there are files. - `dry_run` (boolean): `true`: everything up to the last step, nothing sent: `200` with `not_sent: true`. Not paced, no receipt. When the write is already so (already liked, already following), `checks` holds `{ "check": "already", "already": true }`. - `quote_id` (string): A message id of this chat: the message answers it. - `voice_message` (string (binary)): `multipart/form-data` only: a voice note (M4A, AAC or MP3, 10 MB). `multipart/form-data` (required) - `account_id` (string, required) - `text` (string): Up to 1,000 characters (Instagram's own limit). Needed unless there are files. - `attachments` (array of string (binary)): `multipart/form-data` only: JPEG or PNG pictures (8 MB each), MP4 or MOV videos (25 MB), voice notes as M4A, AAC or MP3 (10 MB). 10 files and 25 MB at most in all. Any other type: `415`. - `dry_run` (boolean): `true`: everything up to the last step, nothing sent: `200` with `not_sent: true`. Not paced, no receipt. When the write is already so (already liked, already following), `checks` holds `{ "check": "already", "already": true }`. - `quote_id` (string): A message id of this chat: the message answers it. - `voice_message` (string (binary)): `multipart/form-data` only: a voice note (M4A, AAC or MP3, 10 MB). ## Example request ```bash curl -sS -X POST "https://api.lempile.com/api/v1/chats/340282366841710301244276026398105347911/messages" \ -H "X-API-KEY: $LEMPILE_API_KEY" \ -H "Idempotency-Key: answer-jane-1" \ -H "Content-Type: application/json" \ -d '{ "account_id": "00000000-0000-4000-8000-0000000000c1", "text": "Thanks, talk tomorrow." }' ``` ## Responses ### 200 A dry run: nothing typed or sent. ```json { "object": "string", "not_sent": true, "checks": [ {} ] } ``` ### 201 Sent. ```json { "object": "MessageSent", "message_id": "340282366841710301244276026398105347911_cAAAAB3xYz9wQkLmNo" } ``` ### 400 `errors/invalid_parameters`: a field Lempile won't take; `detail` names it. Nothing was opened. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 401 A missing or invalid API key answers `{ "error": "unauthorized", "message" }`. `errors/disconnected_account` (problem JSON): Instagram signed the account out; connect it again. ```json { "error": "unauthorized", "message": "…" } ``` ### 402 `subscription_required` (in `error`): the workspace has no active trial or subscription. ```json { "error": "subscription_required", "message": "…" } ``` ### 403 `errors/insufficient_permissions` (the key lacks the scope), `errors/account_restricted` (Instagram blocked the action, restricted the account or asks for a check: someone has to look at it on Instagram) or `errors/action_required` (the account waits for something done on Instagram itself; `account_status` and `reason` say what). ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 404 `errors/resource_not_found`: no such account in this workspace, or no such chat, message, person or post. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 409 `errors/in_progress`: the same key is still running, or its outcome isn't known yet. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 415 `errors/unsupported_media_type`: a file Instagram doesn't take. Nothing was sent. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 422 `errors/idempotency_key_reused`, `errors/invalid_recipient` (no Instagram account by that name or id), `errors/user_unreachable` (Instagram won't let the account message this person) or `errors/cant_send_message` (a message request is waiting for their answer: until they accept, one text message only). Nothing was sent. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 429 `errors/too_many_requests`: the account's pace (`code`: `too_fast`, `daily_limit` or `hourly_limit`; wait until `retry_at`), or Instagram's own "Try again later" (`retry_after: 86400`: wait a day before writing from the account again). Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 501 `errors/feature_not_implemented`: a field or option Lempile doesn't do for Instagram (`detail` says which), or an account of another network. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 502 `errors/service_unavailable`: the browser's answer was lost after the write started. Not sure: read the receipt before sending again. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 503 `errors/service_unavailable`: the account isn't ready yet, or its browser can't be reached right now. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 504 `errors/request_timeout`: Instagram didn't confirm within 140 seconds. Not sure: read the receipt before sending again. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` --- # Instagram API: List a chat's attendees > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `GET https://api.lempile.com/api/v1/chats/{chat_id}/attendees` The people in the chat. Opens the conversation only when the inbox can't answer (`marks_seen: true` when it opened messages the account hadn't seen). Scope: `accounts.read`. ## Authentication Send your Instagram API API key in the `X-API-KEY` header. ## Path parameters - `chat_id` (string, required): The chat's id (the number in `instagram.com/direct/t//`), or that link. Example: `340282366841710301244276026398105347911`. ## Query parameters - `account_id` (string, required): The connected Instagram account: its Lempile id (a UUID), its Instagram user id or its username. Example: `00000000-0000-4000-8000-0000000000c1`. ## Example request ```bash curl -sS "https://api.lempile.com/api/v1/chats/340282366841710301244276026398105347911/attendees?account_id=00000000-0000-4000-8000-0000000000c1" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ## Responses ### 200 The attendees. ```json { "object": "ChatAttendeeList", "items": [ { "object": "ChatAttendee", "id": "string", "account_id": "string", "provider_id": "string", "name": "string", "is_self": 0, "picture_url": "string", "profile_url": "string", "specifics": { "provider": "INSTAGRAM", "public_identifier": "string", "relationship_status": { "following": false, "followed_by": false, "has_sent_invitation": false, "has_received_invitation": false } } } ], "cursor": "string" } ``` ### 400 `errors/invalid_parameters`: a field Lempile won't take; `detail` names it. Nothing was opened. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 401 A missing or invalid API key answers `{ "error": "unauthorized", "message" }`. `errors/disconnected_account` (problem JSON): Instagram signed the account out; connect it again. ```json { "error": "unauthorized", "message": "…" } ``` ### 402 `subscription_required` (in `error`): the workspace has no active trial or subscription. ```json { "error": "subscription_required", "message": "…" } ``` ### 403 `errors/insufficient_permissions` (the key lacks the scope), `errors/account_restricted` (Instagram blocked the action, restricted the account or asks for a check: someone has to look at it on Instagram) or `errors/action_required` (the account waits for something done on Instagram itself; `account_status` and `reason` say what). ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 404 `errors/resource_not_found`: no such account in this workspace, or no such chat, message, person or post. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 429 `errors/too_many_requests`: the account's pace (`code`: `too_fast`, `daily_limit` or `hourly_limit`; wait until `retry_at`), or Instagram's own "Try again later" (`retry_after: 86400`: wait a day before writing from the account again). Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 501 `errors/feature_not_implemented`: a field or option Lempile doesn't do for Instagram (`detail` says which), or an account of another network. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 503 `errors/service_unavailable`: the account isn't ready yet, or its browser can't be reached right now. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 504 `errors/request_timeout`: Instagram didn't answer within 100 seconds. A read changed nothing: try again. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` --- # Instagram API: Read a chat again > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `GET https://api.lempile.com/api/v1/chats/{chat_id}/sync` Reads the chat from Instagram now and answers when done (`SYNC_DONE`); a chat Instagram no longer has answers `CHAT_DELETED`, as on Unipile. Opens the conversation only when the inbox can't answer (`marks_seen: true` when it opened messages the account hadn't seen). Scope: `accounts.read`. ## Authentication Send your Instagram API API key in the `X-API-KEY` header. ## Path parameters - `chat_id` (string, required): The chat's id (the number in `instagram.com/direct/t//`), or that link. Example: `340282366841710301244276026398105347911`. ## Query parameters - `account_id` (string, required): The connected Instagram account: its Lempile id (a UUID), its Instagram user id or its username. Example: `00000000-0000-4000-8000-0000000000c1`. ## Example request ```bash curl -sS "https://api.lempile.com/api/v1/chats/340282366841710301244276026398105347911/sync?account_id=00000000-0000-4000-8000-0000000000c1" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ## Responses ### 200 Read. ```json { "object": "ChatHistorySync", "chat_id": "340282366841710301244276026398105347911", "status": "SYNC_DONE" } ``` ### 400 `errors/invalid_parameters`: a field Lempile won't take; `detail` names it. Nothing was opened. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 401 A missing or invalid API key answers `{ "error": "unauthorized", "message" }`. `errors/disconnected_account` (problem JSON): Instagram signed the account out; connect it again. ```json { "error": "unauthorized", "message": "…" } ``` ### 402 `subscription_required` (in `error`): the workspace has no active trial or subscription. ```json { "error": "subscription_required", "message": "…" } ``` ### 403 `errors/insufficient_permissions` (the key lacks the scope), `errors/account_restricted` (Instagram blocked the action, restricted the account or asks for a check: someone has to look at it on Instagram) or `errors/action_required` (the account waits for something done on Instagram itself; `account_status` and `reason` say what). ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 404 `errors/resource_not_found`: no such account in this workspace, or no such chat, message, person or post. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 429 `errors/too_many_requests`: the account's pace (`code`: `too_fast`, `daily_limit` or `hourly_limit`; wait until `retry_at`), or Instagram's own "Try again later" (`retry_after: 86400`: wait a day before writing from the account again). Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 501 `errors/feature_not_implemented`: a field or option Lempile doesn't do for Instagram (`detail` says which), or an account of another network. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 503 `errors/service_unavailable`: the account isn't ready yet, or its browser can't be reached right now. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 504 `errors/request_timeout`: Instagram didn't answer within 100 seconds. A read changed nothing: try again. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` --- # Instagram API: List messages > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `GET https://api.lempile.com/api/v1/messages` The messages of the newest chats, newest first. Opens the conversation only when the inbox can't answer (`marks_seen: true` when it opened messages the account hadn't seen). Scope: `accounts.read`. ## Authentication Send your Instagram API API key in the `X-API-KEY` header. ## Query parameters - `account_id` (string, required): The connected Instagram account: its Lempile id (a UUID), its Instagram user id or its username. Example: `00000000-0000-4000-8000-0000000000c1`. - `limit` (integer): 1 to 250 (default 20). Default: `20`. ## Example request ```bash curl -sS "https://api.lempile.com/api/v1/messages?account_id=00000000-0000-4000-8000-0000000000c1" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ## Responses ### 200 The messages. ```json { "object": "MessageList", "items": [ { "object": "Message", "id": "string", "message_id": "string", "provider_id": "string", "account_id": "string", "chat_id": "string", "chat_provider_id": "string", "sender_id": "string", "sender_attendee_id": "string", "text": "string", "attachments": [ { "id": "string", "type": "img", "url": "string", "voice_note": false, "post": {}, "story": {} } ], "timestamp": "2026-10-29T09:00:00Z", "is_sender": 0, "reactions": [ { "value": "string", "sender_id": "string", "is_sender": false } ], "seen": 0, "seen_by": {}, "hidden": 0, "deleted": 0, "edited": 0, "is_event": 0, "delivered": 0, "behavior": null, "original": "string", "message_type": "STORY_MENTION", "marks_seen": false } ], "cursor": "string" } ``` ### 400 `errors/invalid_parameters`: a field Lempile won't take; `detail` names it. Nothing was opened. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 401 A missing or invalid API key answers `{ "error": "unauthorized", "message" }`. `errors/disconnected_account` (problem JSON): Instagram signed the account out; connect it again. ```json { "error": "unauthorized", "message": "…" } ``` ### 402 `subscription_required` (in `error`): the workspace has no active trial or subscription. ```json { "error": "subscription_required", "message": "…" } ``` ### 403 `errors/insufficient_permissions` (the key lacks the scope), `errors/account_restricted` (Instagram blocked the action, restricted the account or asks for a check: someone has to look at it on Instagram) or `errors/action_required` (the account waits for something done on Instagram itself; `account_status` and `reason` say what). ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 404 `errors/resource_not_found`: no such account in this workspace, or no such chat, message, person or post. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 429 `errors/too_many_requests`: the account's pace (`code`: `too_fast`, `daily_limit` or `hourly_limit`; wait until `retry_at`), or Instagram's own "Try again later" (`retry_after: 86400`: wait a day before writing from the account again). Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 501 `errors/feature_not_implemented`: a field or option Lempile doesn't do for Instagram (`detail` says which), or an account of another network. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 503 `errors/service_unavailable`: the account isn't ready yet, or its browser can't be reached right now. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 504 `errors/request_timeout`: Instagram didn't answer within 100 seconds. A read changed nothing: try again. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` --- # Instagram API: Retrieve a message > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `GET https://api.lempile.com/api/v1/messages/{message_id}` One `Message`, looked for among its chat's newest 300 messages; an older one answers `404`. Opens the conversation only when the inbox can't answer (`marks_seen: true` when it opened messages the account hadn't seen). Scope: `accounts.read`. ## Authentication Send your Instagram API API key in the `X-API-KEY` header. ## Path parameters - `message_id` (string, required): `_`, as the API answers it. Example: `340282366841710301244276026398105347911_cAAAAB3xYz9wQkLmNo`. ## Query parameters - `account_id` (string, required): The connected Instagram account: its Lempile id (a UUID), its Instagram user id or its username. Example: `00000000-0000-4000-8000-0000000000c1`. ## Example request ```bash curl -sS "https://api.lempile.com/api/v1/messages/340282366841710301244276026398105347911_cAAAAB3xYz9wQkLmNo?account_id=00000000-0000-4000-8000-0000000000c1" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ## Responses ### 200 The message. ```json { "object": "Message", "id": "string", "message_id": "string", "provider_id": "string", "account_id": "string", "chat_id": "string", "chat_provider_id": "string", "sender_id": "string", "sender_attendee_id": "string", "text": "string", "attachments": [ { "id": "string", "type": "img", "url": "string", "voice_note": false, "post": {}, "story": {} } ], "timestamp": "2026-10-29T09:00:00Z", "is_sender": 0, "reactions": [ { "value": "string", "sender_id": "string", "is_sender": false } ], "seen": 0, "seen_by": {}, "hidden": 0, "deleted": 0, "edited": 0, "is_event": 0, "delivered": 0, "behavior": null, "original": "string", "message_type": "STORY_MENTION", "marks_seen": false } ``` ### 400 `errors/invalid_parameters`: a field Lempile won't take; `detail` names it. Nothing was opened. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 401 A missing or invalid API key answers `{ "error": "unauthorized", "message" }`. `errors/disconnected_account` (problem JSON): Instagram signed the account out; connect it again. ```json { "error": "unauthorized", "message": "…" } ``` ### 402 `subscription_required` (in `error`): the workspace has no active trial or subscription. ```json { "error": "subscription_required", "message": "…" } ``` ### 403 `errors/insufficient_permissions` (the key lacks the scope), `errors/account_restricted` (Instagram blocked the action, restricted the account or asks for a check: someone has to look at it on Instagram) or `errors/action_required` (the account waits for something done on Instagram itself; `account_status` and `reason` say what). ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 404 `errors/resource_not_found`: no such account in this workspace, or no such chat, message, person or post. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 429 `errors/too_many_requests`: the account's pace (`code`: `too_fast`, `daily_limit` or `hourly_limit`; wait until `retry_at`), or Instagram's own "Try again later" (`retry_after: 86400`: wait a day before writing from the account again). Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 501 `errors/feature_not_implemented`: a field or option Lempile doesn't do for Instagram (`detail` says which), or an account of another network. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 503 `errors/service_unavailable`: the account isn't ready yet, or its browser can't be reached right now. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 504 `errors/request_timeout`: Instagram didn't answer within 100 seconds. A read changed nothing: try again. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` --- # Instagram API: Retrieve an attachment > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `GET https://api.lempile.com/api/v1/messages/{message_id}/attachments/{attachment_id}` The file itself, read in the account's own session, with its own content type. Opens the conversation only when the inbox can't answer (`marks_seen: true` when it opened messages the account hadn't seen). Scope: `accounts.read`. ## Authentication Send your Instagram API API key in the `X-API-KEY` header. ## Path parameters - `message_id` (string, required): `_`, as the API answers it. Example: `340282366841710301244276026398105347911_cAAAAB3xYz9wQkLmNo`. - `attachment_id` (string, required): `_`, from 0. ## Query parameters - `account_id` (string, required): The connected Instagram account: its Lempile id (a UUID), its Instagram user id or its username. Example: `00000000-0000-4000-8000-0000000000c1`. ## Example request ```bash curl -sS "https://api.lempile.com/api/v1/messages/340282366841710301244276026398105347911_cAAAAB3xYz9wQkLmNo/attachments/{attachment_id}?account_id=00000000-0000-4000-8000-0000000000c1" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ## Responses ### 200 The file. ```text string ``` ### 400 `errors/invalid_parameters`: a field Lempile won't take; `detail` names it. Nothing was opened. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 401 A missing or invalid API key answers `{ "error": "unauthorized", "message" }`. `errors/disconnected_account` (problem JSON): Instagram signed the account out; connect it again. ```json { "error": "unauthorized", "message": "…" } ``` ### 402 `subscription_required` (in `error`): the workspace has no active trial or subscription. ```json { "error": "subscription_required", "message": "…" } ``` ### 403 `errors/insufficient_permissions` (the key lacks the scope), `errors/account_restricted` (Instagram blocked the action, restricted the account or asks for a check: someone has to look at it on Instagram) or `errors/action_required` (the account waits for something done on Instagram itself; `account_status` and `reason` say what). ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 404 `errors/resource_not_found`: no such account in this workspace, or no such chat, message, person or post. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 429 `errors/too_many_requests`: the account's pace (`code`: `too_fast`, `daily_limit` or `hourly_limit`; wait until `retry_at`), or Instagram's own "Try again later" (`retry_after: 86400`: wait a day before writing from the account again). Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 501 `errors/feature_not_implemented`: a field or option Lempile doesn't do for Instagram (`detail` says which), or an account of another network. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 503 `errors/service_unavailable`: the account isn't ready yet, or its browser can't be reached right now. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 504 `errors/request_timeout`: Instagram didn't answer within 100 seconds. A read changed nothing: try again. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` --- # Instagram API: React to a message > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `POST https://api.lempile.com/api/v1/messages/{message_id}/reaction` Instagram keeps one reaction per person on a message: a new one replaces the account's last. Opens the conversation. Paced per account: 60 a day. Scope: `accounts.write`. ## Authentication Send your Instagram API API key in the `X-API-KEY` header. ## Path parameters - `message_id` (string, required): `_`, as the API answers it. Example: `340282366841710301244276026398105347911_cAAAAB3xYz9wQkLmNo`. ## Headers - `Idempotency-Key` (string): Optional. Sent without one, Lempile makes one and answers it in the same header, so the write still has a receipt. Example: `answer-jane-1`. ## Request body `application/json` (required) - `account_id` (string, required) - `reaction` (string, required): An emoji. - `dry_run` (boolean): `true`: everything up to the last step, nothing sent: `200` with `not_sent: true`. Not paced, no receipt. When the write is already so (already liked, already following), `checks` holds `{ "check": "already", "already": true }`. ## Example request ```bash curl -sS -X POST "https://api.lempile.com/api/v1/messages/340282366841710301244276026398105347911_cAAAAB3xYz9wQkLmNo/reaction" \ -H "X-API-KEY: $LEMPILE_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "account_id": "00000000-0000-4000-8000-0000000000c1", "reaction": "❤️" }' ``` ## Responses ### 200 Reacted (or a dry run). ```json { "object": "MessageReactionAdded", "success": true } ``` ### 400 `errors/invalid_parameters`: a field Lempile won't take; `detail` names it. Nothing was opened. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 401 A missing or invalid API key answers `{ "error": "unauthorized", "message" }`. `errors/disconnected_account` (problem JSON): Instagram signed the account out; connect it again. ```json { "error": "unauthorized", "message": "…" } ``` ### 402 `subscription_required` (in `error`): the workspace has no active trial or subscription. ```json { "error": "subscription_required", "message": "…" } ``` ### 403 `errors/insufficient_permissions` (the key lacks the scope), `errors/account_restricted` (Instagram blocked the action, restricted the account or asks for a check: someone has to look at it on Instagram) or `errors/action_required` (the account waits for something done on Instagram itself; `account_status` and `reason` say what). ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 404 `errors/resource_not_found`: no such account in this workspace, or no such chat, message, person or post. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 409 `errors/in_progress`: the same key is still running, or its outcome isn't known yet. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 422 `errors/idempotency_key_reused`: the key was used for another request. Nothing was sent. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 429 `errors/too_many_requests`: the account's pace (`code`: `too_fast`, `daily_limit` or `hourly_limit`; wait until `retry_at`), or Instagram's own "Try again later" (`retry_after: 86400`: wait a day before writing from the account again). Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 501 `errors/feature_not_implemented`: a field or option Lempile doesn't do for Instagram (`detail` says which), or an account of another network. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 502 `errors/service_unavailable`: the browser's answer was lost after the write started. Not sure: read the receipt before sending again. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 503 `errors/service_unavailable`: the account isn't ready yet, or its browser can't be reached right now. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 504 `errors/request_timeout`: Instagram didn't confirm within 140 seconds. Not sure: read the receipt before sending again. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` --- # Instagram API: Remove a reaction > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `DELETE https://api.lempile.com/api/v1/messages/{message_id}/reaction` Takes the account's reaction off the message (same body as adding one). Scope: `accounts.write`. ## Authentication Send your Instagram API API key in the `X-API-KEY` header. ## Path parameters - `message_id` (string, required): `_`, as the API answers it. Example: `340282366841710301244276026398105347911_cAAAAB3xYz9wQkLmNo`. ## Headers - `Idempotency-Key` (string): Optional. Sent without one, Lempile makes one and answers it in the same header, so the write still has a receipt. Example: `answer-jane-1`. ## Request body `application/json` (required) - `account_id` (string, required) - `reaction` (string, required): An emoji. - `dry_run` (boolean): `true`: everything up to the last step, nothing sent: `200` with `not_sent: true`. Not paced, no receipt. When the write is already so (already liked, already following), `checks` holds `{ "check": "already", "already": true }`. ## Example request ```bash curl -sS -X DELETE "https://api.lempile.com/api/v1/messages/340282366841710301244276026398105347911_cAAAAB3xYz9wQkLmNo/reaction" \ -H "X-API-KEY: $LEMPILE_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "account_id": "00000000-0000-4000-8000-0000000000c1", "reaction": "❤️" }' ``` ## Responses ### 200 Removed (or a dry run). ```json { "object": "MessageReactionRemoved", "success": false } ``` ### 400 `errors/invalid_parameters`: a field Lempile won't take; `detail` names it. Nothing was opened. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 401 A missing or invalid API key answers `{ "error": "unauthorized", "message" }`. `errors/disconnected_account` (problem JSON): Instagram signed the account out; connect it again. ```json { "error": "unauthorized", "message": "…" } ``` ### 402 `subscription_required` (in `error`): the workspace has no active trial or subscription. ```json { "error": "subscription_required", "message": "…" } ``` ### 403 `errors/insufficient_permissions` (the key lacks the scope), `errors/account_restricted` (Instagram blocked the action, restricted the account or asks for a check: someone has to look at it on Instagram) or `errors/action_required` (the account waits for something done on Instagram itself; `account_status` and `reason` say what). ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 404 `errors/resource_not_found`: no such account in this workspace, or no such chat, message, person or post. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 409 `errors/in_progress`: the same key is still running, or its outcome isn't known yet. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 422 `errors/idempotency_key_reused`: the key was used for another request. Nothing was sent. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 429 `errors/too_many_requests`: the account's pace (`code`: `too_fast`, `daily_limit` or `hourly_limit`; wait until `retry_at`), or Instagram's own "Try again later" (`retry_after: 86400`: wait a day before writing from the account again). Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 501 `errors/feature_not_implemented`: a field or option Lempile doesn't do for Instagram (`detail` says which), or an account of another network. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 502 `errors/service_unavailable`: the browser's answer was lost after the write started. Not sure: read the receipt before sending again. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 503 `errors/service_unavailable`: the account isn't ready yet, or its browser can't be reached right now. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 504 `errors/request_timeout`: Instagram didn't confirm within 140 seconds. Not sure: read the receipt before sending again. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` --- # Instagram API: List attendees > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `GET https://api.lempile.com/api/v1/chat_attendees` Everyone the account has a chat with. Opens the conversation only when the inbox can't answer (`marks_seen: true` when it opened messages the account hadn't seen). Scope: `accounts.read`. ## Authentication Send your Instagram API API key in the `X-API-KEY` header. ## Query parameters - `account_id` (string, required): The connected Instagram account: its Lempile id (a UUID), its Instagram user id or its username. Example: `00000000-0000-4000-8000-0000000000c1`. - `limit` (integer): 1 to 250 (default 20). Default: `20`. - `cursor` (string): The previous page's `cursor`. ## Example request ```bash curl -sS "https://api.lempile.com/api/v1/chat_attendees?account_id=00000000-0000-4000-8000-0000000000c1" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ## Responses ### 200 The attendees. ```json { "object": "ChatAttendeeList", "items": [ { "object": "ChatAttendee", "id": "string", "account_id": "string", "provider_id": "string", "name": "string", "is_self": 0, "picture_url": "string", "profile_url": "string", "specifics": { "provider": "INSTAGRAM", "public_identifier": "string", "relationship_status": { "following": false, "followed_by": false, "has_sent_invitation": false, "has_received_invitation": false } } } ], "cursor": "string" } ``` ### 400 `errors/invalid_parameters`: a field Lempile won't take; `detail` names it. Nothing was opened. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 401 A missing or invalid API key answers `{ "error": "unauthorized", "message" }`. `errors/disconnected_account` (problem JSON): Instagram signed the account out; connect it again. ```json { "error": "unauthorized", "message": "…" } ``` ### 402 `subscription_required` (in `error`): the workspace has no active trial or subscription. ```json { "error": "subscription_required", "message": "…" } ``` ### 403 `errors/insufficient_permissions` (the key lacks the scope), `errors/account_restricted` (Instagram blocked the action, restricted the account or asks for a check: someone has to look at it on Instagram) or `errors/action_required` (the account waits for something done on Instagram itself; `account_status` and `reason` say what). ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 404 `errors/resource_not_found`: no such account in this workspace, or no such chat, message, person or post. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 429 `errors/too_many_requests`: the account's pace (`code`: `too_fast`, `daily_limit` or `hourly_limit`; wait until `retry_at`), or Instagram's own "Try again later" (`retry_after: 86400`: wait a day before writing from the account again). Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 501 `errors/feature_not_implemented`: a field or option Lempile doesn't do for Instagram (`detail` says which), or an account of another network. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 503 `errors/service_unavailable`: the account isn't ready yet, or its browser can't be reached right now. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 504 `errors/request_timeout`: Instagram didn't answer within 100 seconds. A read changed nothing: try again. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` --- # Instagram API: Retrieve an attendee > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `GET https://api.lempile.com/api/v1/chat_attendees/{attendee_id}` One `ChatAttendee`. Opens the conversation only when the inbox can't answer (`marks_seen: true` when it opened messages the account hadn't seen). Scope: `accounts.read`. ## Authentication Send your Instagram API API key in the `X-API-KEY` header. ## Path parameters - `attendee_id` (string, required): The person's `provider_id`. Example: `48210937561`. ## Query parameters - `account_id` (string, required): The connected Instagram account: its Lempile id (a UUID), its Instagram user id or its username. Example: `00000000-0000-4000-8000-0000000000c1`. ## Example request ```bash curl -sS "https://api.lempile.com/api/v1/chat_attendees/48210937561?account_id=00000000-0000-4000-8000-0000000000c1" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ## Responses ### 200 The attendee. ```json { "object": "ChatAttendee", "id": "string", "account_id": "string", "provider_id": "string", "name": "string", "is_self": 0, "picture_url": "string", "profile_url": "string", "specifics": { "provider": "INSTAGRAM", "public_identifier": "string", "relationship_status": { "following": false, "followed_by": false, "has_sent_invitation": false, "has_received_invitation": false } } } ``` ### 400 `errors/invalid_parameters`: a field Lempile won't take; `detail` names it. Nothing was opened. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 401 A missing or invalid API key answers `{ "error": "unauthorized", "message" }`. `errors/disconnected_account` (problem JSON): Instagram signed the account out; connect it again. ```json { "error": "unauthorized", "message": "…" } ``` ### 402 `subscription_required` (in `error`): the workspace has no active trial or subscription. ```json { "error": "subscription_required", "message": "…" } ``` ### 403 `errors/insufficient_permissions` (the key lacks the scope), `errors/account_restricted` (Instagram blocked the action, restricted the account or asks for a check: someone has to look at it on Instagram) or `errors/action_required` (the account waits for something done on Instagram itself; `account_status` and `reason` say what). ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 404 `errors/resource_not_found`: no such account in this workspace, or no such chat, message, person or post. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 429 `errors/too_many_requests`: the account's pace (`code`: `too_fast`, `daily_limit` or `hourly_limit`; wait until `retry_at`), or Instagram's own "Try again later" (`retry_after: 86400`: wait a day before writing from the account again). Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 501 `errors/feature_not_implemented`: a field or option Lempile doesn't do for Instagram (`detail` says which), or an account of another network. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 503 `errors/service_unavailable`: the account isn't ready yet, or its browser can't be reached right now. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 504 `errors/request_timeout`: Instagram didn't answer within 100 seconds. A read changed nothing: try again. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` --- # Instagram API: Retrieve an attendee's picture > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `GET https://api.lempile.com/api/v1/chat_attendees/{attendee_id}/picture` Their profile picture, as an image. Opens the conversation only when the inbox can't answer (`marks_seen: true` when it opened messages the account hadn't seen). Scope: `accounts.read`. ## Authentication Send your Instagram API API key in the `X-API-KEY` header. ## Path parameters - `attendee_id` (string, required): The person's `provider_id`. Example: `48210937561`. ## Query parameters - `account_id` (string, required): The connected Instagram account: its Lempile id (a UUID), its Instagram user id or its username. Example: `00000000-0000-4000-8000-0000000000c1`. ## Example request ```bash curl -sS "https://api.lempile.com/api/v1/chat_attendees/48210937561/picture?account_id=00000000-0000-4000-8000-0000000000c1" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ## Responses ### 200 The picture. ```text string ``` ### 400 `errors/invalid_parameters`: a field Lempile won't take; `detail` names it. Nothing was opened. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 401 A missing or invalid API key answers `{ "error": "unauthorized", "message" }`. `errors/disconnected_account` (problem JSON): Instagram signed the account out; connect it again. ```json { "error": "unauthorized", "message": "…" } ``` ### 402 `subscription_required` (in `error`): the workspace has no active trial or subscription. ```json { "error": "subscription_required", "message": "…" } ``` ### 403 `errors/insufficient_permissions` (the key lacks the scope), `errors/account_restricted` (Instagram blocked the action, restricted the account or asks for a check: someone has to look at it on Instagram) or `errors/action_required` (the account waits for something done on Instagram itself; `account_status` and `reason` say what). ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 404 `errors/resource_not_found`: no such account in this workspace, or no such chat, message, person or post. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 429 `errors/too_many_requests`: the account's pace (`code`: `too_fast`, `daily_limit` or `hourly_limit`; wait until `retry_at`), or Instagram's own "Try again later" (`retry_after: 86400`: wait a day before writing from the account again). Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 501 `errors/feature_not_implemented`: a field or option Lempile doesn't do for Instagram (`detail` says which), or an account of another network. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 503 `errors/service_unavailable`: the account isn't ready yet, or its browser can't be reached right now. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 504 `errors/request_timeout`: Instagram didn't answer within 100 seconds. A read changed nothing: try again. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` --- # Instagram API: List an attendee's chats > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `GET https://api.lempile.com/api/v1/chat_attendees/{attendee_id}/chats` A `ChatList`: the account's one-to-one chat with them. Opens the conversation only when the inbox can't answer (`marks_seen: true` when it opened messages the account hadn't seen). Scope: `accounts.read`. ## Authentication Send your Instagram API API key in the `X-API-KEY` header. ## Path parameters - `attendee_id` (string, required): The person's `provider_id`. Example: `48210937561`. ## Query parameters - `account_id` (string, required): The connected Instagram account: its Lempile id (a UUID), its Instagram user id or its username. Example: `00000000-0000-4000-8000-0000000000c1`. ## Example request ```bash curl -sS "https://api.lempile.com/api/v1/chat_attendees/48210937561/chats?account_id=00000000-0000-4000-8000-0000000000c1" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ## Responses ### 200 The chat. ```json { "object": "ChatList", "items": [ { "object": "Chat", "id": "string", "account_id": "string", "account_type": "INSTAGRAM", "provider_id": "string", "attendee_provider_id": "string", "name": "string", "type": 0, "timestamp": "2026-10-29T09:00:00Z", "unread_count": 0, "archived": 0, "muted_until": "string", "read_only": 0, "folder": [ "INBOX_INSTAGRAM_GENERAL" ], "pinned": 0, "lastMessage": { "object": "Message", "id": "string", "message_id": "string", "provider_id": "string", "account_id": "string", "chat_id": "string", "chat_provider_id": "string", "sender_id": "string", "sender_attendee_id": "string", "text": "string", "attachments": [ {} ], "timestamp": "2026-10-29T09:00:00Z", "is_sender": 0, "reactions": [ {} ], "seen": 0, "seen_by": {}, "hidden": 0, "deleted": 0, "edited": 0, "is_event": 0, "delivered": 0, "behavior": null, "original": "string", "message_type": "STORY_MENTION", "marks_seen": false }, "marks_seen": false } ], "cursor": "string" } ``` ### 400 `errors/invalid_parameters`: a field Lempile won't take; `detail` names it. Nothing was opened. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 401 A missing or invalid API key answers `{ "error": "unauthorized", "message" }`. `errors/disconnected_account` (problem JSON): Instagram signed the account out; connect it again. ```json { "error": "unauthorized", "message": "…" } ``` ### 402 `subscription_required` (in `error`): the workspace has no active trial or subscription. ```json { "error": "subscription_required", "message": "…" } ``` ### 403 `errors/insufficient_permissions` (the key lacks the scope), `errors/account_restricted` (Instagram blocked the action, restricted the account or asks for a check: someone has to look at it on Instagram) or `errors/action_required` (the account waits for something done on Instagram itself; `account_status` and `reason` say what). ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 404 `errors/resource_not_found`: no such account in this workspace, or no such chat, message, person or post. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 429 `errors/too_many_requests`: the account's pace (`code`: `too_fast`, `daily_limit` or `hourly_limit`; wait until `retry_at`), or Instagram's own "Try again later" (`retry_after: 86400`: wait a day before writing from the account again). Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 501 `errors/feature_not_implemented`: a field or option Lempile doesn't do for Instagram (`detail` says which), or an account of another network. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 503 `errors/service_unavailable`: the account isn't ready yet, or its browser can't be reached right now. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 504 `errors/request_timeout`: Instagram didn't answer within 100 seconds. A read changed nothing: try again. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` --- # Instagram API: List an attendee's messages > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `GET https://api.lempile.com/api/v1/chat_attendees/{attendee_id}/messages` A `MessageList`: the messages of the account's chat with them. Opens the conversation only when the inbox can't answer (`marks_seen: true` when it opened messages the account hadn't seen). Scope: `accounts.read`. ## Authentication Send your Instagram API API key in the `X-API-KEY` header. ## Path parameters - `attendee_id` (string, required): The person's `provider_id`. Example: `48210937561`. ## Query parameters - `account_id` (string, required): The connected Instagram account: its Lempile id (a UUID), its Instagram user id or its username. Example: `00000000-0000-4000-8000-0000000000c1`. - `limit` (integer): 1 to 250 (default 20). Default: `20`. - `cursor` (string): The previous page's `cursor`. ## Example request ```bash curl -sS "https://api.lempile.com/api/v1/chat_attendees/48210937561/messages?account_id=00000000-0000-4000-8000-0000000000c1" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ## Responses ### 200 The messages. ```json { "object": "MessageList", "items": [ { "object": "Message", "id": "string", "message_id": "string", "provider_id": "string", "account_id": "string", "chat_id": "string", "chat_provider_id": "string", "sender_id": "string", "sender_attendee_id": "string", "text": "string", "attachments": [ { "id": "string", "type": "img", "url": "string", "voice_note": false, "post": {}, "story": {} } ], "timestamp": "2026-10-29T09:00:00Z", "is_sender": 0, "reactions": [ { "value": "string", "sender_id": "string", "is_sender": false } ], "seen": 0, "seen_by": {}, "hidden": 0, "deleted": 0, "edited": 0, "is_event": 0, "delivered": 0, "behavior": null, "original": "string", "message_type": "STORY_MENTION", "marks_seen": false } ], "cursor": "string" } ``` ### 400 `errors/invalid_parameters`: a field Lempile won't take; `detail` names it. Nothing was opened. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 401 A missing or invalid API key answers `{ "error": "unauthorized", "message" }`. `errors/disconnected_account` (problem JSON): Instagram signed the account out; connect it again. ```json { "error": "unauthorized", "message": "…" } ``` ### 402 `subscription_required` (in `error`): the workspace has no active trial or subscription. ```json { "error": "subscription_required", "message": "…" } ``` ### 403 `errors/insufficient_permissions` (the key lacks the scope), `errors/account_restricted` (Instagram blocked the action, restricted the account or asks for a check: someone has to look at it on Instagram) or `errors/action_required` (the account waits for something done on Instagram itself; `account_status` and `reason` say what). ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 404 `errors/resource_not_found`: no such account in this workspace, or no such chat, message, person or post. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 429 `errors/too_many_requests`: the account's pace (`code`: `too_fast`, `daily_limit` or `hourly_limit`; wait until `retry_at`), or Instagram's own "Try again later" (`retry_after: 86400`: wait a day before writing from the account again). Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 501 `errors/feature_not_implemented`: a field or option Lempile doesn't do for Instagram (`detail` says which), or an account of another network. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 503 `errors/service_unavailable`: the account isn't ready yet, or its browser can't be reached right now. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 504 `errors/request_timeout`: Instagram didn't answer within 100 seconds. A read changed nothing: try again. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` --- # Instagram API: Retrieve the account's own profile > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `GET https://api.lempile.com/api/v1/users/me` The account's own Instagram profile: the `UserProfile` fields, with `object: "AccountOwnerProfile"`. Scope: `accounts.read`. ## Authentication Send your Instagram API API key in the `X-API-KEY` header. ## Query parameters - `account_id` (string, required): The connected Instagram account: its Lempile id (a UUID), its Instagram user id or its username. Example: `00000000-0000-4000-8000-0000000000c1`. ## Example request ```bash curl -sS "https://api.lempile.com/api/v1/users/me?account_id=00000000-0000-4000-8000-0000000000c1" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ## Responses ### 200 The profile. ```json { "object": "AccountOwnerProfile", "provider": "INSTAGRAM", "provider_id": "string", "provider_messaging_id": "string", "public_identifier": "string", "full_name": "string", "profile_picture_url": "string", "profile_picture_url_large": "string", "biography": "string", "category": "string", "followers_count": 0, "mutual_followers_count": 0, "following_count": 0, "posts_count": 0, "profile_type": "PERSONNAL", "is_verified": false, "is_private": false, "external_links": [ "string" ], "business": {}, "relationship_status": { "following": false, "followed_by": false, "has_sent_invitation": false, "has_received_invitation": false } } ``` ### 400 `errors/invalid_parameters`: a field Lempile won't take; `detail` names it. Nothing was opened. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 401 A missing or invalid API key answers `{ "error": "unauthorized", "message" }`. `errors/disconnected_account` (problem JSON): Instagram signed the account out; connect it again. ```json { "error": "unauthorized", "message": "…" } ``` ### 402 `subscription_required` (in `error`): the workspace has no active trial or subscription. ```json { "error": "subscription_required", "message": "…" } ``` ### 403 `errors/insufficient_permissions` (the key lacks the scope), `errors/account_restricted` (Instagram blocked the action, restricted the account or asks for a check: someone has to look at it on Instagram) or `errors/action_required` (the account waits for something done on Instagram itself; `account_status` and `reason` say what). ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 404 `errors/resource_not_found`: no such account in this workspace, or no such chat, message, person or post. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 429 `errors/too_many_requests`: the account's pace (`code`: `too_fast`, `daily_limit` or `hourly_limit`; wait until `retry_at`), or Instagram's own "Try again later" (`retry_after: 86400`: wait a day before writing from the account again). Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 501 `errors/feature_not_implemented`: a field or option Lempile doesn't do for Instagram (`detail` says which), or an account of another network. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 503 `errors/service_unavailable`: the account isn't ready yet, or its browser can't be reached right now. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 504 `errors/request_timeout`: Instagram didn't answer within 100 seconds. A read changed nothing: try again. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` --- # Instagram API: Edit the profile > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `PATCH https://api.lempile.com/api/v1/users/me/edit` Changes the account's bio, its picture or both, through Instagram's own Edit profile page. Only those two change here, as on Unipile: LinkedIn's fields (`headline`, `location`, `experience`…) answer `400`. `POST` works too. Scope: `accounts.write`. ## Authentication Send your Instagram API API key in the `X-API-KEY` header. ## Headers - `Idempotency-Key` (string): Optional. Sent without one, Lempile makes one and answers it in the same header, so the write still has a receipt. Example: `answer-jane-1`. ## Request body `multipart/form-data` (required) - `type` (any, required) - `account_id` (string, required) - `summary` (string): The bio, 150 characters at most. - `picture` (string (binary)): A JPEG or PNG, 8 MB at most. One that isn't square is cropped to a centred square, as Instagram's own uploader does. - `dry_run` (boolean): `true`: everything up to the last step, nothing sent: `200` with `not_sent: true`. Not paced, no receipt. When the write is already so (already liked, already following), `checks` holds `{ "check": "already", "already": true }`. ## Example request ```bash curl -sS -X PATCH "https://api.lempile.com/api/v1/users/me/edit" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ## Responses ### 200 Saved (or a dry run). ```json { "object": "ProfileEdited" } ``` ### 400 `errors/invalid_parameters`: a field Lempile won't take; `detail` names it. Nothing was opened. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 401 A missing or invalid API key answers `{ "error": "unauthorized", "message" }`. `errors/disconnected_account` (problem JSON): Instagram signed the account out; connect it again. ```json { "error": "unauthorized", "message": "…" } ``` ### 402 `subscription_required` (in `error`): the workspace has no active trial or subscription. ```json { "error": "subscription_required", "message": "…" } ``` ### 403 `errors/insufficient_permissions` (the key lacks the scope), `errors/account_restricted` (Instagram blocked the action, restricted the account or asks for a check: someone has to look at it on Instagram) or `errors/action_required` (the account waits for something done on Instagram itself; `account_status` and `reason` say what). ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 404 `errors/resource_not_found`: no such account in this workspace, or no such chat, message, person or post. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 409 `errors/in_progress`: the same key is still running, or its outcome isn't known yet. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 415 `errors/unsupported_media_type`: the picture isn't a JPEG or PNG. Nothing was changed. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 422 `errors/idempotency_key_reused`: the key was used for another request. Nothing was sent. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 429 `errors/too_many_requests`: the account's pace (`code`: `too_fast`, `daily_limit` or `hourly_limit`; wait until `retry_at`), or Instagram's own "Try again later" (`retry_after: 86400`: wait a day before writing from the account again). Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 501 `errors/feature_not_implemented`: a field or option Lempile doesn't do for Instagram (`detail` says which), or an account of another network. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 502 `errors/service_unavailable`: the browser's answer was lost after the write started. Not sure: read the receipt before sending again. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 503 `errors/service_unavailable`: the account isn't ready yet, or its browser can't be reached right now. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 504 `errors/request_timeout`: Instagram didn't confirm within 140 seconds. Not sure: read the receipt before sending again. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` --- # Instagram API: List followers > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `GET https://api.lempile.com/api/v1/users/followers` Someone's followers (without `user_id`, the account's own). 25 a page at most, as on Unipile: a `limit` from 26 to 250 gets 25, more answers `400`. Instagram can give fewer, and for a verified account a small fixed sample with no next page. A private account's followers can only be read when the account follows it. Scope: `accounts.read`. ## Authentication Send your Instagram API API key in the `X-API-KEY` header. ## Query parameters - `account_id` (string, required): The connected Instagram account: its Lempile id (a UUID), its Instagram user id or its username. Example: `00000000-0000-4000-8000-0000000000c1`. - `user_id` (string): The person: `provider_id`, username, `@username` or profile link. Without it, the account itself. Example: `sam.example`. - `limit` (integer): 1 to 250 (default 25). 26 to 250 gets 25. Default: `25`. - `cursor` (string): The previous page's `cursor`. ## Example request ```bash curl -sS "https://api.lempile.com/api/v1/users/followers?account_id=00000000-0000-4000-8000-0000000000c1" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ## Responses ### 200 Followers. ```json { "object": "UserFollowersList", "items": [ { "object": "UserFollower", "id": "string", "messaging_id": "string", "username": "string", "name": "string", "profile_picture_url": "string", "is_private": false, "is_verified": false } ], "cursor": "string" } ``` ### 400 `errors/invalid_parameters`: a field Lempile won't take; `detail` names it. Nothing was opened. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 401 A missing or invalid API key answers `{ "error": "unauthorized", "message" }`. `errors/disconnected_account` (problem JSON): Instagram signed the account out; connect it again. ```json { "error": "unauthorized", "message": "…" } ``` ### 402 `subscription_required` (in `error`): the workspace has no active trial or subscription. ```json { "error": "subscription_required", "message": "…" } ``` ### 403 `errors/insufficient_permissions` (the key lacks the scope), `errors/account_restricted` (Instagram blocked the action, restricted the account or asks for a check: someone has to look at it on Instagram) or `errors/action_required` (the account waits for something done on Instagram itself; `account_status` and `reason` say what). ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 404 `errors/resource_not_found`: no such account in this workspace, or no such chat, message, person or post. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 429 `errors/too_many_requests`: the account's pace (`code`: `too_fast`, `daily_limit` or `hourly_limit`; wait until `retry_at`), or Instagram's own "Try again later" (`retry_after: 86400`: wait a day before writing from the account again). Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 501 `errors/feature_not_implemented`: a field or option Lempile doesn't do for Instagram (`detail` says which), or an account of another network. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 503 `errors/service_unavailable`: the account isn't ready yet, or its browser can't be reached right now. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 504 `errors/request_timeout`: Instagram didn't answer within 100 seconds. A read changed nothing: try again. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` --- # Instagram API: List following > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `GET https://api.lempile.com/api/v1/users/following` Whom someone follows (without `user_id`, the account itself), with the same items as followers. `limit` is 25 by default and goes up to 1,000, as on Unipile (more answers `400`); one page holds 100 at most, and `cursor` reads on. Scope: `accounts.read`. ## Authentication Send your Instagram API API key in the `X-API-KEY` header. ## Query parameters - `account_id` (string, required): The connected Instagram account: its Lempile id (a UUID), its Instagram user id or its username. Example: `00000000-0000-4000-8000-0000000000c1`. - `user_id` (string): The person: `provider_id`, username, `@username` or profile link. Without it, the account itself. Example: `sam.example`. - `limit` (integer): 1 to 1000 (default 25). 101 to 1,000 gets 100. Default: `25`. - `cursor` (string): The previous page's `cursor`. ## Example request ```bash curl -sS "https://api.lempile.com/api/v1/users/following?account_id=00000000-0000-4000-8000-0000000000c1" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ## Responses ### 200 Following. ```json { "object": "UserFollowersList", "items": [ { "object": "UserFollower", "id": "string", "messaging_id": "string", "username": "string", "name": "string", "profile_picture_url": "string", "is_private": false, "is_verified": false } ], "cursor": "string" } ``` ### 400 `errors/invalid_parameters`: a field Lempile won't take; `detail` names it. Nothing was opened. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 401 A missing or invalid API key answers `{ "error": "unauthorized", "message" }`. `errors/disconnected_account` (problem JSON): Instagram signed the account out; connect it again. ```json { "error": "unauthorized", "message": "…" } ``` ### 402 `subscription_required` (in `error`): the workspace has no active trial or subscription. ```json { "error": "subscription_required", "message": "…" } ``` ### 403 `errors/insufficient_permissions` (the key lacks the scope), `errors/account_restricted` (Instagram blocked the action, restricted the account or asks for a check: someone has to look at it on Instagram) or `errors/action_required` (the account waits for something done on Instagram itself; `account_status` and `reason` say what). ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 404 `errors/resource_not_found`: no such account in this workspace, or no such chat, message, person or post. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 429 `errors/too_many_requests`: the account's pace (`code`: `too_fast`, `daily_limit` or `hourly_limit`; wait until `retry_at`), or Instagram's own "Try again later" (`retry_after: 86400`: wait a day before writing from the account again). Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 501 `errors/feature_not_implemented`: a field or option Lempile doesn't do for Instagram (`detail` says which), or an account of another network. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 503 `errors/service_unavailable`: the account isn't ready yet, or its browser can't be reached right now. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 504 `errors/request_timeout`: Instagram didn't answer within 100 seconds. A read changed nothing: try again. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` --- # Instagram API: Follow someone > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `POST https://api.lempile.com/api/v1/users/invite` Follows one person (Unipile's "invitation"). Following a private account sends a follow request: they decide. `invitation_id` is the person's `provider_id`. Paced per account: follows and unfollows 2 minutes apart, 20 a day. Scope: `accounts.write`. ## Authentication Send your Instagram API API key in the `X-API-KEY` header. ## Headers - `Idempotency-Key` (string, required): 1–200 characters of `A-Z a-z 0-9 . _ : -`, scoped to your workspace. The same key with the same request replays the first answer; see Write receipts. A dry run needs none. Example: `answer-jane-1`. ## Request body `application/json` (required) - `account_id` (string, required) - `provider_id` (string, required): The person's `provider_id` or username. Their `provider_messaging_id` doesn't work here (as on Unipile). - `dry_run` (boolean): `true`: everything up to the last step, nothing sent: `200` with `not_sent: true`. Not paced, no receipt. When the write is already so (already liked, already following), `checks` holds `{ "check": "already", "already": true }`. ## Example request ```bash curl -sS -X POST "https://api.lempile.com/api/v1/users/invite" \ -H "X-API-KEY: $LEMPILE_API_KEY" \ -H "Idempotency-Key: answer-jane-1" \ -H "Content-Type: application/json" \ -d '{ "account_id": "00000000-0000-4000-8000-0000000000c1", "provider_id": "sam.example" }' ``` ## Responses ### 200 Followed, or a follow request sent (or a dry run). ```json { "object": "UserInvitationSent", "invitation_id": "48210937561" } ``` ### 400 `errors/invalid_parameters`: a field Lempile won't take; `detail` names it. Nothing was opened. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 401 A missing or invalid API key answers `{ "error": "unauthorized", "message" }`. `errors/disconnected_account` (problem JSON): Instagram signed the account out; connect it again. ```json { "error": "unauthorized", "message": "…" } ``` ### 402 `subscription_required` (in `error`): the workspace has no active trial or subscription. ```json { "error": "subscription_required", "message": "…" } ``` ### 403 `errors/insufficient_permissions` (the key lacks the scope), `errors/account_restricted` (Instagram blocked the action, restricted the account or asks for a check: someone has to look at it on Instagram) or `errors/action_required` (the account waits for something done on Instagram itself; `account_status` and `reason` say what). ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 404 `errors/resource_not_found`: no such account in this workspace, or no such chat, message, person or post. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 409 `errors/in_progress`: the same key is still running, or its outcome isn't known yet. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 422 `errors/idempotency_key_reused`: the key was used for another request. Nothing was sent. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 429 `errors/too_many_requests`: the account's pace (`code`: `too_fast`, `daily_limit` or `hourly_limit`; wait until `retry_at`), or Instagram's own "Try again later" (`retry_after: 86400`: wait a day before writing from the account again). Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 501 `errors/feature_not_implemented`: a field or option Lempile doesn't do for Instagram (`detail` says which), or an account of another network. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 502 `errors/service_unavailable`: the browser's answer was lost after the write started. Not sure: read the receipt before sending again. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 503 `errors/service_unavailable`: the account isn't ready yet, or its browser can't be reached right now. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 504 `errors/request_timeout`: Instagram didn't confirm within 140 seconds. Not sure: read the receipt before sending again. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` --- # Instagram API: Unfollow someone > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `DELETE https://api.lempile.com/api/v1/users/invite/sent/{invitation_id}` Unfollows, or takes back a follow request not yet accepted. Paced with follows. Scope: `accounts.write`. ## Authentication Send your Instagram API API key in the `X-API-KEY` header. ## Path parameters - `invitation_id` (string, required): The person's `provider_id`. Example: `48210937561`. ## Query parameters - `account_id` (string, required): The connected Instagram account: its Lempile id (a UUID), its Instagram user id or its username. Example: `00000000-0000-4000-8000-0000000000c1`. ## Headers - `Idempotency-Key` (string, required): 1–200 characters of `A-Z a-z 0-9 . _ : -`, scoped to your workspace. The same key with the same request replays the first answer; see Write receipts. A dry run needs none. Example: `answer-jane-1`. ## Example request ```bash curl -sS -X DELETE "https://api.lempile.com/api/v1/users/invite/sent/48210937561?account_id=00000000-0000-4000-8000-0000000000c1" \ -H "X-API-KEY: $LEMPILE_API_KEY" \ -H "Idempotency-Key: answer-jane-1" ``` ## Responses ### 200 Unfollowed (or a dry run). ```json { "object": "InvitationCanceled" } ``` ### 400 `errors/invalid_parameters`: a field Lempile won't take; `detail` names it. Nothing was opened. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 401 A missing or invalid API key answers `{ "error": "unauthorized", "message" }`. `errors/disconnected_account` (problem JSON): Instagram signed the account out; connect it again. ```json { "error": "unauthorized", "message": "…" } ``` ### 402 `subscription_required` (in `error`): the workspace has no active trial or subscription. ```json { "error": "subscription_required", "message": "…" } ``` ### 403 `errors/insufficient_permissions` (the key lacks the scope), `errors/account_restricted` (Instagram blocked the action, restricted the account or asks for a check: someone has to look at it on Instagram) or `errors/action_required` (the account waits for something done on Instagram itself; `account_status` and `reason` say what). ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 404 `errors/resource_not_found`: no such account in this workspace, or no such chat, message, person or post. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 409 `errors/in_progress`: the same key is still running, or its outcome isn't known yet. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 422 `errors/idempotency_key_reused`: the key was used for another request. Nothing was sent. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 429 `errors/too_many_requests`: the account's pace (`code`: `too_fast`, `daily_limit` or `hourly_limit`; wait until `retry_at`), or Instagram's own "Try again later" (`retry_after: 86400`: wait a day before writing from the account again). Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 501 `errors/feature_not_implemented`: a field or option Lempile doesn't do for Instagram (`detail` says which), or an account of another network. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 502 `errors/service_unavailable`: the browser's answer was lost after the write started. Not sure: read the receipt before sending again. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 503 `errors/service_unavailable`: the account isn't ready yet, or its browser can't be reached right now. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 504 `errors/request_timeout`: Instagram didn't confirm within 140 seconds. Not sure: read the receipt before sending again. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` --- # Instagram API: List follow requests > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `GET https://api.lempile.com/api/v1/users/invite/received` The follow requests a private account received. Each request's `id` is the person's `provider_id`. Scope: `accounts.read`. ## Authentication Send your Instagram API API key in the `X-API-KEY` header. ## Query parameters - `account_id` (string, required): The connected Instagram account: its Lempile id (a UUID), its Instagram user id or its username. Example: `00000000-0000-4000-8000-0000000000c1`. - `limit` (integer): 1 to 100 (default 10). Default: `10`. - `cursor` (string): The previous page's `cursor`. ## Example request ```bash curl -sS "https://api.lempile.com/api/v1/users/invite/received?account_id=00000000-0000-4000-8000-0000000000c1" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ## Responses ### 200 Follow requests. ```json { "object": "InvitationList", "items": [ { "id": "string" } ], "cursor": "string" } ``` ### 400 `errors/invalid_parameters`: a field Lempile won't take; `detail` names it. Nothing was opened. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 401 A missing or invalid API key answers `{ "error": "unauthorized", "message" }`. `errors/disconnected_account` (problem JSON): Instagram signed the account out; connect it again. ```json { "error": "unauthorized", "message": "…" } ``` ### 402 `subscription_required` (in `error`): the workspace has no active trial or subscription. ```json { "error": "subscription_required", "message": "…" } ``` ### 403 `errors/insufficient_permissions` (the key lacks the scope), `errors/account_restricted` (Instagram blocked the action, restricted the account or asks for a check: someone has to look at it on Instagram) or `errors/action_required` (the account waits for something done on Instagram itself; `account_status` and `reason` say what). ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 404 `errors/resource_not_found`: no such account in this workspace, or no such chat, message, person or post. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 429 `errors/too_many_requests`: the account's pace (`code`: `too_fast`, `daily_limit` or `hourly_limit`; wait until `retry_at`), or Instagram's own "Try again later" (`retry_after: 86400`: wait a day before writing from the account again). Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 501 `errors/feature_not_implemented`: a field or option Lempile doesn't do for Instagram (`detail` says which), or an account of another network. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 503 `errors/service_unavailable`: the account isn't ready yet, or its browser can't be reached right now. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 504 `errors/request_timeout`: Instagram didn't answer within 100 seconds. A read changed nothing: try again. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` --- # Instagram API: Answer a follow request > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `POST https://api.lempile.com/api/v1/users/invite/received/{invitation_id}` Accepts or declines one follow request. Scope: `accounts.write`. ## Authentication Send your Instagram API API key in the `X-API-KEY` header. ## Path parameters - `invitation_id` (string, required): The person's `provider_id`. Example: `48210937561`. ## Headers - `Idempotency-Key` (string): Optional. Sent without one, Lempile makes one and answers it in the same header, so the write still has a receipt. Example: `answer-jane-1`. ## Request body `application/json` (required) - `provider` (any, required) - `account_id` (string, required) - `action` (string, required): One of: `accept`, `decline`. - `dry_run` (boolean): `true`: everything up to the last step, nothing sent: `200` with `not_sent: true`. Not paced, no receipt. When the write is already so (already liked, already following), `checks` holds `{ "check": "already", "already": true }`. ## Example request ```bash curl -sS -X POST "https://api.lempile.com/api/v1/users/invite/received/48210937561" \ -H "X-API-KEY: $LEMPILE_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "provider": "INSTAGRAM", "account_id": "00000000-0000-4000-8000-0000000000c1", "action": "accept" }' ``` ## Responses ### 200 Answered (or a dry run). ```json { "object": "UserInvitationHandled", "status": "ACCEPTED" } ``` ### 400 `errors/invalid_parameters`: a field Lempile won't take; `detail` names it. Nothing was opened. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 401 A missing or invalid API key answers `{ "error": "unauthorized", "message" }`. `errors/disconnected_account` (problem JSON): Instagram signed the account out; connect it again. ```json { "error": "unauthorized", "message": "…" } ``` ### 402 `subscription_required` (in `error`): the workspace has no active trial or subscription. ```json { "error": "subscription_required", "message": "…" } ``` ### 403 `errors/insufficient_permissions` (the key lacks the scope), `errors/account_restricted` (Instagram blocked the action, restricted the account or asks for a check: someone has to look at it on Instagram) or `errors/action_required` (the account waits for something done on Instagram itself; `account_status` and `reason` say what). ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 404 `errors/resource_not_found`: no such account in this workspace, or no such chat, message, person or post. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 409 `errors/in_progress`: the same key is still running, or its outcome isn't known yet. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 422 `errors/idempotency_key_reused`: the key was used for another request. Nothing was sent. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 429 `errors/too_many_requests`: the account's pace (`code`: `too_fast`, `daily_limit` or `hourly_limit`; wait until `retry_at`), or Instagram's own "Try again later" (`retry_after: 86400`: wait a day before writing from the account again). Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 501 `errors/feature_not_implemented`: a field or option Lempile doesn't do for Instagram (`detail` says which), or an account of another network. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 502 `errors/service_unavailable`: the browser's answer was lost after the write started. Not sure: read the receipt before sending again. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 503 `errors/service_unavailable`: the account isn't ready yet, or its browser can't be reached right now. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 504 `errors/request_timeout`: Instagram didn't confirm within 140 seconds. Not sure: read the receipt before sending again. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` --- # Instagram API: Retrieve a profile > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `GET https://api.lempile.com/api/v1/users/{identifier}` One Instagram profile in Unipile's `UserProfile`. Each read opens the profile in the account's browser. Instagram doesn't tell people who viewed their profile. Scope: `accounts.read`. ## Authentication Send your Instagram API API key in the `X-API-KEY` header. ## Path parameters - `identifier` (string, required): The person's username, `@username`, profile link or `provider_id`. A numeric id works once the account has seen that person (in a chat, a follower list, a profile read); otherwise `400` asks for the username. Example: `sam.example`. ## Query parameters - `account_id` (string, required): The connected Instagram account: its Lempile id (a UUID), its Instagram user id or its username. Example: `00000000-0000-4000-8000-0000000000c1`. ## Example request ```bash curl -sS "https://api.lempile.com/api/v1/users/sam.example?account_id=00000000-0000-4000-8000-0000000000c1" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ## Responses ### 200 The profile. ```json { "object": "UserProfile", "provider": "INSTAGRAM", "provider_id": "string", "provider_messaging_id": "string", "public_identifier": "string", "full_name": "string", "profile_picture_url": "string", "profile_picture_url_large": "string", "biography": "string", "category": "string", "followers_count": 0, "mutual_followers_count": 0, "following_count": 0, "posts_count": 0, "profile_type": "PERSONNAL", "is_verified": false, "is_private": false, "external_links": [ "string" ], "business": {}, "relationship_status": { "following": false, "followed_by": false, "has_sent_invitation": false, "has_received_invitation": false } } ``` ### 400 `errors/invalid_parameters`: a field Lempile won't take; `detail` names it. Nothing was opened. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 401 A missing or invalid API key answers `{ "error": "unauthorized", "message" }`. `errors/disconnected_account` (problem JSON): Instagram signed the account out; connect it again. ```json { "error": "unauthorized", "message": "…" } ``` ### 402 `subscription_required` (in `error`): the workspace has no active trial or subscription. ```json { "error": "subscription_required", "message": "…" } ``` ### 403 `errors/insufficient_permissions` (the key lacks the scope), `errors/account_restricted` (Instagram blocked the action, restricted the account or asks for a check: someone has to look at it on Instagram) or `errors/action_required` (the account waits for something done on Instagram itself; `account_status` and `reason` say what). ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 404 `errors/resource_not_found`: no such account in this workspace, or no such chat, message, person or post. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 429 `errors/too_many_requests`: the account's pace (`code`: `too_fast`, `daily_limit` or `hourly_limit`; wait until `retry_at`), or Instagram's own "Try again later" (`retry_after: 86400`: wait a day before writing from the account again). Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 501 `errors/feature_not_implemented`: a field or option Lempile doesn't do for Instagram (`detail` says which), or an account of another network. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 503 `errors/service_unavailable`: the account isn't ready yet, or its browser can't be reached right now. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 504 `errors/request_timeout`: Instagram didn't answer within 100 seconds. A read changed nothing: try again. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` --- # Instagram API: List a profile's posts > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `GET https://api.lempile.com/api/v1/users/{identifier}/posts` A person's posts and reels, newest first, as the profile shows them. A private account's posts can only be read when the account follows it. Scope: `accounts.read`. ## Authentication Send your Instagram API API key in the `X-API-KEY` header. ## Path parameters - `identifier` (string, required): The person's username, `@username`, profile link or `provider_id`. A numeric id works once the account has seen that person (in a chat, a follower list, a profile read); otherwise `400` asks for the username. Example: `sam.example`. ## Query parameters - `account_id` (string, required): The connected Instagram account: its Lempile id (a UUID), its Instagram user id or its username. Example: `00000000-0000-4000-8000-0000000000c1`. - `limit` (integer): 1 to 100 (default 10). Default: `10`. - `cursor` (string): The previous page's `cursor`. ## Example request ```bash curl -sS "https://api.lempile.com/api/v1/users/sam.example/posts?account_id=00000000-0000-4000-8000-0000000000c1" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ## Responses ### 200 Posts. ```json { "object": "PostList", "items": [ { "object": "Post", "provider": "INSTAGRAM", "provider_id": "string", "has_audio": false, "has_liked": false, "like_count": 0, "comment_count": 0, "like_and_view_counts_disabled": false, "comments_disabled": false, "accessibility_caption": "string", "caption": { "edited": false, "has_translation": false, "created_at": 0, "text": "string" }, "preview_image": { "url": "string", "width": 0, "height": 0 }, "video": { "url": "string", "width": 0, "height": 0 }, "owner": { "id": "string", "username": "string", "profile_pic_url": "string", "is_verified": false, "is_private": false }, "location": { "name": "string", "lat": 0, "lng": 0 } } ], "cursor": "string", "paging": { "page_count": 0 } } ``` ### 400 `errors/invalid_parameters`: a field Lempile won't take; `detail` names it. Nothing was opened. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 401 A missing or invalid API key answers `{ "error": "unauthorized", "message" }`. `errors/disconnected_account` (problem JSON): Instagram signed the account out; connect it again. ```json { "error": "unauthorized", "message": "…" } ``` ### 402 `subscription_required` (in `error`): the workspace has no active trial or subscription. ```json { "error": "subscription_required", "message": "…" } ``` ### 403 `errors/insufficient_permissions` (the key lacks the scope), `errors/account_restricted` (Instagram blocked the action, restricted the account or asks for a check: someone has to look at it on Instagram) or `errors/action_required` (the account waits for something done on Instagram itself; `account_status` and `reason` say what). ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 404 `errors/resource_not_found`: no such account in this workspace, or no such chat, message, person or post. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 429 `errors/too_many_requests`: the account's pace (`code`: `too_fast`, `daily_limit` or `hourly_limit`; wait until `retry_at`), or Instagram's own "Try again later" (`retry_after: 86400`: wait a day before writing from the account again). Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 501 `errors/feature_not_implemented`: a field or option Lempile doesn't do for Instagram (`detail` says which), or an account of another network. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 503 `errors/service_unavailable`: the account isn't ready yet, or its browser can't be reached right now. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 504 `errors/request_timeout`: Instagram didn't answer within 100 seconds. A read changed nothing: try again. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` --- # Instagram API: Create a post > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `POST https://api.lempile.com/api/v1/posts` Publishes a feed post through Instagram's own Create: 1 to 10 pictures or videos and a caption. `201` once Instagram shows the post; `202` with `status: "PROCESSING"` when Instagram is still processing it (a video, often): read the account's posts a little later. A long video can take longer than the 140 seconds a request waits: send `Prefer: respond-async` to get `202` as soon as Lempile starts the post (`post_id: null`, the key in the `Idempotency-Key` header), then read `GET /writes/{key}` until it is `done` or `failed`. A story (`post_type: "story"`) or a `video_thumbnail` answers `501`: Instagram's web can't make them. Paced per account: 3 posts a day. Scope: `accounts.write`. ## Authentication Send your Instagram API API key in the `X-API-KEY` header. ## Headers - `Idempotency-Key` (string, required): 1–200 characters of `A-Z a-z 0-9 . _ : -`, scoped to your workspace. The same key with the same request replays the first answer; see Write receipts. A dry run needs none. Example: `answer-jane-1`. - `Prefer` (string): `respond-async`: answer `202` as soon as Lempile starts the post, without waiting for Instagram; the answer carries `Preference-Applied: respond-async` and a `Location` header pointing at its receipt. Follow `GET /writes/{key}`. Without it, the request waits up to 140 seconds as usual. Example: `respond-async`. ## Request body `multipart/form-data` (required) - `account_id` (string, required) - `text` (string): The caption (Instagram's limit). `@username` mentions someone. - `attachments` (array of string (binary), required): JPEG or PNG pictures (8 MB each), MP4 or MOV videos (50 MB). 10 files and 50 MB at most in all. - `location` (string): A place to tag. The best match is used; no match leaves the post untagged. - `dry_run` (boolean): `true`: everything up to the last step, nothing sent: `200` with `not_sent: true`. Not paced, no receipt. When the write is already so (already liked, already following), `checks` holds `{ "check": "already", "already": true }`. ## Example request ```bash curl -sS -X POST "https://api.lempile.com/api/v1/posts" \ -H "X-API-KEY: $LEMPILE_API_KEY" \ -H "Idempotency-Key: answer-jane-1" ``` ## Responses ### 200 A dry run. ```json { "object": "string", "not_sent": true, "checks": [ {} ] } ``` ### 201 Published. ```json { "object": "PostCreated", "post_id": "3502987465123457001", "status": "PUBLISHED" } ``` ### 202 Instagram is still processing it, or Lempile started it after `Prefer: respond-async` (`post_id: null`): read `GET /writes/{key}`. ```json { "object": "PostCreated", "post_id": null, "provider": "INSTAGRAM", "status": "PROCESSING" } ``` ### 400 `errors/invalid_parameters`: a field Lempile won't take; `detail` names it. Nothing was opened. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 401 A missing or invalid API key answers `{ "error": "unauthorized", "message" }`. `errors/disconnected_account` (problem JSON): Instagram signed the account out; connect it again. ```json { "error": "unauthorized", "message": "…" } ``` ### 402 `subscription_required` (in `error`): the workspace has no active trial or subscription. ```json { "error": "subscription_required", "message": "…" } ``` ### 403 `errors/insufficient_permissions` (the key lacks the scope), `errors/account_restricted` (Instagram blocked the action, restricted the account or asks for a check: someone has to look at it on Instagram) or `errors/action_required` (the account waits for something done on Instagram itself; `account_status` and `reason` say what). ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 404 `errors/resource_not_found`: no such account in this workspace, or no such chat, message, person or post. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 409 `errors/in_progress`: the same key is still running, or its outcome isn't known yet. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 415 `errors/unsupported_media_type`: a file Instagram doesn't take. Nothing was sent. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 422 `errors/idempotency_key_reused`: the key was used for another request. Nothing was sent. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 429 `errors/too_many_requests`: the account's pace (`code`: `too_fast`, `daily_limit` or `hourly_limit`; wait until `retry_at`), or Instagram's own "Try again later" (`retry_after: 86400`: wait a day before writing from the account again). Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 501 `errors/feature_not_implemented`: a field or option Lempile doesn't do for Instagram (`detail` says which), or an account of another network. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 502 `errors/service_unavailable`: the browser's answer was lost after the write started. Not sure: read the receipt before sending again. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 503 `errors/service_unavailable`: the account isn't ready yet, or its browser can't be reached right now. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 504 `errors/request_timeout`: Instagram didn't confirm within 140 seconds. Not sure: read the receipt before sending again. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` --- # Instagram API: Like a post > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `POST https://api.lempile.com/api/v1/posts/reaction` Likes a post, or a comment with `comment_id`. `like` is the only reaction Instagram has. Paced per account: 30 seconds apart, 60 a day. Scope: `accounts.write`. ## Authentication Send your Instagram API API key in the `X-API-KEY` header. ## Headers - `Idempotency-Key` (string): Optional. Sent without one, Lempile makes one and answers it in the same header, so the write still has a receipt. Example: `answer-jane-1`. ## Request body `application/json` (required) - `account_id` (string, required) - `post_id` (string, required): The post's `provider_id`, shortcode or link. - `reaction_type` (string): One of: `like`. Default: `"like"`. - `comment_id` (string): A comment's `provider_id`: that comment is liked. - `dry_run` (boolean): `true`: everything up to the last step, nothing sent: `200` with `not_sent: true`. Not paced, no receipt. When the write is already so (already liked, already following), `checks` holds `{ "check": "already", "already": true }`. ## Example request ```bash curl -sS -X POST "https://api.lempile.com/api/v1/posts/reaction" \ -H "X-API-KEY: $LEMPILE_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "account_id": "00000000-0000-4000-8000-0000000000c1", "post_id": "3502987465123456789", "reaction_type": "like" }' ``` ## Responses ### 200 A dry run. ```json { "object": "string", "not_sent": true, "checks": [ {} ] } ``` ### 201 Liked. ```json { "object": "ReactionAdded" } ``` ### 400 `errors/invalid_parameters`: a field Lempile won't take; `detail` names it. Nothing was opened. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 401 A missing or invalid API key answers `{ "error": "unauthorized", "message" }`. `errors/disconnected_account` (problem JSON): Instagram signed the account out; connect it again. ```json { "error": "unauthorized", "message": "…" } ``` ### 402 `subscription_required` (in `error`): the workspace has no active trial or subscription. ```json { "error": "subscription_required", "message": "…" } ``` ### 403 `errors/insufficient_permissions` (the key lacks the scope), `errors/account_restricted` (Instagram blocked the action, restricted the account or asks for a check: someone has to look at it on Instagram) or `errors/action_required` (the account waits for something done on Instagram itself; `account_status` and `reason` say what). ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 404 `errors/resource_not_found`: no such account in this workspace, or no such chat, message, person or post. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 409 `errors/in_progress`: the same key is still running, or its outcome isn't known yet. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 422 `errors/idempotency_key_reused`: the key was used for another request. Nothing was sent. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 429 `errors/too_many_requests`: the account's pace (`code`: `too_fast`, `daily_limit` or `hourly_limit`; wait until `retry_at`), or Instagram's own "Try again later" (`retry_after: 86400`: wait a day before writing from the account again). Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 501 `errors/feature_not_implemented`: a field or option Lempile doesn't do for Instagram (`detail` says which), or an account of another network. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 502 `errors/service_unavailable`: the browser's answer was lost after the write started. Not sure: read the receipt before sending again. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 503 `errors/service_unavailable`: the account isn't ready yet, or its browser can't be reached right now. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 504 `errors/request_timeout`: Instagram didn't confirm within 140 seconds. Not sure: read the receipt before sending again. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` --- # Instagram API: Retrieve a post > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `GET https://api.lempile.com/api/v1/posts/{post_id}` One `Post`. Scope: `accounts.read`. ## Authentication Send your Instagram API API key in the `X-API-KEY` header. ## Path parameters - `post_id` (string, required): The post's `provider_id` (Instagram's media id), its shortcode or its link (`https://www.instagram.com/p//`, or `/reel//`). Example: `DBx1yZaN0pQ`. ## Query parameters - `account_id` (string, required): The connected Instagram account: its Lempile id (a UUID), its Instagram user id or its username. Example: `00000000-0000-4000-8000-0000000000c1`. ## Example request ```bash curl -sS "https://api.lempile.com/api/v1/posts/DBx1yZaN0pQ?account_id=00000000-0000-4000-8000-0000000000c1" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ## Responses ### 200 The post. ```json { "object": "Post", "provider": "INSTAGRAM", "provider_id": "string", "has_audio": false, "has_liked": false, "like_count": 0, "comment_count": 0, "like_and_view_counts_disabled": false, "comments_disabled": false, "accessibility_caption": "string", "caption": { "edited": false, "has_translation": false, "created_at": 0, "text": "string" }, "preview_image": { "url": "string", "width": 0, "height": 0 }, "video": { "url": "string", "width": 0, "height": 0 }, "owner": { "id": "string", "username": "string", "profile_pic_url": "string", "is_verified": false, "is_private": false }, "location": { "name": "string", "lat": 0, "lng": 0 } } ``` ### 400 `errors/invalid_parameters`: a field Lempile won't take; `detail` names it. Nothing was opened. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 401 A missing or invalid API key answers `{ "error": "unauthorized", "message" }`. `errors/disconnected_account` (problem JSON): Instagram signed the account out; connect it again. ```json { "error": "unauthorized", "message": "…" } ``` ### 402 `subscription_required` (in `error`): the workspace has no active trial or subscription. ```json { "error": "subscription_required", "message": "…" } ``` ### 403 `errors/insufficient_permissions` (the key lacks the scope), `errors/account_restricted` (Instagram blocked the action, restricted the account or asks for a check: someone has to look at it on Instagram) or `errors/action_required` (the account waits for something done on Instagram itself; `account_status` and `reason` say what). ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 404 `errors/resource_not_found`: no such account in this workspace, or no such chat, message, person or post. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 429 `errors/too_many_requests`: the account's pace (`code`: `too_fast`, `daily_limit` or `hourly_limit`; wait until `retry_at`), or Instagram's own "Try again later" (`retry_after: 86400`: wait a day before writing from the account again). Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 501 `errors/feature_not_implemented`: a field or option Lempile doesn't do for Instagram (`detail` says which), or an account of another network. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 503 `errors/service_unavailable`: the account isn't ready yet, or its browser can't be reached right now. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 504 `errors/request_timeout`: Instagram didn't answer within 100 seconds. A read changed nothing: try again. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` --- # Instagram API: List comments > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `GET https://api.lempile.com/api/v1/posts/{post_id}/comments` A post's comments, in the order the post's page loads them; with `comment_id`, that comment's replies. `sort_by=MOST_RELEVANT` answers `501`: Instagram's web picks its own order. Scope: `accounts.read`. ## Authentication Send your Instagram API API key in the `X-API-KEY` header. ## Path parameters - `post_id` (string, required): The post's `provider_id` (Instagram's media id), its shortcode or its link (`https://www.instagram.com/p//`, or `/reel//`). Example: `3502987465123456789`. ## Query parameters - `account_id` (string, required): The connected Instagram account: its Lempile id (a UUID), its Instagram user id or its username. Example: `00000000-0000-4000-8000-0000000000c1`. - `limit` (integer): 1 to 100 (default 20). Default: `20`. - `cursor` (string): The previous page's `cursor`. - `comment_id` (string): A comment's `provider_id`: its replies come back instead. - `sort_by` (string): `MOST_RELEVANT`: `501`. ## Example request ```bash curl -sS "https://api.lempile.com/api/v1/posts/3502987465123456789/comments?account_id=00000000-0000-4000-8000-0000000000c1" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ## Responses ### 200 Comments. ```json { "object": "CommentList", "items": [ { "object": "Comment", "id": "string", "provider_id": "string", "author": { "provider_id": "string", "messaging_id": "string", "public_identifier": "string", "pk": "string", "profile_pic_url": "string", "is_verified": false }, "text": "string", "created_at": 0, "is_covered": false, "child_comment_count": 0, "restricted_status": "string", "has_liked_comment": false, "giphy_media_info": {}, "parent_comment_id": "string", "comment_like_count": 0 } ], "cursor": "string", "total_items": 0, "paging": { "start": 0, "page_count": 0, "total_count": 0 } } ``` ### 400 `errors/invalid_parameters`: a field Lempile won't take; `detail` names it. Nothing was opened. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 401 A missing or invalid API key answers `{ "error": "unauthorized", "message" }`. `errors/disconnected_account` (problem JSON): Instagram signed the account out; connect it again. ```json { "error": "unauthorized", "message": "…" } ``` ### 402 `subscription_required` (in `error`): the workspace has no active trial or subscription. ```json { "error": "subscription_required", "message": "…" } ``` ### 403 `errors/insufficient_permissions` (the key lacks the scope), `errors/account_restricted` (Instagram blocked the action, restricted the account or asks for a check: someone has to look at it on Instagram) or `errors/action_required` (the account waits for something done on Instagram itself; `account_status` and `reason` say what). ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 404 `errors/resource_not_found`: no such account in this workspace, or no such chat, message, person or post. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 429 `errors/too_many_requests`: the account's pace (`code`: `too_fast`, `daily_limit` or `hourly_limit`; wait until `retry_at`), or Instagram's own "Try again later" (`retry_after: 86400`: wait a day before writing from the account again). Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 501 `errors/feature_not_implemented`: a field or option Lempile doesn't do for Instagram (`detail` says which), or an account of another network. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 503 `errors/service_unavailable`: the account isn't ready yet, or its browser can't be reached right now. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 504 `errors/request_timeout`: Instagram didn't answer within 100 seconds. A read changed nothing: try again. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` --- # Instagram API: Comment on a post > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `POST https://api.lempile.com/api/v1/posts/{post_id}/comments` Types the comment in the post's own comment box. `@username` mentions the person; `comment_id` answers that comment instead. A dry run types the comment and clears it: Instagram shows nobody a comment being typed. Paced per account: 2 minutes apart, 20 a day. Scope: `accounts.write`. ## Authentication Send your Instagram API API key in the `X-API-KEY` header. ## Path parameters - `post_id` (string, required): The post's `provider_id` (Instagram's media id), its shortcode or its link (`https://www.instagram.com/p//`, or `/reel//`). Example: `3502987465123456789`. ## Headers - `Idempotency-Key` (string, required): 1–200 characters of `A-Z a-z 0-9 . _ : -`, scoped to your workspace. The same key with the same request replays the first answer; see Write receipts. A dry run needs none. Example: `answer-jane-1`. ## Request body `application/json` (required) - `account_id` (string, required) - `text` (string, required) - `comment_id` (string): A comment's `provider_id`: the comment answers it. - `dry_run` (boolean): `true`: everything up to the last step, nothing sent: `200` with `not_sent: true`. Not paced, no receipt. When the write is already so (already liked, already following), `checks` holds `{ "check": "already", "already": true }`. ## Example request ```bash curl -sS -X POST "https://api.lempile.com/api/v1/posts/3502987465123456789/comments" \ -H "X-API-KEY: $LEMPILE_API_KEY" \ -H "Idempotency-Key: answer-jane-1" \ -H "Content-Type: application/json" \ -d '{ "account_id": "00000000-0000-4000-8000-0000000000c1", "text": "Lovely work, @sam.example" }' ``` ## Responses ### 200 A dry run. ```json { "object": "string", "not_sent": true, "checks": [ {} ] } ``` ### 201 Commented. ```json { "object": "CommentSent", "comment_id": "18034567890123999" } ``` ### 400 `errors/invalid_parameters`: a field Lempile won't take; `detail` names it. Nothing was opened. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 401 A missing or invalid API key answers `{ "error": "unauthorized", "message" }`. `errors/disconnected_account` (problem JSON): Instagram signed the account out; connect it again. ```json { "error": "unauthorized", "message": "…" } ``` ### 402 `subscription_required` (in `error`): the workspace has no active trial or subscription. ```json { "error": "subscription_required", "message": "…" } ``` ### 403 `errors/insufficient_permissions` (the key lacks the scope), `errors/account_restricted` (Instagram blocked the action, restricted the account or asks for a check: someone has to look at it on Instagram) or `errors/action_required` (the account waits for something done on Instagram itself; `account_status` and `reason` say what). ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 404 `errors/resource_not_found`: no such account in this workspace, or no such chat, message, person or post. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 409 `errors/in_progress`: the same key is still running, or its outcome isn't known yet. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 422 `errors/idempotency_key_reused`: the key was used for another request. Nothing was sent. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 429 `errors/too_many_requests`: the account's pace (`code`: `too_fast`, `daily_limit` or `hourly_limit`; wait until `retry_at`), or Instagram's own "Try again later" (`retry_after: 86400`: wait a day before writing from the account again). Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 501 `errors/feature_not_implemented`: a field or option Lempile doesn't do for Instagram (`detail` says which), or an account of another network. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 502 `errors/service_unavailable`: the browser's answer was lost after the write started. Not sure: read the receipt before sending again. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 503 `errors/service_unavailable`: the account isn't ready yet, or its browser can't be reached right now. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 504 `errors/request_timeout`: Instagram didn't confirm within 140 seconds. Not sure: read the receipt before sending again. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` --- # Instagram API: List likes > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `GET https://api.lempile.com/api/v1/posts/{post_id}/reactions` Who liked a post (with `comment_id`, a comment), as the likes list loads. Scope: `accounts.read`. ## Authentication Send your Instagram API API key in the `X-API-KEY` header. ## Path parameters - `post_id` (string, required): The post's `provider_id` (Instagram's media id), its shortcode or its link (`https://www.instagram.com/p//`, or `/reel//`). Example: `3502987465123456789`. ## Query parameters - `account_id` (string, required): The connected Instagram account: its Lempile id (a UUID), its Instagram user id or its username. Example: `00000000-0000-4000-8000-0000000000c1`. - `limit` (integer): 1 to 100 (default 20). Default: `20`. - `cursor` (string): The previous page's `cursor`. - `comment_id` (string): A comment's `provider_id`: who liked it. ## Example request ```bash curl -sS "https://api.lempile.com/api/v1/posts/3502987465123456789/reactions?account_id=00000000-0000-4000-8000-0000000000c1" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ## Responses ### 200 Likes. ```json { "object": "PostReactionList", "items": [ { "object": "PostReaction", "value": "LIKE", "post_id": "string", "comment_id": "string", "author": { "id": "string", "type": "INDIVIDUAL", "name": "string", "headline": "", "network_distance": null, "public_identifier": "string", "profile_url": "string", "profile_picture_url": "string", "is_verified": false, "is_private": false } } ], "paging": { "cursor": "string", "start": 0, "page_count": 0, "total_count": 0 } } ``` ### 400 `errors/invalid_parameters`: a field Lempile won't take; `detail` names it. Nothing was opened. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 401 A missing or invalid API key answers `{ "error": "unauthorized", "message" }`. `errors/disconnected_account` (problem JSON): Instagram signed the account out; connect it again. ```json { "error": "unauthorized", "message": "…" } ``` ### 402 `subscription_required` (in `error`): the workspace has no active trial or subscription. ```json { "error": "subscription_required", "message": "…" } ``` ### 403 `errors/insufficient_permissions` (the key lacks the scope), `errors/account_restricted` (Instagram blocked the action, restricted the account or asks for a check: someone has to look at it on Instagram) or `errors/action_required` (the account waits for something done on Instagram itself; `account_status` and `reason` say what). ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 404 `errors/resource_not_found`: no such account in this workspace, or no such chat, message, person or post. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 429 `errors/too_many_requests`: the account's pace (`code`: `too_fast`, `daily_limit` or `hourly_limit`; wait until `retry_at`), or Instagram's own "Try again later" (`retry_after: 86400`: wait a day before writing from the account again). Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 501 `errors/feature_not_implemented`: a field or option Lempile doesn't do for Instagram (`detail` says which), or an account of another network. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 503 `errors/service_unavailable`: the account isn't ready yet, or its browser can't be reached right now. Nothing was done. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 504 `errors/request_timeout`: Instagram didn't answer within 100 seconds. A read changed nothing: try again. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` --- # Instagram API: List webhooks > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `GET https://api.lempile.com/api/v1/webhooks` The workspace's webhooks, header values masked. A `messaging` one also shows `account_ids` (each `{ id, name, type }`), `format`, `data` and `type: "AUTO"`. Scope: `accounts.read`. ## Authentication Send your Instagram API API key in the `X-API-KEY` header. ## Example request ```bash curl -sS "https://api.lempile.com/api/v1/webhooks" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ## Responses ### 200 Webhooks. ```json { "object": "WebhookList", "items": [ {} ] } ``` ### 401 A missing or invalid API key answers `{ "error": "unauthorized", "message" }`. `errors/disconnected_account` (problem JSON): Instagram signed the account out; connect it again. ```json { "error": "unauthorized", "message": "…" } ``` ### 402 `subscription_required` (in `error`): the workspace has no active trial or subscription. ```json { "error": "subscription_required", "message": "…" } ``` ### 403 `errors/insufficient_permissions` (the key lacks the scope), `errors/account_restricted` (Instagram blocked the action, restricted the account or asks for a check: someone has to look at it on Instagram) or `errors/action_required` (the account waits for something done on Instagram itself; `account_status` and `reason` say what). ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` --- # Instagram API: Register a webhook > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `POST https://api.lempile.com/api/v1/webhooks` Lempile calls `request_url` when something happens on an Instagram account. `messaging`: `message_received`, `message_read`, `message_reaction`, read from each account's inbox about every 10 minutes (not between 23:00 and 07:00 in the account's own time zone). `account_status`: the workspace's accounts, Instagram's included: connected, signed out, stopped by a security check, suspended, reconnected or removed (`AccountStatus.message` as Unipile, plus Lempile's `status`, `previous_status` and `reason`). The answer's `secret` signs every call (`X-Lempile-Signature`); it's shown this once. Scope: `accounts.write`. ## Authentication Send your Instagram API API key in the `X-API-KEY` header. ## Request body `application/json` (required) - `request_url` (string (uri), required): An `https://` address on the public internet (no IP address, `localhost` or internal name). - `source` (string, required): One of: `messaging`, `account_status`. - `events` (array of string): The events to send. A `messaging` webhook without `events` gets `message_received` only, as on Unipile. An `account_status` webhook takes Unipile's names (`creation_success`, `reconnected`, `ok`, `connecting`, `credentials`, `deleted`) or Lempile's (`account.status.disconnected`…); without `events` it gets all of them. - `account_ids` (array of string): `messaging` only: the workspace's Instagram accounts, by their Lempile id. Without it, every Instagram account of the workspace. - `format` (string): `messaging` only. One of: `json`, `form`. Default: `"json"`. - `data` (array of object): `messaging` only: the payload then holds only these keys, each under its new `name`. - `key` (string) - `name` (string) - `enabled` (boolean): `messaging` only. Default: `true`. - `name` (string): Your name for it, sent as `webhook_name`. - `headers` (array of object): Headers added to every call. - `key` (string) - `value` (string) ## Example request ```bash curl -sS -X POST "https://api.lempile.com/api/v1/webhooks" \ -H "X-API-KEY: $LEMPILE_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "request_url": "https://hooks.example.com/instagram", "name": "inbox", "source": "messaging", "events": [ "message_received", "message_reaction" ], "account_ids": [ "00000000-0000-4000-8000-0000000000c1" ] }' ``` ## Responses ### 201 Registered. ```json { "object": "WebhookCreated", "webhook_id": "8c0b6a7e-3f52-4d1e-9a40-2b7c5d9e1f03", "secret": "whsec_…" } ``` ### 400 `errors/invalid_parameters`: a field Lempile won't take; `detail` names it. Nothing was opened. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 401 A missing or invalid API key answers `{ "error": "unauthorized", "message" }`. `errors/disconnected_account` (problem JSON): Instagram signed the account out; connect it again. ```json { "error": "unauthorized", "message": "…" } ``` ### 402 `subscription_required` (in `error`): the workspace has no active trial or subscription. ```json { "error": "subscription_required", "message": "…" } ``` ### 403 `errors/insufficient_permissions` (the key lacks the scope), `errors/account_restricted` (Instagram blocked the action, restricted the account or asks for a check: someone has to look at it on Instagram) or `errors/action_required` (the account waits for something done on Instagram itself; `account_status` and `reason` say what). ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` --- # Instagram API: Delete a webhook > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `DELETE https://api.lempile.com/api/v1/webhooks/{webhook_id}` Removes one webhook. Scope: `accounts.write`. ## Authentication Send your Instagram API API key in the `X-API-KEY` header. ## Path parameters - `webhook_id` (string, required): The webhook's id. ## Example request ```bash curl -sS -X DELETE "https://api.lempile.com/api/v1/webhooks/{webhook_id}" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ## Responses ### 200 Deleted. ```json { "object": "WebhookDeleted" } ``` ### 401 A missing or invalid API key answers `{ "error": "unauthorized", "message" }`. `errors/disconnected_account` (problem JSON): Instagram signed the account out; connect it again. ```json { "error": "unauthorized", "message": "…" } ``` ### 402 `subscription_required` (in `error`): the workspace has no active trial or subscription. ```json { "error": "subscription_required", "message": "…" } ``` ### 403 `errors/insufficient_permissions` (the key lacks the scope), `errors/account_restricted` (Instagram blocked the action, restricted the account or asks for a check: someone has to look at it on Instagram) or `errors/action_required` (the account waits for something done on Instagram itself; `account_status` and `reason` say what). ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 404 `errors/resource_not_found`: no such account in this workspace, or no such chat, message, person or post. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` --- # Instagram API: Retrieve a write receipt > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `GET https://api.lempile.com/api/v1/writes/{key}` What became of one write, by its `Idempotency-Key`. `state` is `done` (sent: `response` is the answer), `failed` (nothing was sent: `response` is the problem), `pending` (still running, or not sure; `response` is `null`) or `none` (no write with that key: a dry run, for example). The browser's answer is kept 48 hours, also after the request stopped waiting. After a not-sure post, Lempile checks the account's own profile itself: the post is there (`done`, with its `post_id`), or two complete reads of the profile, 15 and 30 minutes after the post, find nothing new (`failed`, `422 errors/not_sent`: it can be sent again). While it checks, for 90 minutes at most, the receipt is `pending` with a `detail` and `check_ends_by`. When the check can't tell, it stays `pending`: check on Instagram, then mark it not sent if it isn't there. Scope: `accounts.read`. ## Authentication Send your Instagram API API key in the `X-API-KEY` header. ## Path parameters - `key` (string, required): The write's Idempotency-Key. Example: `answer-jane-1`. ## Example request ```bash curl -sS "https://api.lempile.com/api/v1/writes/answer-jane-1" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ## Responses ### 200 The receipt. ```json { "object": "WriteStatus", "key": "answer-jane-1", "state": "done", "status": 201, "response": { "object": "MessageSent", "message_id": "340282366841710301244276026398105347911_cAAAAB3xYz9wQkLmNo" } } ``` ### 401 A missing or invalid API key answers `{ "error": "unauthorized", "message" }`. `errors/disconnected_account` (problem JSON): Instagram signed the account out; connect it again. ```json { "error": "unauthorized", "message": "…" } ``` ### 402 `subscription_required` (in `error`): the workspace has no active trial or subscription. ```json { "error": "subscription_required", "message": "…" } ``` ### 403 `errors/insufficient_permissions` (the key lacks the scope), `errors/account_restricted` (Instagram blocked the action, restricted the account or asks for a check: someone has to look at it on Instagram) or `errors/action_required` (the account waits for something done on Instagram itself; `account_status` and `reason` say what). ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` --- # Instagram API: Mark a write not sent > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `POST https://api.lempile.com/api/v1/writes/{key}/not-sent` After you checked on Instagram that a pending write isn't there: it becomes `failed`, its key can be sent again, and it stops counting toward the pace. A write Lempile has as sent stays sent (`409`). Scope: `accounts.write`. ## Authentication Send your Instagram API API key in the `X-API-KEY` header. ## Path parameters - `key` (string, required): The write's Idempotency-Key. ## Example request ```bash curl -sS -X POST "https://api.lempile.com/api/v1/writes/{key}/not-sent" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ## Responses ### 200 Marked not sent. ```json { "object": "WriteStatus", "key": "string", "state": "none", "status": 0, "response": {}, "detail": "string", "check_ends_by": "2026-10-29T09:00:00Z" } ``` ### 401 A missing or invalid API key answers `{ "error": "unauthorized", "message" }`. `errors/disconnected_account` (problem JSON): Instagram signed the account out; connect it again. ```json { "error": "unauthorized", "message": "…" } ``` ### 402 `subscription_required` (in `error`): the workspace has no active trial or subscription. ```json { "error": "subscription_required", "message": "…" } ``` ### 403 `errors/insufficient_permissions` (the key lacks the scope), `errors/account_restricted` (Instagram blocked the action, restricted the account or asks for a check: someone has to look at it on Instagram) or `errors/action_required` (the account waits for something done on Instagram itself; `account_status` and `reason` say what). ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 404 No write with this key. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` ### 409 Sent, too recent, still running, or Lempile is still checking the account's profile for the post: the answer has `check_ends_by` and a `Retry-After` header. Also for a post Lempile can't speak for yet (it restarted during the post), up to 2 hours after it: read the receipt again after `Retry-After`. ```json { "type": "errors/too_many_requests", "title": "string", "status": 0, "detail": "string", "code": "string", "retry_after": 0, "retry_at": "2026-10-29T09:00:00Z" } ``` --- # Google Search API: Overview > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact Lempile exposes a SerpApi-compatible Google Search API at `https://api.lempile.com`. Fresh browser-backed searches are queue-first. A new request creates an archived search record, returns `202 Accepted`, and gives you a `search_metadata.json_endpoint` to poll. The runner processes the job when capacity is available. Cached successful searches may return `200 OK` immediately. ```text client -> Lempile API -> queue -> runner lease -> browser -> Google -> parser -> archive ``` ## 60-Second Quickstart Create a search: ```bash curl -sS "https://api.lempile.com/search.json?engine=google&q=site%3Alinkedin.com%2Fposts%2F%20%22AI%20outreach%22&gl=us&hl=en&tbs=qdr%3Am" \ -H "X-API-KEY: your-api-key" ``` Poll the returned `search_metadata.json_endpoint`: ```bash curl -sS "https://api.lempile.com/searches/{search_id}.json" \ -H "X-API-KEY: your-api-key" ``` Stop polling when `search_metadata.status` is `Success` or `Error`. ## Lifecycle | Step | API result | What it means | | --- | --- | --- | | Create | `202`, `status: "Processing"` | The search was accepted and queued. | | Poll | `202`, `status: "Processing"` | The search is still queued or running. | | Success | `200`, `status: "Success"` | Parsed Google results are available. | | Error | `200`, `status: "Error"` | The search finished with a real failure reason. | Queue-specific fields may appear inside `search_metadata`: ```json { "search_metadata": { "id": "search_id", "status": "Processing", "status_detail": "Queued", "queued_at": "2026-06-01T08:00:00Z", "json_endpoint": "https://api.lempile.com/searches/search_id.json" } } ``` `status_detail` can show internal states such as `Queued`, `Running`, `completed`, or a terminal error detail. The public SerpApi-compatible `status` remains `Processing`, `Success`, or `Error`. ## Production Host Use the public host: ```text https://api.lempile.com ``` Do not use staging URLs for production integrations. ## Authentication Pass an API key with `search.write` for create routes and `search.read` for archive routes. Use either: - `X-API-KEY` header - `api_key` query parameter ## Capacity Model Production is conservative by design: one active Google browser job per runner by default. Bursts are queued instead of launching unlimited browser sessions. If a workspace exceeds its queue cap, Lempile returns `429 workspace_search_queue_full`. --- # Google Search API: Create Search > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact Use `GET /search.json` for JSON clients. `GET /search` is also supported for SerpApi compatibility. Fresh non-cached searches are queue-first and normally return `202 Accepted`. For Yahoo results, send `engine=yahoo` with the query as `p`: see [Yahoo Search API](https://lempile.com/docs/yahoo-search). ## Request ```bash curl -sS "https://api.lempile.com/search.json?engine=google&q=Coffee&location=Austin%2C+Texas%2C+United+States&hl=en&gl=us" \ -H "X-API-KEY: your-api-key" ``` ## Normal Fresh Response ```json { "search_metadata": { "id": "search_id", "status": "Processing", "status_detail": "Queued", "json_endpoint": "https://api.lempile.com/searches/search_id.json", "raw_html_file": "https://api.lempile.com/searches/search_id.html", "pixel_position_endpoint": "https://api.lempile.com/searches/search_id.json_with_pixel_position" }, "search_parameters": { "engine": "google", "q": "Coffee", "google_domain": "google.com", "device": "desktop" } } ``` ## Cached Response If an identical successful search is still cached, Lempile may return `200 OK` immediately with final `organic_results`. ## Queue Full Response If the workspace already has too many pending searches, Lempile returns `429`. ```json { "error": "Workspace Google search queue is full.", "error_code": "workspace_search_queue_full" } ``` ## Important Parameters | Parameter | Purpose | | --- | --- | | `q` | Google query. Supports operators such as `site:`, `inurl:`, and quoted phrases. | | `location` | Human-readable location. Do not combine with `uule`, `lat`, or `lon`. | | `gl` | Country localization, such as `us`, `ca`, or `fr`. | | `hl` | Interface language, such as `en` or `fr`. | | `tbs` | Google filter string, such as `qdr:m`. | | `as_sitesearch` | Results from one site only, such as `linkedin.com/in`. See below. | | `device` | `desktop`, `mobile`, or `tablet`. Defaults to `desktop`. | | `no_cache` | Set to `true` to force a fresh queued browser run. | `async` is still accepted for compatibility, but fresh searches are queue-first by default whether or not `async=true` is sent. ## Advanced Search Parameters Lempile accepts SerpApi's advanced Google parameters and sends them to Google unchanged. They are part of the cache key, so the same query with a different `as_sitesearch` is a different search. | Parameter | Purpose | | --- | --- | | `as_sitesearch` | Results from this site only, such as `linkedin.com/in`. | | `as_dt` | With `as_sitesearch`: `i` keeps only that site (the default), `e` leaves it out. | | `as_epq` | A phrase every result must contain. | | `as_eq` | A word or phrase no result may contain. | | `as_oq` | Extra words: every result contains at least one of them. | | `as_q` | More words to look for. | | `as_qdr` | Recent results only: `d`, `w`, `m` or `y`, with an optional count such as `d10`. | | `as_rq` | Results related to a URL. | | `as_lq` | Results that link to a URL. | | `as_nlo`, `as_nhi` | A number range, from `as_nlo` to `as_nhi`. | For LinkedIn profile searches, use `as_sitesearch=linkedin.com/in` rather than `site:linkedin.com/in` inside `q`: Google now ignores that `site:` filter for profile searches, but honours `as_sitesearch`. ```bash curl -sS "https://api.lempile.com/search.json?engine=google&q=%22Head+of+Growth%22+Paris&as_sitesearch=linkedin.com%2Fin&hl=en&gl=us" \ -H "X-API-KEY: your-api-key" ``` --- # Google Search API: Poll Search > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact Use the `search_metadata.json_endpoint` returned by create-search responses. ```bash curl -sS "https://api.lempile.com/searches/{search_id}.json" \ -H "X-API-KEY: your-api-key" ``` ## Processing Response Queued or running searches return `202 Accepted`. ```json { "search_metadata": { "id": "search_id", "status": "Processing", "status_detail": "Running", "started_at": "2026-06-01T08:01:00Z", "lease_expires_at": "2026-06-01T08:03:00Z" } } ``` Keep polling until `search_metadata.status` is not `Processing`. ## Success Response Successful searches return `200 OK`. ```json { "search_metadata": { "id": "search_id", "status": "Success", "processed_at": "2026-06-01T08:02:00Z" }, "organic_results": [] } ``` ## Error Response Failed searches return `200 OK` with `status: "Error"` and a clear `error` message. ```json { "error": "Google returned a block or consent challenge page.", "search_metadata": { "id": "search_id", "status": "Error", "status_detail": "google_search_failed" } } ``` ## Polling Guidance - Poll every 3-5 seconds for normal requests. - Treat `Processing` as normal while the queue or browser runner is working. - Use `status_detail` for dashboard/debug display only; client state machines should rely on `search_metadata.status`. --- # Google Search API: Retrieve Artifacts > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact Every search record can expose archive endpoints through `search_metadata`. ## JSON ```text GET /searches/{search_id}.json ``` Returns the current or final SerpApi-shaped JSON payload. ## Raw HTML ```text GET /searches/{search_id}.html ``` Returns the raw Google HTML captured by the browser when the search has completed successfully. If the search is still queued or running, poll the JSON endpoint first. ## Pixel Positions ```text GET /searches/{search_id}.json_with_pixel_position ``` Returns the normal JSON payload plus pixel-position data when available. ## Authentication Archive endpoints require `search.read`. Use either `X-API-KEY` or `api_key`. --- # Google Search API: Errors And Limits > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact Lempile uses queue-first behavior so temporary runner pressure does not immediately fail fresh searches. Most new searches return `202 Accepted` and are resolved later through polling. ## Common Errors | HTTP | Code | Meaning | | --- | --- | --- | | `400` | `invalid_search_parameters` | The request has invalid or conflicting search parameters. | | `401` | `unauthorized` | The API key is missing or invalid. | | `402` | `subscription_required` | The workspace has no active trial or subscription. Start the free trial or add a card in the dashboard (Subscription), and its keys work again right away. | | `403` | `forbidden` | The API key does not include the required search scope. | | `429` | `workspace_search_queue_full` | The workspace has too many queued or running Google searches. | | `503` | `service_unavailable` | Platform configuration or authentication failed before queueing was possible. | | `503` | `proxy_country_unavailable` | Lempile has no Google IP that can run the search right now, in its country or in the US. Retry later. | ## Countries A search runs through one of Lempile's Google IPs in the country `gl` asks for. When Lempile has none in that country, it runs through a US IP instead, with `gl`, `hl` and `google_domain` kept as you sent them, so Google still localises the results to that country. Such a result says so in `search_metadata.proxy_country`, for example `"proxy_country": "US"` on a `gl=fr` search. Results that depend on the searcher's exact place (maps, nearby shops) can differ from a search made inside that country; add `location` when they matter. ## Google Blocks And CAPTCHA If Google returns a block, consent, or CAPTCHA page, Lempile records safe diagnostics in the final JSON response. Diagnostics can include: - CAPTCHA task type - provider status - solver request id - whether a token was applied - whether Google still returned a block page Diagnostics never include raw proxy credentials, cookies, CAPTCHA tokens, API keys, or passwords. ## Queue Limits Production runs conservatively: - One active Google browser job per runner by default. - Burst traffic queues instead of launching unlimited browser sessions. - A single workspace can be rate-limited to protect the shared runner fleet. When higher throughput is needed, add more runner capacity rather than increasing browser concurrency on one machine. --- # Google Search API API reference > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact Base URL: `https://api.lempile.com`. Authentication: your API key in the `X-API-KEY` header. OpenAPI document: [google-search.json](https://lempile.com/docs-assets/openapi/google-search.json). ## SerpApi Google Search - [Search Google](https://lempile.com/docs/google-search/reference/search): `GET /search` - [Search Google as JSON](https://lempile.com/docs/google-search/reference/search-json): `GET /search.json` - [Retrieve archived Google search JSON](https://lempile.com/docs/google-search/reference/retrieve-json): `GET /searches/{searchId}.json` - [Retrieve archived Google search HTML](https://lempile.com/docs/google-search/reference/retrieve-html): `GET /searches/{searchId}.html` - [Retrieve archived Google search JSON with pixel positions](https://lempile.com/docs/google-search/reference/retrieve-json-with-pixel-position): `GET /searches/{searchId}.json_with_pixel_position` --- # Google Search API: Search Google > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `GET https://api.lempile.com/search` Create a SerpApi-compatible Google Search through the Lempile browser-backed search pipeline. Fresh non-cached searches are queue-first and normally return HTTP 202 with a `search_metadata.id` plus archive endpoints. Poll `search_metadata.json_endpoint` until `search_metadata.status` becomes `Success` or `Error`. Cached successful searches may return HTTP 200 immediately. Authentication is accepted as either the `api_key` query parameter or the `X-API-KEY` header. This route requires the `search.write` scope. ## Authentication Send your Google Search API API key in the `X-API-KEY` header. ## Query parameters - `engine` (string): Search engine to use. Defaults to `google`. `engine=yahoo` is the Yahoo Search API (its own reference); other engines return a SerpApi-style error. One of: `google`. Default: `"google"`. - `q` (string, required): Google search query. Supports normal Google operators such as `site:`, `inurl:`, and quoted phrases. For LinkedIn discovery, use queries such as `site:linkedin.com/posts/ "business inspiration"`. - `location` (string): Human-readable origin location. Cannot be combined with `uule`, `lat`, or `lon`. - `uule` (string): Google encoded location token. Cannot be combined with `location`, `lat`, `lon`, or `radius`. - `lat` (number): GPS latitude. Must be paired with `lon` and cannot be combined with `location` or `uule`. - `lon` (number): GPS longitude. Must be paired with `lat` and cannot be combined with `location` or `uule`. - `radius` (integer): Distance in meters used to bias local results. Desktop accepts 1..199; mobile and tablet accept 1..1000. - `google_domain` (string): Google domain to use. Defaults to `google.com`. Default: `"google.com"`. - `hl` (string): Google interface language, such as `en` or `fr`. - `gl` (string): Country code used for Google search localization, such as `us`, `uk`, or `fr`. - `cr` (string): Country restriction, for example `countryFR|countryDE`. - `lr` (string): Language restriction, for example `lang_fr|lang_de`. - `tbs` (string): Advanced Google filter string, such as `qdr:m` for the last month. - `safe` (string): Adult content filter. Common values are `active` and `off`. One of: `active`, `off`. - `nfpr` (integer): Set to `1` to exclude auto-corrected query results when possible. One of: `0`, `1`. - `filter` (integer): Set to `0` to disable similar-results and omitted-results filtering; defaults to Google behavior. One of: `0`, `1`. - `tbm` (string): Google vertical such as `isch`, `lcl`, `vid`, `nws`, `shop`, or `pts`. Organic web search with `tbm` omitted is the current parity milestone; vertical module parity is best-effort. - `start` (integer): Result offset for pagination. `0` is page 1, `10` is page 2, and so on. Default: `0`. - `device` (string): Browser profile type used for the run. One of: `desktop`, `mobile`, `tablet`. Default: `"desktop"`. - `no_cache` (boolean): Set to `true` to bypass the 1-hour normalized-parameter cache and force a fresh queued browser-backed Google run. Cached successful searches may return immediately. Default: `false`. - `async` (boolean): Accepted for SerpApi compatibility. Lempile is queue-first by default, so fresh non-cached searches return HTTP 202 whether or not `async=true` is provided. Default: `false`. - `zero_trace` (boolean): Accepted for SerpApi compatibility, but Lempile still archives requests for dashboard inspection and search retrieval. Default: `false`. - `ludocid` (string): Google place CID used for local or knowledge graph result variants. - `lsig` (string): Google local result signature when Google requires it for a specific view. - `kgmid` (string): Google Knowledge Graph machine id. - `si` (string): Google cached search parameter token. - `ibp` (string): Google layout or expansion parameter for selected modules. - `uds` (string): Google filter token captured from a previous result page. - `as_sitesearch` (string): Limits results to one site, for example `linkedin.com/in`. Use it for site searches instead of `site:` in `q`: Google ignores `site:linkedin.com/in` inside `q` for profile searches, but honours `as_sitesearch`. - `as_dt` (string): With `as_sitesearch`: `i` keeps only that site's results (the default), `e` leaves that site out. - `as_epq` (string): A phrase that every result must contain. - `as_eq` (string): A word or phrase that no result may contain. - `as_oq` (string): Extra words: every result contains at least one of them. - `as_q` (string): More words to look for, added to `q`. - `as_qdr` (string): Only recent results: `d` (past day), `w` (week), `m` (month) or `y` (year), with an optional count, such as `d10` for the past 10 days. - `as_rq` (string): Results related to this URL. - `as_lq` (string): Results that link to this URL. - `as_nlo` (string): Start of a number range, used with `as_nhi`. - `as_nhi` (string): End of a number range, used with `as_nlo`. - `api_key` (string): API key with `search.write` for search creation routes or `search.read` for archive routes. `X-API-KEY` may be used instead. - `output` (string): Requested output format. `json` returns SerpApi-shaped JSON. `html` returns raw Google HTML only when a successful cached run is available; fresh browser runs still return HTTP 202 with polling metadata. One of: `json`, `html`. Default: `"json"`. ## Example request ```bash curl -sS "https://api.lempile.com/search" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ## Responses ### 200 A cached successful search was returned immediately, or `output=html` returned cached raw Google HTML. ```json { "error": "string", "search_metadata": { "id": "string", "status": "Processing", "status_detail": "string", "runner_status_detail": "string", "json_endpoint": "https://example.com", "pixel_position_endpoint": "https://example.com", "raw_html_file": "https://example.com", "created_at": "string", "queued_at": "string", "started_at": "string", "lease_expires_at": "string", "processed_at": "string", "google_url": "string", "total_time_taken": 0, "captcha_autosolve": {} }, "search_parameters": { "engine": "google", "q": "string", "location_requested": "string", "location_used": "string", "google_domain": "string", "hl": "string", "gl": "string", "tbs": "string", "start": 0, "device": "desktop" }, "search_information": { "query_displayed": "string", "total_results": 0, "time_taken_displayed": 0, "organic_results_state": "string", "page_number": 0 }, "organic_results": [ { "position": 0, "title": "string", "link": "https://example.com", "displayed_link": "string", "snippet": "string", "snippet_highlighted_words": [ "string" ], "source": "string" } ], "related_searches": [ {} ], "pagination": { "current": 0, "previous": "https://example.com", "next": "https://example.com", "other_pages": {} }, "serpapi_pagination": { "current": 0, "previous": "https://example.com", "next": "https://example.com", "other_pages": {} }, "error_diagnostics": {} } ``` ### 202 Fresh search accepted and queued. Poll `search_metadata.json_endpoint` until the public status changes from `Processing` to `Success` or `Error`. ```json { "search_metadata": { "id": "63c57c0222e0470397fda526", "status": "Processing", "status_detail": "Queued", "runner_status_detail": "queued", "created_at": "2026-06-01 07:35:00 UTC", "queued_at": "2026-06-01 07:35:00 UTC", "json_endpoint": "https://api.lempile.com/searches/63c57c0222e0470397fda526.json", "raw_html_file": "https://api.lempile.com/searches/63c57c0222e0470397fda526.html", "pixel_position_endpoint": "https://api.lempile.com/searches/63c57c0222e0470397fda526.json_with_pixel_position" }, "search_parameters": { "engine": "google", "q": "Coffee", "google_domain": "google.com", "device": "desktop" } } ``` ### 400 Invalid search parameters. ```json { "error": "string", "error_code": "string" } ``` ### 401 Missing or invalid API key. ```json { "error": "string", "error_code": "string" } ``` ### 403 The API key does not include the required `search.write` scope. ```json { "error": "string", "error_code": "string" } ``` ### 429 Workspace has reached the pending Google search queue cap. ```json { "error": "Workspace Google search queue is full. Please wait for existing searches to finish before adding more.", "error_code": "workspace_search_queue_full" } ``` ### 503 Platform, configuration, or storage dependency is temporarily unavailable. New searches normally queue when the runner is at capacity or briefly unavailable. ```json { "error": "string", "error_code": "string" } ``` --- # Google Search API: Search Google as JSON > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `GET https://api.lempile.com/search.json` JSON-suffixed alias for `GET /search`. Fresh non-cached searches are queue-first and return HTTP 202 with polling endpoints. Poll `search_metadata.json_endpoint` until `search_metadata.status` becomes `Success` or `Error`. ## Authentication Send your Google Search API API key in the `X-API-KEY` header. ## Query parameters - `engine` (string): Search engine to use. Defaults to `google`. `engine=yahoo` is the Yahoo Search API (its own reference); other engines return a SerpApi-style error. One of: `google`. Default: `"google"`. - `q` (string, required): Google search query. Supports normal Google operators such as `site:`, `inurl:`, and quoted phrases. For LinkedIn discovery, use queries such as `site:linkedin.com/posts/ "business inspiration"`. - `location` (string): Human-readable origin location. Cannot be combined with `uule`, `lat`, or `lon`. - `google_domain` (string): Google domain to use. Defaults to `google.com`. Default: `"google.com"`. - `hl` (string): Google interface language, such as `en` or `fr`. - `gl` (string): Country code used for Google search localization, such as `us`, `uk`, or `fr`. - `tbs` (string): Advanced Google filter string, such as `qdr:m` for the last month. - `as_sitesearch` (string): Limits results to one site, for example `linkedin.com/in`. Use it for site searches instead of `site:` in `q`: Google ignores `site:linkedin.com/in` inside `q` for profile searches, but honours `as_sitesearch`. - `start` (integer): Result offset for pagination. `0` is page 1, `10` is page 2, and so on. Default: `0`. - `device` (string): Browser profile type used for the run. One of: `desktop`, `mobile`, `tablet`. Default: `"desktop"`. - `no_cache` (boolean): Set to `true` to bypass the 1-hour normalized-parameter cache and force a fresh queued browser-backed Google run. Cached successful searches may return immediately. Default: `false`. - `api_key` (string): API key with `search.write` for search creation routes or `search.read` for archive routes. `X-API-KEY` may be used instead. ## Example request ```bash curl -sS "https://api.lempile.com/search.json" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ## Responses ### 200 A cached successful search was returned immediately. ```json { "error": "string", "search_metadata": { "id": "string", "status": "Processing", "status_detail": "string", "runner_status_detail": "string", "json_endpoint": "https://example.com", "pixel_position_endpoint": "https://example.com", "raw_html_file": "https://example.com", "created_at": "string", "queued_at": "string", "started_at": "string", "lease_expires_at": "string", "processed_at": "string", "google_url": "string", "total_time_taken": 0, "captcha_autosolve": {} }, "search_parameters": { "engine": "google", "q": "string", "location_requested": "string", "location_used": "string", "google_domain": "string", "hl": "string", "gl": "string", "tbs": "string", "start": 0, "device": "desktop" }, "search_information": { "query_displayed": "string", "total_results": 0, "time_taken_displayed": 0, "organic_results_state": "string", "page_number": 0 }, "organic_results": [ { "position": 0, "title": "string", "link": "https://example.com", "displayed_link": "string", "snippet": "string", "snippet_highlighted_words": [ "string" ], "source": "string" } ], "related_searches": [ {} ], "pagination": { "current": 0, "previous": "https://example.com", "next": "https://example.com", "other_pages": {} }, "serpapi_pagination": { "current": 0, "previous": "https://example.com", "next": "https://example.com", "other_pages": {} }, "error_diagnostics": {} } ``` ### 202 Fresh search accepted and queued. ```json { "search_metadata": { "id": "string", "status": "Processing", "status_detail": "string", "runner_status_detail": "string", "json_endpoint": "https://example.com", "pixel_position_endpoint": "https://example.com", "raw_html_file": "https://example.com", "created_at": "string", "queued_at": "string", "started_at": "string", "lease_expires_at": "string", "processed_at": "string", "google_url": "string", "total_time_taken": 0, "captcha_autosolve": {} }, "search_parameters": { "engine": "google", "q": "string", "location_requested": "string", "location_used": "string", "google_domain": "string", "hl": "string", "gl": "string", "tbs": "string", "start": 0, "device": "desktop" } } ``` ### 400 Invalid search parameters. ```json { "error": "string", "error_code": "string" } ``` ### 401 Missing or invalid API key. ```json { "error": "string", "error_code": "string" } ``` ### 403 The API key does not include the required `search.write` scope. ```json { "error": "string", "error_code": "string" } ``` ### 429 Workspace has reached the pending Google search queue cap. ```json { "error": "Workspace Google search queue is full. Please wait for existing searches to finish before adding more.", "error_code": "workspace_search_queue_full" } ``` ### 503 Platform, configuration, or storage dependency is temporarily unavailable. New searches normally queue when the runner is at capacity or briefly unavailable. ```json { "error": "string", "error_code": "string" } ``` --- # Google Search API: Retrieve archived Google search JSON > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `GET https://api.lempile.com/searches/{searchId}.json` Poll or retrieve the JSON archive for a Google search. Pending internal `Queued`, `Running`, and legacy `Processing` rows return HTTP 202 with public status `Processing`. Final rows return HTTP 200 with public status `Success` or `Error`. This route requires the `search.read` scope. ## Authentication Send your Google Search API API key in the `X-API-KEY` header. ## Path parameters - `searchId` (string, required): Search archive id returned in `search_metadata.id`. ## Query parameters - `api_key` (string): API key with `search.write` for search creation routes or `search.read` for archive routes. `X-API-KEY` may be used instead. ## Example request ```bash curl -sS "https://api.lempile.com/searches/{searchId}.json" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ## Responses ### 200 Final archived search JSON. ```json { "search_metadata": { "id": "63c57c0222e0470397fda526", "status": "Success", "status_detail": "completed", "created_at": "2026-06-01 07:35:00 UTC", "processed_at": "2026-06-01 07:35:22 UTC", "total_time_taken": 18.42, "json_endpoint": "https://api.lempile.com/searches/63c57c0222e0470397fda526.json", "raw_html_file": "https://api.lempile.com/searches/63c57c0222e0470397fda526.html", "pixel_position_endpoint": "https://api.lempile.com/searches/63c57c0222e0470397fda526.json_with_pixel_position" }, "search_parameters": { "engine": "google", "q": "Coffee", "google_domain": "google.com", "device": "desktop" }, "organic_results": [] } ``` ### 202 Search is queued or running. Continue polling. ```json { "search_metadata": { "id": "string", "status": "Processing", "status_detail": "string", "runner_status_detail": "string", "json_endpoint": "https://example.com", "pixel_position_endpoint": "https://example.com", "raw_html_file": "https://example.com", "created_at": "string", "queued_at": "string", "started_at": "string", "lease_expires_at": "string", "processed_at": "string", "google_url": "string", "total_time_taken": 0, "captcha_autosolve": {} }, "search_parameters": { "engine": "google", "q": "string", "location_requested": "string", "location_used": "string", "google_domain": "string", "hl": "string", "gl": "string", "tbs": "string", "start": 0, "device": "desktop" } } ``` ### 401 Missing or invalid API key. ```json { "error": "string", "error_code": "string" } ``` ### 403 The API key does not include the required `search.read` scope. ```json { "error": "string", "error_code": "string" } ``` ### 404 Search archive id was not found for the current workspace. ```json { "error": "Search not found." } ``` ### 503 Platform, configuration, or storage dependency is temporarily unavailable. New searches normally queue when the runner is at capacity or briefly unavailable. ```json { "error": "string", "error_code": "string" } ``` --- # Google Search API: Retrieve archived Google search HTML > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `GET https://api.lempile.com/searches/{searchId}.html` Retrieve raw Google HTML for a successful browser-backed search. Pending rows return HTTP 202 with the same processing JSON used by archive polling. This route requires the `search.read` scope. ## Authentication Send your Google Search API API key in the `X-API-KEY` header. ## Path parameters - `searchId` (string, required): Search archive id returned in `search_metadata.id`. ## Query parameters - `api_key` (string): API key with `search.write` for search creation routes or `search.read` for archive routes. `X-API-KEY` may be used instead. ## Example request ```bash curl -sS "https://api.lempile.com/searches/{searchId}.html" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ## Responses ### 200 Raw Google Search HTML captured from the browser run. ```text string ``` ### 202 Search is queued or running. Continue polling the JSON endpoint. ```json { "search_metadata": { "id": "string", "status": "Processing", "status_detail": "string", "runner_status_detail": "string", "json_endpoint": "https://example.com", "pixel_position_endpoint": "https://example.com", "raw_html_file": "https://example.com", "created_at": "string", "queued_at": "string", "started_at": "string", "lease_expires_at": "string", "processed_at": "string", "google_url": "string", "total_time_taken": 0, "captcha_autosolve": {} }, "search_parameters": { "engine": "google", "q": "string", "location_requested": "string", "location_used": "string", "google_domain": "string", "hl": "string", "gl": "string", "tbs": "string", "start": 0, "device": "desktop" } } ``` ### 401 Missing or invalid API key. ```json { "error": "string", "error_code": "string" } ``` ### 403 The API key does not include the required `search.read` scope. ```json { "error": "string", "error_code": "string" } ``` ### 404 Search archive id was not found for the current workspace. ```json { "error": "Search not found." } ``` --- # Google Search API: Retrieve archived Google search JSON with pixel positions > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `GET https://api.lempile.com/searches/{searchId}.json_with_pixel_position` Retrieve final or pending search JSON plus `pixel_positions` when available. Pending rows return HTTP 202 and should be polled until the public status is no longer `Processing`. This route requires the `search.read` scope. ## Authentication Send your Google Search API API key in the `X-API-KEY` header. ## Path parameters - `searchId` (string, required): Search archive id returned in `search_metadata.id`. ## Query parameters - `api_key` (string): API key with `search.write` for search creation routes or `search.read` for archive routes. `X-API-KEY` may be used instead. ## Example request ```bash curl -sS "https://api.lempile.com/searches/{searchId}.json_with_pixel_position" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ## Responses ### 200 Archived search JSON with pixel position data. ```json { "error": "string", "search_metadata": { "id": "string", "status": "Processing", "status_detail": "string", "runner_status_detail": "string", "json_endpoint": "https://example.com", "pixel_position_endpoint": "https://example.com", "raw_html_file": "https://example.com", "created_at": "string", "queued_at": "string", "started_at": "string", "lease_expires_at": "string", "processed_at": "string", "google_url": "string", "total_time_taken": 0, "captcha_autosolve": {} }, "search_parameters": { "engine": "google", "q": "string", "location_requested": "string", "location_used": "string", "google_domain": "string", "hl": "string", "gl": "string", "tbs": "string", "start": 0, "device": "desktop" }, "search_information": { "query_displayed": "string", "total_results": 0, "time_taken_displayed": 0, "organic_results_state": "string", "page_number": 0 }, "organic_results": [ { "position": 0, "title": "string", "link": "https://example.com", "displayed_link": "string", "snippet": "string", "snippet_highlighted_words": [ "string" ], "source": "string" } ], "related_searches": [ {} ], "pagination": { "current": 0, "previous": "https://example.com", "next": "https://example.com", "other_pages": {} }, "serpapi_pagination": { "current": 0, "previous": "https://example.com", "next": "https://example.com", "other_pages": {} }, "error_diagnostics": {}, "pixel_positions": {} } ``` ### 202 Search is queued or running. Continue polling. ```json { "search_metadata": { "id": "string", "status": "Processing", "status_detail": "string", "runner_status_detail": "string", "json_endpoint": "https://example.com", "pixel_position_endpoint": "https://example.com", "raw_html_file": "https://example.com", "created_at": "string", "queued_at": "string", "started_at": "string", "lease_expires_at": "string", "processed_at": "string", "google_url": "string", "total_time_taken": 0, "captcha_autosolve": {} }, "search_parameters": { "engine": "google", "q": "string", "location_requested": "string", "location_used": "string", "google_domain": "string", "hl": "string", "gl": "string", "tbs": "string", "start": 0, "device": "desktop" } } ``` ### 401 Missing or invalid API key. ```json { "error": "string", "error_code": "string" } ``` ### 403 The API key does not include the required `search.read` scope. ```json { "error": "string", "error_code": "string" } ``` ### 404 Search archive id was not found for the current workspace. ```json { "error": "Search not found." } ``` --- # Yahoo Search API: Overview > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact Lempile's Yahoo Search API returns Yahoo's web results in SerpApi's Yahoo format, from real browsers. It works like the Google Search API: create a search, poll it, read the archive. Use `engine=yahoo` on the same `GET /search.json` route, with the same API key. Yahoo applies `site:` filters such as `site:linkedin.com/in`, so it suits searches for LinkedIn profiles. ## Quickstart Create a search: ```bash curl -sS "https://api.lempile.com/search.json?engine=yahoo&p=site%3Alinkedin.com%2Fin%20%22Head%20of%20Growth%22%20Paris" \ -H "X-API-KEY: your-api-key" ``` A new search answers `202` with `search_metadata.status: "Processing"`. Poll its `search_metadata.json_endpoint`: ```bash curl -sS "https://api.lempile.com/searches/{search_id}.json" \ -H "X-API-KEY: your-api-key" ``` Stop polling when `search_metadata.status` is `Success` or `Error`. Once a search has finished, the same search sent again within the hour returns its stored result at once with `200`, unless you add `no_cache=true`. While the first one is still `Processing`, the same request starts another search. ## Parameters | Parameter | Required | What it does | | --- | --- | --- | | `engine` | Yes | `yahoo`. | | `p` | Yes | The query, as you would type it on Yahoo. Operators such as `site:` and quotes work. Yahoo names it `p`, not `q`. | | `b` | No | The position of the page's first result, from `1`. A Yahoo page has 7 results: page 2 starts at `b=8`, page 3 at `b=15`. | | `yahoo_domain` | No | `search.yahoo.com` (the default) or a country's Yahoo, such as `fr.search.yahoo.com`. | | `vc` | No | A country, as 2 letters (`fr`). | | `vl` | No | A language, such as `lang_fr`. | | `vm` | No | The adult filter: `r` (strict), `i` (moderate) or `p` (off). | | `vs` | No | Only results from these domains or endings, comma-separated (`.fr,.com`). | | `vf` | No | Only this file type, such as `pdf`. | | `no_cache` | No | `true` runs a new search instead of returning the same search made in the last hour. | | `output` | No | `json` (the default) or `html`, the page as Yahoo showed it. | | `device` | No | `desktop`, the only device for now. | | `async` | No | Accepted for SerpApi compatibility. A new search always answers `202` and is polled. | `vc`, `vl`, `vm`, `vs` and `vf` go to Yahoo as you send them. A search needs the `search.write` scope, and reading the archive needs `search.read`, as for Google. ## Result ```json { "search_metadata": { "id": "search_id", "status": "Success", "json_endpoint": "https://api.lempile.com/searches/search_id.json", "raw_html_file": "https://api.lempile.com/searches/search_id.html", "yahoo_url": "https://search.yahoo.com/search?p=site%3Alinkedin.com%2Fin+%22Head+of+Growth%22+Paris", "created_at": "2026-11-15 10:00:00 UTC", "processed_at": "2026-11-15 10:00:09 UTC", "total_time_taken": 3.2 }, "search_parameters": { "engine": "yahoo", "p": "site:linkedin.com/in \"Head of Growth\" Paris", "yahoo_domain": "search.yahoo.com", "device": "desktop" }, "search_information": { "query_displayed": "site:linkedin.com/in \"Head of Growth\" Paris", "organic_results_state": "Results for exact spelling" }, "organic_results": [ { "position": 1, "title": "Jane Example - Head of Growth - Example Company | LinkedIn", "link": "https://fr.linkedin.com/in/jane-example", "displayed_link": "https://fr.linkedin.com › in › jane-example", "source": "LinkedIn", "snippet": "Head of Growth at Example Company · Location: Paris · 500+ connections on LinkedIn." } ], "pagination": { "current": 1, "next": "https://search.yahoo.com/search?p=site%3Alinkedin.com%2Fin+%22Head+of+Growth%22+Paris&b=8", "other_pages": { "2": "https://search.yahoo.com/search?p=…&b=8", "3": "https://search.yahoo.com/search?p=…&b=15" } } } ``` - `link` is the result's own address, read from Yahoo's page. When Yahoo's page wraps it in its click link, that link is in `redirect_link`; most results have none. - `displayed_link` is the address as Yahoo shows it, with `›` between its parts: read `link` for the address itself. - `pagination` lists the pages Yahoo offers, with Yahoo's own addresses. For the next page, send the same search with the `b` of `pagination.next` (`b=8`, then `b=15`...). - Ads are never in `organic_results`. ## How it runs Each search opens a real browser on one of Lempile's US IPs and reads Yahoo's results page. `vc` and `yahoo_domain` choose the country of the results. Lempile's IPs wait between Yahoo searches, so a burst of searches queues: they stay `Processing` and run in turn, and `search_metadata` may show `runner_status_detail: "yahoo_proxy_paced"` while one waits. ## Errors The request errors are those of the Google Search API, with the same format: | HTTP | Code | Meaning | | --- | --- | --- | | `400` | `invalid_search_parameters` | A parameter is missing or invalid, for example no `p`, a `b` below 1, a `device` other than `desktop`, or a `yahoo_domain` that is not Yahoo's. The message says which. | | `403` | `forbidden` | The API key does not include `search.write` (or `search.read` to read the archive). | | `429` | `workspace_search_queue_full` | The workspace already has too many Yahoo searches queued or running. | | `503` | `proxy_unavailable` | Lempile has no IP that can run a Yahoo search right now. Retry later. | A search that ends with `status: "Error"` says why in `error` and in `search_metadata.status_detail`: | `status_detail` | Meaning | | --- | --- | | `yahoo_blocked` | Yahoo refused the search on all 3 tries. | | `yahoo_consent_wall` | Yahoo showed its consent page on all 3 tries. | | `yahoo_search_failed` | Yahoo's page showed no results list. | | `search_queue_timeout` | The search could not leave the queue in time. | --- # Yahoo Search API API reference > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact Base URL: `https://api.lempile.com`. Authentication: your API key in the `X-API-KEY` header. OpenAPI document: [yahoo-search.json](https://lempile.com/docs-assets/openapi/yahoo-search.json). ## Yahoo Search - [Search Yahoo as JSON](https://lempile.com/docs/yahoo-search/reference/search-json): `GET /search.json` - [Retrieve a Yahoo search](https://lempile.com/docs/yahoo-search/reference/retrieve-json): `GET /searches/{searchId}.json` --- # Yahoo Search API: Search Yahoo as JSON > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `GET https://api.lempile.com/search.json` Creates a Yahoo search. A fresh search returns HTTP 202; poll `search_metadata.json_endpoint` until `search_metadata.status` is `Success` or `Error`. Once a search has finished, the same search within the hour returns its stored result with HTTP 200 unless `no_cache=true`; while the first is still Processing, the same request starts another search. ## Authentication Send your Yahoo Search API API key in the `X-API-KEY` header. ## Query parameters - `engine` (string, required): Search engine: `yahoo` for this API. One of: `yahoo`. - `p` (string, required): The query, as typed on Yahoo. Operators such as `site:` and quotes work. Yahoo's name for the query (not `q`). - `b` (integer): Position of the page's first result, from 1. A Yahoo page has 7 results: page 2 starts at `b=8`, page 3 at `b=15` (the `b` of `pagination.next`). Default: `1`. - `yahoo_domain` (string): `search.yahoo.com` or a country's Yahoo such as `fr.search.yahoo.com`. Default: `"search.yahoo.com"`. - `vc` (string): Country of the results, 2 letters (`fr`). Sent to Yahoo as given. - `vl` (string): Language of the results, such as `lang_fr`. Sent to Yahoo as given. - `vm` (string): Adult filter: `r` (strict), `i` (moderate) or `p` (off). One of: `r`, `i`, `p`. - `vs` (string): Only results from these domains or endings, comma-separated (`.fr,.com`). - `vf` (string): Only this file type, such as `pdf`. - `device` (string): `desktop`, the only device for now. One of: `desktop`. Default: `"desktop"`. - `output` (string): `json` or `html` (the page as Yahoo showed it). One of: `json`, `html`. Default: `"json"`. - `no_cache` (boolean): Set to `true` to run a new Yahoo search instead of returning the same finished search from the last hour. Default: `false`. - `async` (boolean): Accepted for SerpApi compatibility; a new search always answers 202 and is polled. Default: `false`. - `api_key` (string): API key with `search.write` for search creation routes or `search.read` for archive routes. `X-API-KEY` may be used instead. ## Example request ```bash curl -sS "https://api.lempile.com/search.json" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ## Responses ### 200 The same search, finished within the last hour. ```json { "search_metadata": { "id": "string", "status": "Processing", "status_detail": "string", "json_endpoint": "https://example.com", "raw_html_file": "https://example.com", "yahoo_url": "https://example.com", "created_at": "string", "processed_at": "string", "total_time_taken": 0 }, "search_parameters": {}, "search_information": { "query_displayed": "string", "organic_results_state": "string" }, "organic_results": [ { "position": 0, "title": "string", "link": "https://example.com", "redirect_link": "https://example.com", "displayed_link": "string", "source": "string", "snippet": "string" } ], "pagination": {}, "serpapi_pagination": { "current": 0, "next": "https://example.com", "next_link": "https://example.com", "previous": "https://example.com", "previous_link": "https://example.com", "other_pages": {} }, "error": "string" } ``` ### 202 Search accepted and queued. ```json { "search_metadata": { "id": "string", "status": "Processing", "status_detail": "string", "runner_status_detail": "string", "json_endpoint": "https://example.com", "pixel_position_endpoint": "https://example.com", "raw_html_file": "https://example.com", "created_at": "string", "queued_at": "string", "started_at": "string", "lease_expires_at": "string", "processed_at": "string", "total_time_taken": 0 }, "search_parameters": {} } ``` ### 400 Invalid search parameters (for example no `p`, a `b` below 1, a `device` other than desktop, a `yahoo_domain` that is not Yahoo's). ```json { "error": "Missing required parameter: p", "error_code": "invalid_search_parameters" } ``` ### 401 Missing or invalid API key. ```json { "error": "string", "error_code": "string" } ``` ### 403 The API key does not include the required `search.write` scope. ```json { "error": "string", "error_code": "string" } ``` ### 429 The workspace already has too many Yahoo searches queued or running. ```json { "error": "Workspace Yahoo search queue is full. Please wait for existing searches to finish before adding more.", "error_code": "workspace_search_queue_full" } ``` ### 503 Lempile has no IP that can run a Yahoo search right now. Retry later. ```json { "error": "Lempile has no IP that can run a Yahoo search right now. Retry later.", "error_code": "proxy_unavailable" } ``` --- # Yahoo Search API: Retrieve a Yahoo search > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `GET https://api.lempile.com/searches/{searchId}.json` Polls or reads a Yahoo search. HTTP 202 while it is queued or running (`status: Processing`), HTTP 200 once it is `Success` or `Error`. Needs the `search.read` scope. ## Authentication Send your Yahoo Search API API key in the `X-API-KEY` header. ## Path parameters - `searchId` (string, required): Search archive id returned in `search_metadata.id`. ## Query parameters - `api_key` (string): API key with `search.write` for search creation routes or `search.read` for archive routes. `X-API-KEY` may be used instead. ## Example request ```bash curl -sS "https://api.lempile.com/searches/{searchId}.json" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ## Responses ### 200 The finished search. ```json { "search_metadata": { "id": "string", "status": "Processing", "status_detail": "string", "json_endpoint": "https://example.com", "raw_html_file": "https://example.com", "yahoo_url": "https://example.com", "created_at": "string", "processed_at": "string", "total_time_taken": 0 }, "search_parameters": {}, "search_information": { "query_displayed": "string", "organic_results_state": "string" }, "organic_results": [ { "position": 0, "title": "string", "link": "https://example.com", "redirect_link": "https://example.com", "displayed_link": "string", "source": "string", "snippet": "string" } ], "pagination": {}, "serpapi_pagination": { "current": 0, "next": "https://example.com", "next_link": "https://example.com", "previous": "https://example.com", "previous_link": "https://example.com", "other_pages": {} }, "error": "string" } ``` ### 202 Still queued or running. Keep polling. ```json { "search_metadata": { "id": "string", "status": "Processing", "status_detail": "string", "runner_status_detail": "string", "json_endpoint": "https://example.com", "pixel_position_endpoint": "https://example.com", "raw_html_file": "https://example.com", "created_at": "string", "queued_at": "string", "started_at": "string", "lease_expires_at": "string", "processed_at": "string", "total_time_taken": 0 }, "search_parameters": {} } ``` ### 401 Missing or invalid API key. ```json { "error": "string", "error_code": "string" } ``` ### 403 The API key does not include the required `search.read` scope. ```json { "error": "string", "error_code": "string" } ``` ### 404 Search archive id was not found for the current workspace. ```json { "error": "Search not found." } ``` --- # Email Finder: Overview Queue-first B2B email discovery and lightweight identity resolution from LinkedIn profile URLs or public identifiers. Email Finder uses Lempile-owned resolver logic; it does not call Apify or an external contact database. When a workspace has a Ready connected LinkedIn account, Lempile may use that same-workspace account to resolve the visible profile identity before company domain and email verification. ## Quick Start Create a key in your console: **Email Finder → Create key** ([lempile.com/dashboard/email-finder](https://lempile.com/dashboard/email-finder)). It only works for the Email Finder and is shown once. Create a job: ```bash curl -X POST "https://api.lempile.com/email-finder" \ -H "X-API-KEY: $LEMPILE_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "linkedin_url_or_ids": [ "https://www.linkedin.com/in/nick-hampson1", "swaroop-mehetar" ] }' ``` The API returns `202` with a job id and polling endpoints. Poll the job until `status` becomes `Completed` or `Error`, then fetch items or CSV. You can also pass safe identity hints. This is the preferred shape when you already know the person or company because it lets Lempile resolve from company website evidence without waiting on Google Search evidence. ```json { "records": [ { "linkedin_url_or_id": "https://www.linkedin.com/in/mike-novak-34b8733", "first_name": "Mike", "last_name": "Novak", "company": "Louder Than Digital", "company_domain": "louderthandigital.com" } ] } ``` ## Behavior - Email Finder returns business/work emails only by default. - Gmail, Yahoo, Outlook, iCloud, disposable, and similar personal domains are suppressed by default. - The resolver checks cache, input hints, same-workspace LinkedIn profile identity when available, public LinkedIn profile previews, company websites, company email patterns, and ranked candidate generation. - Verification is internal-owned by default: syntax, personal/disposable/role suppression, DNS/MX, known provider/domain behavior, SMTP-safe catch-all/candidate checks, and cached results. - External verifier fallback is disabled by default. Suppressed, impossible, MX-missing, and internally rejected candidates are never sent to an external provider. - Results include safe identity fields such as name, title, headline, company, company URL, domain, and location when evidence supports them. - Google Search evidence is a bounded fallback only when the Google Search cookie/proxy pool is ready. If it is not ready, items finish deterministically with a safe `Not Found` reason instead of creating stuck Search rows. - Connected LinkedIn account usage is controlled: same workspace only, leased, low concurrency, and used for profile identity resolution only. - Provider payloads, API keys, LinkedIn cookies, proxy credentials, CAPTCHA tokens, and passwords are never returned in diagnostics. ## Pricing - You pay only for emails the company's mail server confirmed: items with status `Found`. `Uncertain`, `Not Found`, `Suppressed` and `Error` are free. - Each billing period includes 1,000 found emails. After that, €10 per 1,000 (£10, $11, C$15.40, A$17.60 or NZ$18.70 per 1,000), on the same monthly invoice. - During the 7-day trial, the Email Finder stops at the 1,000 included: new jobs answer `402 email_finder_trial_limit` until the subscription starts. - `GET /email-finder/usage` returns this period's found emails, the billable ones and the estimated amount. ## Item Statuses - `Found`: an exact work email was observed publicly or a generated candidate was confirmed by the internal SMTP-safe verifier. - `Uncertain`: the domain is catch-all, protected, greylisted, unknown/timeout, or a generated candidate has strong pattern/MX evidence without deliverability proof. - `Not Found`: no safe work email was found, identity/company/domain was not resolved, or public evidence was unavailable. - `Suppressed`: an email was found but suppressed by policy, usually personal or disposable. - `Error`: the item failed after retries or the input was invalid. `Uncertain` items include a safe `confidence_bucket` and `uncertain_bucket`. `confidence_bucket: "likely"` means Lempile has strong identity, domain, and pattern evidence, but the receiving mail server did not allow strict mailbox proof. Typical `uncertain_bucket` values are `catch_all`, `protected`, `greylisted`, `timeout`, `temporary_failure`, `unknown`, and `low`. Greylisted, timeout, and temporary-failure candidates may receive background SMTP-safe retries with `retry_after` and `retry_strategy`. A job can be `Completed` while some items still wait for a retry: `counts.retrying` says how many, and `next_retry_at` when the next one runs. Read the job again after `next_retry_at` until `counts.retrying` is 0. A retried item can become `Found`, and is billed only then. ## Endpoints - `POST /email-finder` - `GET /email-finder/jobs/{jobId}` - `GET /email-finder/jobs/{jobId}/items` - `GET /email-finder/jobs/{jobId}.csv` - `GET /email-finder/usage` Scopes: - Create jobs: `email_finder.write` - Read jobs/results: `email_finder.read` --- # Email Finder API reference Base URL: `https://api.lempile.com`. Authentication: your API key in the `X-API-KEY` header. OpenAPI document: [email-finder.json](https://lempile.com/docs-assets/openapi/email-finder.json). ## Email Finder - [Create email finder job](https://lempile.com/docs/email-finder/reference/create-job): `POST /email-finder` - [Get email finder usage](https://lempile.com/docs/email-finder/reference/get-usage): `GET /email-finder/usage` - [Get email finder job](https://lempile.com/docs/email-finder/reference/get-job): `GET /email-finder/jobs/{jobId}` - [List email finder items](https://lempile.com/docs/email-finder/reference/get-items): `GET /email-finder/jobs/{jobId}/items` - [Export email finder CSV](https://lempile.com/docs/email-finder/reference/get-csv): `GET /email-finder/jobs/{jobId}.csv` --- # Email Finder: Create email finder job `POST https://api.lempile.com/email-finder` Creates a queue-first email finder job and returns `202`. Poll the job endpoint until it reaches `Completed` or `Error`. Inputs can be plain LinkedIn URLs/ids or safe identity records with optional name, company, and company-domain hints. Email Finder checks cache, same-workspace LinkedIn profile identity when a Ready account is available, public LinkedIn profile previews, company-site evidence, public emails, verified domain patterns, generated candidates, and internal syntax/domain/MX/SMTP-safe verification. Google Search evidence is optional last-resort evidence only when the Google evidence pool is ready. ## Authentication Send your Email Finder API key in the `X-API-KEY` header. ## Request body `application/json` (required) - `linkedin_url_or_ids` (array of EmailFinderInput): LinkedIn profile URLs, public identifiers, or safe identity records. Plain strings remain supported for compatibility. - Option 1: string - Option 2: EmailFinderInputRecord - `linkedin_url_or_id` (string): LinkedIn profile URL or public identifier. - `linkedin_url` (string): Accepted alias for `linkedin_url_or_id`. - `linkedin_id` (string): Accepted alias for `linkedin_url_or_id`. - `first_name` (string) - `last_name` (string) - `full_name` (string) - `company` (string) - `company_domain` (string): Company website domain, for example `example.com`. - `company_url` (string): Optional company website or company page URL evidence. - `records` (array of EmailFinderInputRecord): Alternative input field for safe identity records. Use this when you already know names, company, or company domain. - `linkedin_url_or_id` (string): LinkedIn profile URL or public identifier. - `linkedin_url` (string): Accepted alias for `linkedin_url_or_id`. - `linkedin_id` (string): Accepted alias for `linkedin_url_or_id`. - `first_name` (string) - `last_name` (string) - `full_name` (string) - `company` (string) - `company_domain` (string): Company website domain, for example `example.com`. - `company_url` (string): Optional company website or company page URL evidence. - `options` (object) - `business_email_only` (boolean): Email Finder defaults to business emails only. Default: `true`. - `profile_resolution` (string): Use controlled same-workspace Ready LinkedIn accounts for visible profile identity resolution, or public/cache/domain evidence only. One of: `workspace_linkedin_accounts`, `public_only`. Default: `"workspace_linkedin_accounts"`. - `verification_mode` (string): `smtp_only` is the default internal-owned mode: syntax/domain/MX/SMTP-safe verification only. `mx_only` disables SMTP recipient checks and uses domain/MX evidence only. One of: `smtp_only`, `mx_only`. Default: `"smtp_only"`. - `provider_max_candidates_per_item` (integer): Reserved for future external verifier fallback. Current public jobs are internal-only and this value is clamped to `0`. Default: `0`. ## Example request ```bash curl -sS -X POST "https://api.lempile.com/email-finder" \ -H "X-API-KEY: $LEMPILE_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "linkedin_url_or_ids": [ "string" ], "records": [ { "linkedin_url_or_id": "string", "linkedin_url": "string", "linkedin_id": "string", "first_name": "string", "last_name": "string", "full_name": "string", "company": "string", "company_domain": "string", "company_url": "string" } ], "options": { "business_email_only": true, "profile_resolution": "workspace_linkedin_accounts", "verification_mode": "smtp_only", "provider_max_candidates_per_item": 0 } }' ``` ## Responses ### 202 Email finder job accepted. ```json { "object": "email_finder_job", "id": "string", "status": "Queued", "status_detail": "string", "counts": { "input": 0, "completed": 0, "found": 0, "not_found": 0, "uncertain": 0, "error": 0, "retrying": 0 }, "next_retry_at": "string", "endpoints": { "jobEndpoint": "https://example.com", "itemsEndpoint": "https://example.com", "csvEndpoint": "https://example.com" } } ``` ### 400 Invalid input. ```json { "error": "string", "message": "string" } ``` ### 401 Missing or invalid API key. ```json { "error": "string", "message": "string" } ``` ### 402 No active trial or subscription (`subscription_required`), or a trial that used its 1,000 included found emails (`email_finder_trial_limit`). ```json { "error": "string", "message": "string" } ``` ### 403 API key lacks `email_finder.write`. ```json { "error": "string", "message": "string" } ``` ### 429 Workspace email finder queue is full. ```json { "error": "string", "message": "string" } ``` --- # Email Finder: Get email finder usage `GET https://api.lempile.com/email-finder/usage` Found emails this billing period and what they cost. Only emails the company's mail server confirmed (status `Found`) count; `Uncertain` and `Not Found` are free. Each period includes 1,000 found emails, then 10 EUR (or GBP) per 1,000. A trial stops at the 1,000 included: new jobs answer 402 `email_finder_trial_limit` until the subscription starts. ## Authentication Send your Email Finder API key in the `X-API-KEY` header. ## Example request ```bash curl -sS "https://api.lempile.com/email-finder/usage" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ## Responses ### 200 This period's usage. ```json { "object": "email_finder_usage", "period_start": "2026-10-29T09:00:00Z", "period_end": "2026-10-29T09:00:00Z", "found_emails": 0, "included_found_emails": 0, "billable_found_emails": 0, "price_per_1000": { "amount": 0, "currency": "string" }, "estimated_amount": { "amount": 0, "currency": "string" }, "billing": "string", "note": "string" } ``` ### 403 API key lacks `email_finder.read`. ```json { "error": "string", "message": "string" } ``` --- # Email Finder: Get email finder job `GET https://api.lempile.com/email-finder/jobs/{jobId}` ## Authentication Send your Email Finder API key in the `X-API-KEY` header. ## Path parameters - `jobId` (string, required) ## Example request ```bash curl -sS "https://api.lempile.com/email-finder/jobs/{jobId}" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ## Responses ### 200 Completed or failed job. ```json { "object": "email_finder_job", "id": "string", "status": "Queued", "status_detail": "string", "counts": { "input": 0, "completed": 0, "found": 0, "not_found": 0, "uncertain": 0, "error": 0, "retrying": 0 }, "next_retry_at": "string", "endpoints": { "jobEndpoint": "https://example.com", "itemsEndpoint": "https://example.com", "csvEndpoint": "https://example.com" } } ``` ### 202 Job is still queued or running. ```json { "object": "email_finder_job", "id": "string", "status": "Queued", "status_detail": "string", "counts": { "input": 0, "completed": 0, "found": 0, "not_found": 0, "uncertain": 0, "error": 0, "retrying": 0 }, "next_retry_at": "string", "endpoints": { "jobEndpoint": "https://example.com", "itemsEndpoint": "https://example.com", "csvEndpoint": "https://example.com" } } ``` --- # Email Finder: List email finder items `GET https://api.lempile.com/email-finder/jobs/{jobId}/items` ## Authentication Send your Email Finder API key in the `X-API-KEY` header. ## Path parameters - `jobId` (string, required) ## Example request ```bash curl -sS "https://api.lempile.com/email-finder/jobs/{jobId}/items" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ## Responses ### 200 Item results for the job. ```json { "object": "email_finder_item_list", "job": { "object": "email_finder_job", "id": "string", "status": "Queued", "status_detail": "string", "counts": { "input": 0, "completed": 0, "found": 0, "not_found": 0, "uncertain": 0, "error": 0, "retrying": 0 }, "next_retry_at": "string", "endpoints": { "jobEndpoint": "https://example.com", "itemsEndpoint": "https://example.com", "csvEndpoint": "https://example.com" } }, "items": [ { "object": "email_finder_item", "id": "string", "input": "string", "linkedin_id": "string", "linkedin_url": "https://example.com", "status": "Queued", "first_name": "string", "last_name": "string", "full_name": "string", "title": "string", "headline": "string", "location": "string", "country": "string", "company": "string", "company_domain": "string", "company_url": "https://example.com", "company_source": "string", "email": "string", "confidence": 0, "verification_status": "string", "verification_provider": "string", "verification_result": "string", "verification_sub_status": "string", "identity_source": "string", "identity_confidence": 0, "domain_source": "string", "pattern_source": "string", "candidate_pattern": "string", "pattern_confidence": 0, "confidence_reason": "string", "confidence_bucket": "likely", "confidence_score": 0, "uncertain_bucket": "likely", "likely_reason": "string", "retry_after": "string", "retry_strategy": "string", "unknown_reason": "string", "smtp_infra_reason": "string", "smtp_classification": "string", "domain_behavior": "string", "source_provider": "string", "diagnostics": {} } ] } ``` --- # Email Finder: Export email finder CSV `GET https://api.lempile.com/email-finder/jobs/{jobId}.csv` ## Authentication Send your Email Finder API key in the `X-API-KEY` header. ## Path parameters - `jobId` (string, required) ## Example request ```bash curl -sS "https://api.lempile.com/email-finder/jobs/{jobId}.csv" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ## Responses ### 200 CSV export. ```text string ``` --- # People Search: Overview > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact People Search provides gated, Apollo-style lead discovery over approved Lempile people snapshots. It returns only safe search metadata plus contact availability. Raw email and phone values are handled by the separate People Reveal API. ## Quick Start ```bash curl -sS -X POST "https://api.lempile.com/people/search" \ -H "X-API-KEY: $LEMPILE_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "person_countries": ["Canada"], "job_titles": ["sales"], "company_employee_ranges": [{ "min": 101, "max": 200 }], "has_email": true, "facets": ["person_country", "seniority", "company_size"], "page": 1, "per_page": 25 }' ``` The route requires `people.read`. Contact reveal requires `people.reveal` on the separate `/people/reveal` route. ## Response ```json { "object": "people_search_result", "total": 0, "page": 1, "per_page": 25, "has_more": false, "data": [], "facets": { "person_country": {}, "seniority": {}, "company_size": {} } } ``` Each result contains person role/location fields, company metadata, LinkedIn URL when available, and contact availability/status. Search does not return raw emails or raw phone numbers. `photo_url` is the link to the person's LinkedIn profile picture, as LinkedIn shows it publicly, or `null`. LinkedIn's picture links expire, usually within a few weeks, so a result carries the link only while it still works. Show the picture when you display the result; don't store the link or the picture. ## Filters - `person_countries`: exact country names. - `person_locations`: text match over city, state, country, and location label. - `job_titles`: text match over title, normalized title, and function. - `seniorities`: exact seniority labels. - `company_domains`: normalized company domains. - `company_employee_ranges`: objects with `min` and/or `max`. - `company_industries`: text match over company industry. - `email_statuses`: exact email status labels. - `has_email`: boolean. - `has_photo`: boolean. `true` returns only people whose `photo_url` still works, `false` only the others. - `page`: `1` to `500`. - `per_page`: `1` to `100`. Supported facets are `person_country`, `seniority`, `company_size`, `company_industry`, `email_status`, and `has_email`. ## Gated Data Policy Default API calls only search active snapshots whose provenance has been approved. Platform admins can request synthetic QA sample records with `"sample": true`; non-admin keys receive `403` for sample mode. Real imports are controlled through the internal People Import Gate. A platform admin must register source provenance, confirm lawful use, approve the source, run a capped local-file import, and activate the resulting snapshot before it is visible to this API. See people-imports.md. --- # People Search API reference > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact Base URL: `https://api.lempile.com`. Authentication: your API key in the `X-API-KEY` header. OpenAPI document: [people.json](https://lempile.com/docs-assets/openapi/people.json). ## People Search - [Search people](https://lempile.com/docs/people/reference/search): `POST /people/search` ## People Reveal - [Reveal people contact details](https://lempile.com/docs/people/reference/reveal): `POST /people/reveal` --- # People Search: Search people > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `POST https://api.lempile.com/people/search` Searches active, provenance-approved people snapshots. Platform admins may set `sample: true` to search synthetic admin sample records. This route requires `people.read`. ## Authentication Send your People Search API key in the `X-API-KEY` header. ## Request body `application/json` (required) - `person_countries` (array of string) - `person_locations` (array of string) - `job_titles` (array of string) - `seniorities` (array of string) - `company_domains` (array of string) - `company_employee_ranges` (array of EmployeeRange) - `min` (integer) - `max` (integer) - `company_industries` (array of string) - `email_statuses` (array of string) - `has_email` (boolean) - `has_photo` (boolean): true returns only people whose photo_url still works, false only the others. - `facets` (array of string) - `page` (integer): Default: `1`. - `per_page` (integer): Default: `25`. - `sample` (boolean): Platform-admin-only synthetic sample mode. ## Example request ```bash curl -sS -X POST "https://api.lempile.com/people/search" \ -H "X-API-KEY: $LEMPILE_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "person_countries": [ "string" ], "person_locations": [ "string" ], "job_titles": [ "string" ], "seniorities": [ "string" ], "company_domains": [ "string" ], "company_employee_ranges": [ { "min": 0, "max": 0 } ], "company_industries": [ "string" ], "email_statuses": [ "string" ], "has_email": false, "has_photo": false, "facets": [ "person_country" ], "page": 1, "per_page": 25, "sample": false }' ``` ## Responses ### 200 People search result. ```json { "object": "people_search_result", "total": 0, "page": 0, "per_page": 0, "has_more": false, "data": [ { "object": "person_search_record", "id": "string", "person_name": "string", "first_name": "string", "last_name": "string", "title": "string", "title_normalized": "string", "function_primary": "string", "seniority": "string", "linkedin_url": "string", "photo_url": "string", "location": {}, "company": {}, "contact": { "email_available": false, "email_status": "string", "email_confidence": 0, "phone_available": false, "phone_status": "string" }, "source": {} } ], "facets": {} } ``` ### 400 Invalid request body, filters, facets, or pagination. ```json { "error": "string", "message": "string" } ``` ### 401 Missing or invalid API key. ```json { "error": "string", "message": "string" } ``` ### 403 API key lacks `people.read`, or sample mode was requested by a non-admin key. ```json { "error": "string", "message": "string" } ``` --- # People Search: Reveal people contact details > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `POST https://api.lempile.com/people/reveal` Reveals raw contact details for an approved people record. This route requires `people.reveal`, reveal-approved source provenance, workspace credits, rate-limit clearance, and writes an audit event. Repeated reveals of the same contact by the same workspace are not charged again. ## Authentication Send your People Search API key in the `X-API-KEY` header. ## Request body `application/json` (required) - Option 1: any - Option 2: any ## Example request ```bash curl -sS -X POST "https://api.lempile.com/people/reveal" \ -H "X-API-KEY: $LEMPILE_API_KEY" \ -H "Content-Type: application/json" \ -d '{}' ``` ## Responses ### 200 People contact reveal result. ```json { "object": "people_contact", "record_id": "string", "source_record_id": "string", "charged": false, "remaining_credits": 0, "contact": { "email": "string", "email_status": "string", "email_confidence": 0, "phone": "string", "phone_status": "string" } } ``` ### 400 Invalid reveal request. ```json { "error": "string", "message": "string" } ``` ### 401 Missing or invalid API key. ```json { "error": "string", "message": "string" } ``` ### 402 Workspace has no People reveal credits available. ```json { "error": "string", "message": "string" } ``` ### 403 API key lacks `people.reveal`, or the source is not approved for reveal. ```json { "error": "string", "message": "string" } ``` ### 404 Contact record or requested contact field is not available. ```json { "error": "string", "message": "string" } ``` ### 429 People reveal rate limit exceeded. ```json { "error": "string", "message": "string" } ``` --- # Funding Events: Overview > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact Startup funding rounds as they are announced, each with the company's website. Lempile reads startup news and US SEC Form D filings every hour, keeps one event per company and round, and confirms each round from the publisher's own article or the filing before it is served. Early access, free. Ask for a key with the chat button or at support@lempile.com. ## Quick Start ```bash curl -sS "https://api.lempile.com/companies/funding-events?since=2026-11-01T00:00:00Z&round=seed,series_a&country=US,GB&has_domain=true&limit=100" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` The route requires the `companies.read` scope. ## Response ```json { "object": "list", "data": [ { "id": "6f1c2a4e-9b1d-4f0e-8a77-3c5d2e1f0a9b", "object": "funding_event", "company_name": "Midstream Health", "company_domain": "midstream.health", "domain_confidence": 0.9, "financing_type": "Series A", "financing_type_normalized": "series_a", "amount": "$20M", "amount_normalized": 20000000, "currency": "USD", "effective_date": "2026-11-06", "found_at": "2026-11-06T21:07:12.401Z", "investors": [], "country": "US", "categories": ["healthtech"], "source_urls": ["https://www.healthcareittoday.com/2026/11/06/midstream-health-raises-20m-series-a/"], "confirmed": true, "company": { "name": "Midstream Health", "domain": "midstream.health", "linkedin_url": null, "industry": null, "employee_count": null, "country": "US" } } ], "has_more": true, "next_cursor": "MjAyNi0xMS0wNlQyMTowNzoxMi40MDFafDZmMWM" } ``` - `id` is stable. When several articles report the same round, they become one event with every source and the earliest `found_at`. - `found_at` is when Lempile first saw the round; `effective_date` is the announcement or filing date. - `financing_type` is the round as announced; `financing_type_normalized` is one of `pre_seed`, `seed`, `series_a` to `series_h`, `growth`, `debt`, `grant` or `other`. SEC filings come in as `"Form D"` (`other`) until an article names the round. - `amount` and `currency` are as announced; `amount_normalized` is in US dollars at approximate rates, for filtering. - `company_domain` is the company's own website, checked by reading its homepage. It can arrive an hour or two after the event, so read with an overlapping window or use `has_domain=true`. - `company.linkedin_url`, `industry` and `employee_count` are empty for now. ## Parameters | Parameter | Default | Meaning | | --- | --- | --- | | `since` | 7 days ago | Events found at or after this time (ISO 8601). | | `until` | none | Events found before this time. | | `round` | all | Comma list of normalized round types. | | `country` | all | Comma list of ISO 3166-1 alpha-2 codes for the company's headquarters. Events without a known country never match. | | `has_domain` | `false` | `true` returns only events with a company website. | | `limit` | 100 | 1 to 500 events per page. | | `cursor` | none | `next_cursor` from the previous page. | Results are newest first. Follow `next_cursor` while `has_more` is `true`. ## Errors | Status | `error` | When | | --- | --- | --- | | 400 | `invalid_request` | A parameter is invalid; `message` names it. | | 401 | `unauthorized` | Missing or invalid API key. | | 402 | `subscription_required` | The workspace has no active trial or subscription. | | 403 | `forbidden` | The key lacks `companies.read`. | --- # Funding Events API reference > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact Base URL: `https://api.lempile.com`. Authentication: your API key in the `X-API-KEY` header. OpenAPI document: [funding-events.json](https://lempile.com/docs-assets/openapi/funding-events.json). ## Funding Events - [List funding events](https://lempile.com/docs/funding-events/reference/list): `GET /companies/funding-events` --- # Funding Events: List funding events > **Early access.** Tell us what you're building and we'll set you up: https://lempile.com/contact `GET https://api.lempile.com/companies/funding-events` Funding rounds found in a time window, newest `found_at` first, with cursor pagination. Requires `companies.read`. ## Authentication Send your Funding Events API key in the `X-API-KEY` header. ## Query parameters - `since` (string (date-time)): Events found at or after this time. Default: 7 days ago. - `until` (string (date-time)): Events found before this time. - `round` (string): Comma list of normalized round types, e.g. `seed,series_a`. - `country` (string): Comma list of ISO 3166-1 alpha-2 codes, e.g. `US,GB`. - `has_domain` (boolean): Only events with a company website. Default: `false`. - `limit` (integer): Default: `100`. - `cursor` (string): `next_cursor` from the previous page. ## Example request ```bash curl -sS "https://api.lempile.com/companies/funding-events" \ -H "X-API-KEY: $LEMPILE_API_KEY" ``` ## Responses ### 200 A page of funding events. ```json { "object": "list", "data": [ { "id": "00000000-0000-4000-8000-000000000000", "object": "funding_event", "company_name": "string", "company_domain": "string", "domain_confidence": 0, "financing_type": "string", "financing_type_normalized": "pre_seed", "amount": "string", "amount_normalized": 0, "currency": "string", "effective_date": "2026-10-29", "found_at": "2026-10-29T09:00:00Z", "investors": [ "string" ], "country": "string", "categories": [ "string" ], "source_urls": [ "https://example.com" ], "confirmed": false, "company": { "name": "string", "domain": "string", "linkedin_url": "string", "industry": "string", "employee_count": 0, "country": "string" } } ], "has_more": false, "next_cursor": "string" } ``` ### 400 A parameter is invalid; `message` names it. ```json { "error": "string", "message": "string" } ``` ### 401 Missing or invalid API key. ```json { "error": "string", "message": "string" } ``` ### 402 The workspace has no active trial or subscription. ```json { "error": "string", "message": "string" } ``` ### 403 The API key lacks `companies.read`. ```json { "error": "string", "message": "string" } ``` --- # Changelog > What changed in Lempile's APIs and in these docs, newest first. ## 2026-11-29 ### Instagram API, in early access - Instagram direct messages, profiles, followers, posts, comments and likes from your own connected Instagram accounts, on Unipile's v1 paths, fields and errors. Each account signs in once, in its own browser, behind its own IP. - Start with the [Overview](https://lempile.com/docs/instagram). [Unipile Compatibility](https://lempile.com/docs/instagram/unipile-compatibility) lists every Unipile route and what Lempile does with it. - Early access: write to support@lempile.com to open it for your workspace. ## 2026-11-15 ### X API: a reply with a video, and a reply's dry run - `POST /posts/{post_id}/comments` takes one MP4 in `attachments` (multipart), up to 50 MiB (52,428,800 bytes), as a post's video. The reply goes only once X shows the video ready; otherwise `422 errors/not_sent` (`media_upload_failed`, `media_upload_timeout`), nothing sent. - The video is part of the request's `Idempotency-Key`. Over 50 MiB: `413 errors/payload_too_large`; while other big files are being sent: `429 errors/files_busy` with `retry_at`. - A video on a LinkedIn comment is refused (`400`): LinkedIn's comment box takes one image. See [Replies](https://lempile.com/docs/x/replies#reply-with-a-video). - The answer's `media` is what X showed for the video; a reply out without it confirmed says `video_unconfirmed` in `warnings`. - `dry_run` on an X reply does everything but press Reply and answers `200` `CommentDryRun`, nothing sent. See [Dry run](https://lempile.com/docs/x/replies#dry-run). ## 2026-11-13 ### X API: big Article images and profile pictures travel safely - `POST /articles` and `PATCH /users/me/edit` read and send their images once, as `POST /posts` does since yesterday, so a big Article (up to 40 MiB of images) or picture no longer risks losing its HTTP answer. Limits are unchanged. - A body larger than any valid one is refused before it is read: over 60 MiB (62,914,560 bytes) for an Article, over 24 MiB (25,165,824 bytes) for a profile edit, `413 errors/payload_too_large`, nothing sent. - While other big files are being sent, either can get `429 errors/files_busy` with `retry_at`: nothing was sent; send it again then, same key. ## 2026-11-12 ### X API: big files travel safely again; pending writes settle by themselves - `POST /posts` takes files up to its limits again: 4 images of 8 MiB (8,388,608 bytes), or one video of 50 MiB (52,428,800 bytes). Files are read and sent once, so a big video no longer loses its HTTP answer while the post goes on. Over 50 MiB in all: `413 errors/payload_too_large`, nothing sent; its `detail` names the limit in bytes. - While another post's big files are being sent, a post with files can get `429 errors/files_busy` with `retry_at`: nothing was sent; send it again then, same key. - A write left `pending` (its HTTP answer lost) settles by itself within minutes from the browser's own answer: `done`, or `failed` when the browser never got it. See [Write Receipts](https://lempile.com/docs/x/write-receipts). ### X API: files over 10 MB on a post are refused, for now - `POST /posts` answers `413 errors/payload_too_large` when its files are over 10 MB in all (10,485,760 bytes), before the key is taken or anything is sent: a bigger file could lose its HTTP answer (`500 WorkerRequestCancelled`) while the post went on. The 50 MB video limit comes back once big files travel safely. - On any `5xx` from `POST /posts`, read `GET /writes/{key}` with the same key, or send again with the same key; never under a new one. See [Posts](https://lempile.com/docs/x/posts#create-a-post). ### X API: quote a post with files, and the Paid partnership label - `POST /posts` takes `quote`: the post to quote, as its id or its link. The browser uses X's own Quote (the post's Repost menu → Quote), so a quote carries `attachments`, and checks the quoted post is in the box before Post. The answer adds `quote: { post_id, confirmed }`. Not with `gif`. - `POST /posts` takes `paid_partnership: true`: X's own Paid partnership label on a sponsored post, a quote included. No label in X's post box, no post (`422 errors/not_sent`, `code: "paid_label_unavailable"`). The answer adds `paid_partnership: { shown, sent }`. - Files go only once X shows them ready: up to 3 minutes for a video, 40 seconds for images. New `code`s `media_upload_failed` and `media_upload_timeout`, nothing sent. - A dry run answers what the box showed: `quote`, `paid_partnership` and `media` (`ready_s`, `status`). - `quote`, `paid_partnership` and `dry_run` are X only, and part of the request's `Idempotency-Key`. - See [Posts](https://lempile.com/docs/x/posts#create-a-post). ### X API: posts confirm what was asked - A post that asked for `paid_partnership` or `quote` and went out without the browser confirming it answers `201` with `warnings` (`paid_label_unconfirmed`, `paid_label_not_sent`, `quote_unconfirmed`, `quote_not_confirmed`), never a plain success. A dry run in that case answers `502 errors/not_sent`. - `dry_run` takes `true` or `false` only: `"1"` or `"True"` is `400`, never a real post. - `quote` as a JSON number must be exact (X ids don't fit): send it as a string. - `paid_label_unavailable` says what X showed (its buttons and menus), and the label is checked again right before Post. - The label works in both of X's web apps: x-web (New Post → Content Disclosures → Paid Partnership) and the older one (the toolbar's Content disclosure → the Paid partnership switch → Done), confirmed by X's own switch state, also right before Post. - A dry run also checks that Post could be pressed (`post_button_disabled` otherwise). A duplicate refusal never answers as a labelled post or a quote (`duplicate_post`). - `paid_partnership` says which of X's two web apps the account was shown (`app`: `x-web` or `responsive-web`). Proven on a real post on Nov 12: the label shows on the live post. - Big files (over about 5 MB) can lose the HTTP answer (`500 WorkerRequestCancelled`) while the write goes on: read the receipt with the same key, never send again under a new one. ## 2026-11-08 ### Lempile Direct: light profile reads - `GET /users/{identifier}` takes `lempile_light=true`, Lempile's own parameter (not Unipile's): the profile's top card and the sections asked, without the second card and the contact info. A profile costs 1 LinkedIn call instead of 3, and 2 instead of 4 with `linkedin_sections=experience`. - A light answer leaves out `follower_count`, `connections_count`, `shared_connections_count`, `is_verified`, `websites`, `contact_info` and `birthdate`. Without the parameter, answers are unchanged. - See [Users And Profiles](https://lempile.com/docs/direct/users-and-profiles#light-reads-lempile-only). ## 2026-11-07 ### X API: whom an account follows, and unfollow - `GET /users/me/following?account_id=&limit=` (also `/users/following`): the accounts the X account follows, newest follow first, `limit` 1–1000 (default 100), read-only. The twin of `GET /users/followers`: `UserFollowingList` of `UserFollowing`. - `POST /users/follow` with `undo: true` unfollows: the profile's Following button, then X's Unfollow, answered `UserUnfollowed` once the profile shows its Follow button again (an account it doesn't follow answers `already: true` with nothing pressed). Same keys and receipts as a follow; an unfollow's fingerprint differs from the follow's. `undo` takes `true` or `false` only. - A LinkedIn account answers `501 errors/feature_not_implemented` on both, nothing changed. - [Rebrand An X Account](https://lempile.com/docs/x/rebrand) gets a step: unfollow what the old brand followed. ### X API: page capture, with public X posts and status pages - `POST /accounts/{account_id}/capture` is documented: a JPEG of one page from the X account's own browser, read-only (cookie banners and X's overlays hidden, never clicked). - It now opens public X posts, exactly `https://x.com//status/` with no query: the picture is the post alone, read from the account's own signed-in X, and only when X shows it under that handle. A post X shows under another author, a protected, deleted, age-gated or unavailable post gives no picture, with its own `code` (`x_post_author_mismatch`, `x_post_protected`, `x_post_deleted`, `x_post_age_restricted`, `x_post_unavailable`; `x_post_not_loaded` when X never showed it). An X post takes no `clip.selector`. - And the status pages of Vercel, GitHub, Supabase, Cloudflare, OpenAI, Claude, Netlify, Render, Fly.io, Clerk and Resend: the page itself or one incident's page (`/incidents/`). - New guide: [Page Capture](https://lempile.com/docs/x/page-capture). - An X post's picture is taken as the post shows on screen: the first ones came out white. It ends at the post's action bar, without X's sort row, and hides the author's Subscribe and Follow buttons. `x_post: { counts: false }` leaves out the time and views row and the action bar too, ending under the post's last content (`counts_not_hidden` when they can't be hidden: never a picture with counts). A picture that comes out blank, or a post X drew empty, is never returned: `ok: false` with `code: "capture_blank"`. ### X API: rebrand an account with the API alone - `PATCH /users/me/edit` changes the whole X profile, not only its website: `name`, `bio`, `location` (an empty one clears it), `website`, `avatar`, `banner` and `username` (the handle, with or without `@`). Pictures go as files in a multipart body or as JSON `{ name, content_type, data_base64 }`: a JPEG or PNG, at most 2 MB for the avatar and 5 MB for the header photo. Unipile's names work too (`picture`, `cover_picture`, `summary`, `custom_link`). `dry_run: true` reads every window and presses nothing. A website alone works and answers exactly as before. - The answer is `ProfileEdited` with `changed` (read back from X), `previous` and `already`. A refusal on the handle (`409 errors/username_taken`, `422 errors/username_field_not_found`, `403 errors/password_required`) carries what was saved before it in `done`. Pictures and a handle can take a few minutes: past 140 seconds the answer is `504` and the receipt (`GET /writes/{key}`) gets the result. - After a new handle, Lempile's record of the account follows in the same request (`GET /accounts` shows the new handle). - `GET /users/me?account_id=` on an X account: its profile as X shows it (name, handle, bio, location, website, pictures, `can_change_username`). - `POST /posts/repost` with `undo: true` takes the account's repost back (`PostUnreposted`; a post it hasn't reposted answers `already: true`). - `GET /users/me/posts?account_id=&kind=posts|replies|reposts`: the account's own posts, replies or reposts from its profile's tabs, newest first, with `in_reply_to` on a reply, `reposted_id` on a repost (what `undo` takes) and a `cursor` for the next page. - `dry_run` and `undo` take `true` or `false` only: anything else answers `400` instead of being read as `false`. - New guide: [Rebrand An X Account](https://lempile.com/docs/x/rebrand). ### X API: clearer answers, and three parameters that now work - A post or reply the browser refused before pressing Post or Reply still answers `422 errors/not_sent`, now with `code` naming why: `replies_limited`, `post_not_accepted`, `gif_not_found`, `browser_busy`… - `GET /posts/{post_id}/comments` on X: `sort_by=MOST_RECENT` (the default) puts replies newest first, `MOST_RELEVANT` keeps X's order, and `comment_id` reads that reply's replies. `POST /posts/reaction` on X likes the reply given as `comment_id`. - X lists come in one page: a `cursor` on X's replies or a profile's posts answers `400 errors/invalid_parameters` instead of the first page again. - `GET /writes/{key}` needs a key with `accounts.read` or `accounts.write`. - Answers shared by X and LinkedIn no longer name LinkedIn, and the daily limit says posts and replies, with when the account has room again. ### X API: documented - The X API has its own docs: [Overview](https://lempile.com/docs/x), [Posts](https://lempile.com/docs/x/posts), [Replies](https://lempile.com/docs/x/replies), [Likes, Reposts And Follows](https://lempile.com/docs/x/likes-reposts-and-follows), [Search And Reads](https://lempile.com/docs/x/search-and-reads), [Profile And Analytics](https://lempile.com/docs/x/profile-and-analytics), [Articles](https://lempile.com/docs/x/articles), [Write Receipts](https://lempile.com/docs/x/write-receipts) and [Errors And Limits](https://lempile.com/docs/x/errors-and-limits), with its OpenAPI reference. - `DELETE /posts/{post_id}` on X now opens the post's menu once it's in place, as pinning does: the first deletes had answered `422 errors/delete_unavailable` with nothing deleted. ## 2026-10-30 ### Lempile Direct: reposts read as Unipile's, and undone - A plain repost now reads as Unipile's `Post` on every read (a profile's posts, one post, the posts search): the reposted post (its `id`, `social_id`, `author`, text and counts) with `is_repost: true`, `reposted_by`, `repost_id` (the repost's own id), `repost_parsed_datetime` and `repost_content`. A repost with words is the reposter's own post, with `repost_content` the post it shares. - `DELETE /posts/{repost_id}` undoes the account's own plain repost, as LinkedIn's "Delete repost" does; the reposted post stays. ### Lempile Direct: Unipile's fields, side by side - `GET /users/{identifier}` answers what Unipile answers: `follower_count`, `connections_count`, `shared_connections_count`, `is_verified`, `connected_at`, `websites` and `contact_info` with every profile (three LinkedIn calls), pictures at Unipile's sizes, and an invitation's real direction and state (`RECEIVED` / `IGNORED`). - `GET /users/followers`: the account's followers, newest first. `GET /users/following` answers Unipile's own `501`. - Chats: `content_type: "linkedin_offer"` for the ads LinkedIn labels "LinkedIn Offer". - Company search: each company's `logo`, and no `object`, as Unipile's. - Comments: `author_details` and `network_distance` as Unipile's; a reply's `thread_id` is its parent comment. - `POST /chats` with `linkedin[inmail]=true` sends LinkedIn's Premium InMail as the web does. ### Lempile Direct: search, company pages, received invitations and message actions - `POST /linkedin/search` searches people (every Unipile filter: a company's employees with `company`), posts and jobs, besides companies, by Unipile's body, a LinkedIn search address (`url`) or `cursor` alone. `GET /linkedin/search/parameters` finds the ids the filters take. Sales Navigator and Recruiter answer `403 errors/feature_not_subscribed`. - `GET /linkedin/company/{identifier}`: a company page. `GET /users/{identifier}/comments` and `/reactions`: a member's comments and reactions. - `GET /users/invite/received` and `POST /users/invite/received/{invitation_id}` (accept or decline). - Messages: `POST` and `DELETE /messages/{message_id}/reaction`, `PATCH /messages/{message_id}` (an edit, within 60 minutes). Chats: `PATCH /chats/{chat_id}` (`setReadStatus`, `setMuteStatus`) and `DELETE /chats/{chat_id}`. - `POST /posts` takes `repost` (a plain repost, as a page, or with your words). `POST /linkedin` (Unipile's raw route) reads LinkedIn's API with the account's session; writes go through Direct's own routes. ### Lempile Direct: voice notes - `POST /chats/{chat_id}/messages` and `POST /chats` send LinkedIn voice notes (`voice_message`), as Unipile does. Any audio works (m4a, mp3, ogg, webm, wav, aac, flac): Direct turns it into LinkedIn's AAC .m4a. 60 seconds at most (`422 errors/invalid_message`); a file that isn't audio answers `415 errors/unsupported_media_type`. - Read back, a voice note is an attachment of `type: "audio"` with `voice_note: true` and its `duration`. - `DELETE /messages/{message_id}` deletes one of the account's own messages within 60 minutes of sending it, as Unipile does. ### Ask AI - **Ask AI** in the header, or ⌘I: ask a question in your own words and get an answer written from these docs, with links to the pages it comes from. Follow-up questions keep the conversation. - In search, the last row asks Ask AI your search. - Answers are written by AI, so check the linked pages before you build on them. Questions and answers aren't kept. ### The docs for AI tools - **Copy page** on every page: the page as Markdown, ready for an AI chat, or opened straight in ChatGPT or Claude. - Every page is plain Markdown at its own address plus `.md`, for example `https://lempile.com/docs/direct/quick-start.md`. - `https://lempile.com/llms.txt` lists every page; `https://lempile.com/llms-full.txt` has them all in one file. - An MCP server at `https://lempile.com/docs/mcp`: Cursor, VS Code, Claude Code or any MCP client can search these docs and read any page. Connect in one click from any page's menu. ## 2026-10-29 ### Docs on lempile.com/docs Every guide and API reference now lives at `https://lempile.com/docs`, built from the same Markdown and OpenAPI files as before. New: search across guides and endpoints, code samples in cURL, JavaScript and Python, and **Try it** on every endpoint, with your own API key. On Lempile Direct, writes are tried with `?dry_run=true` first. ### Lempile Direct - 13 guides and the full API reference: accounts and hosted auth, webhooks, profiles, relations and invitations, chats and messages, posts, comments and reactions, company search. - Keys belong to a workspace: a Direct key sees only its own workspace's accounts and webhooks. Another workspace's account answers like an unknown one. - A required parameter that's missing or of the wrong type answers Unipile's `400` (`errors/missing_parameters`, `errors/invalid_parameters`). - `GET /users/followers` and `GET /users/following` answer `501 errors/feature_not_implemented`. ## 2026-06-12 ### People Search `POST /people/search` documented: filters by country, location, job title, seniority, company domain, size and industry, with facets and contact availability. ## 2026-06-11 ### Email Finder Candidates are verified by Lempile's own verifier; the external verifier fallback is off by default. ## 2026-06-04 ### Email Finder `POST /email-finder` creates a job from LinkedIn profile URLs or ids; poll it, then read its items or download them as CSV. ## 2026-06-01 ### Google Search API New searches are queue-first: they answer `202 Accepted` with a `json_endpoint` to poll until `status` is `Success` or `Error`. Cached searches may still answer `200` at once.