Skip to content
Docs

Overview

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.

Early access. Tell us what you're building and we'll set you up. Contact us

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#

Shell
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.
  • 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.
  • Repeats change nothing. Liking, reposting or following 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 POST /posts, GET /posts/{post_id}, DELETE /posts/{post_id}, GET /posts/gifs, pin and unpin
Replies POST and GET /posts/{post_id}/comments
Likes, Reposts And Follows POST /posts/reaction, POST /posts/repost (and its undo), POST /users/follow, likers, followers
Search And Reads GET /posts/search, GET /users/{identifier}/posts, GET /users/me/posts
Profile And Analytics PATCH /users/me/edit, GET /users/me, GET /accounts/{account_id}/analytics
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 a whole rebrand, step by step
Articles POST /articles, GET /articles/{key}
Write Receipts GET /writes/{key}, POST /writes/{key}/not-sent
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.

Was this page helpful?