Create a post
Early access. Tell us what you're building and we'll set you up. Contact us
api.lempile.com/postsPosts 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
X-API-KEY header·A Lempile API key, made in the dashboard under Access tokens.Headers
Idempotency-Keystringrequired1–200 characters of
A-Z a-z 0-9 . _ : -. The same key with the same request replays the first answer; see Write receipts.≤ 200 chars
Request body
account_idstringrequiredThe X account (also accepted as
?account_id=).textstringrequiredThe 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.≤ 3000 charsattachmentsarray of string · binaryMultipart 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.gifstringA GIF from X's own GIF search, as JSON
{"query": "...", "url": "..."}(a string in a form field):query2–40 letters, digits, spaces,'or-;urla result fromGET /posts/gifs. Not with attachments.quotestringThe post this one quotes: its id or its link (
https://x.com/<handle>/status/<id>, twitter.com too). Made with X's own Quote, so it can carry attachments. Not withgif. X only.paid_partnershipbooleanX'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_runbooleanDoes everything but press Post: answers
200 PostDryRunwith what the box showed (quote,paid_partnership,media), nothing is posted.trueorfalseonly.
account_idstringrequiredThe X account (also accepted as
?account_id=).textstringrequiredThe 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.≤ 3000 charsgifstringA GIF from X's own GIF search, as JSON
{"query": "...", "url": "..."}(a string in a form field):query2–40 letters, digits, spaces,'or-;urla result fromGET /posts/gifs. Not with attachments.quotestringThe post this one quotes: its id or its link (
https://x.com/<handle>/status/<id>, twitter.com too). Made with X's own Quote, so it can carry attachments. Not withgif. X only.paid_partnershipbooleanX'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_runbooleanDoes everything but press Post: answers
200 PostDryRunwith what the box showed (quote,paid_partnership,media), nothing is posted.trueorfalseonly.
Responses
200Dry run: everything but the Post button.
›
application/json
objectanyAlwaysPostDryRunprovideranyAlwaysXnot_sentanyAlwaystruegifobjectquoteobject›Show fieldsHide fields
post_idstringauthorstringshownanyAlwaystrue
paid_partnershipobject›Show fieldsHide fields
shownanyAlwaystrueappstringOne ofx-webresponsive-web
mediaobjectWith files: how long X took to show them ready, and X's own words.
›Show fieldsHide fields
ready_snumberstatusstring
201Posted.
›
application/json
objectanyAlwaysPostCreatedprovideranyAlwaysXpost_idstringquoteobjectWith
quote: the quoted post's id, andconfirmed(true when X's own answer names it, false when another, null when it didn't say).›Show fieldsHide fields
post_idstringconfirmedboolean | null
paid_partnershipobjectWith
paid_partnership: the label was on in the box;sentis true when X's own request carried it, null when unreadable.›Show fieldsHide fields
shownanyAlwaystruesentboolean | nullappstringWhich of X's two web apps the account was shown.
One ofx-webresponsive-web
warningsarray of stringOnly when something asked for isn't confirmed on a post that went out:
paid_label_unconfirmed,paid_label_not_sent,quote_unconfirmed,quote_not_confirmed, each followed by a sentence. Check the post on X.
400errors/missing_parameters, errors/invalid_parameters, errors/missing_idempotency_key or errors/invalid_idempotency_key.
›
errors/missing_parameters, errors/invalid_parameters, errors/missing_idempotency_key or errors/invalid_idempotency_key.application/problem+json
typestringrequiredtitlestringstatusintegerrequireddetailstringretry_atstring · date-timecodestringThe browser's own reason, when it refused before the click:
replies_limited,post_not_accepted,gif_not_found,browser_busy…
401Missing or invalid API key ({error, message}), errors/disconnected_account, or errors/reauth_required when X is signed out in the account's browser.
›
{error, message}), errors/disconnected_account, or errors/reauth_required when X is signed out in the account's browser.application/problem+json
typestringrequiredtitlestringstatusintegerrequireddetailstringretry_atstring · date-timecodestringThe browser's own reason, when it refused before the click:
replies_limited,post_not_accepted,gif_not_found,browser_busy…
402subscription_required: the workspace has no active trial or subscription.
›
subscription_required: the workspace has no active trial or subscription.application/problem+json
typestringrequiredtitlestringstatusintegerrequireddetailstringretry_atstring · date-timecodestringThe browser's own reason, when it refused before the click:
replies_limited,post_not_accepted,gif_not_found,browser_busy…
404errors/resource_not_found: no such account in this workspace, or it isn't an X account.
›
errors/resource_not_found: no such account in this workspace, or it isn't an X account.application/problem+json
typestringrequiredtitlestringstatusintegerrequireddetailstringretry_atstring · date-timecodestringThe browser's own reason, when it refused before the click:
replies_limited,post_not_accepted,gif_not_found,browser_busy…
409errors/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.
›
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.application/problem+json
typestringrequiredtitlestringstatusintegerrequireddetailstringretry_atstring · date-timecodestringThe browser's own reason, when it refused before the click:
replies_limited,post_not_accepted,gif_not_found,browser_busy…
413errors/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.
›
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.application/problem+json
typestringrequiredtitlestringstatusintegerrequireddetailstringretry_atstring · date-timecodestringThe browser's own reason, when it refused before the click:
replies_limited,post_not_accepted,gif_not_found,browser_busy…
422errors/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.
›
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.application/problem+json
typestringrequiredtitlestringstatusintegerrequireddetailstringretry_atstring · date-timecodestringThe browser's own reason, when it refused before the click:
replies_limited,post_not_accepted,gif_not_found,browser_busy…
423errors/x_account_locked: X shows the account its lock page (x.com/account/access). Nothing was done; someone has to pass X's check.
›
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.application/problem+json
typestringrequiredtitlestringstatusintegerrequireddetailstringretry_atstring · date-timecodestringThe browser's own reason, when it refused before the click:
replies_limited,post_not_accepted,gif_not_found,browser_busy…
429errors/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.
›
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.application/problem+json
typestringrequiredtitlestringstatusintegerrequireddetailstringretry_atstring · date-timecodestringThe browser's own reason, when it refused before the click:
replies_limited,post_not_accepted,gif_not_found,browser_busy…
503errors/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.
›
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.application/problem+json
typestringrequiredtitlestringstatusintegerrequireddetailstringretry_atstring · date-timecodestringThe browser's own reason, when it refused before the click:
replies_limited,post_not_accepted,gif_not_found,browser_busy…
504errors/timeout: Post was pressed but X didn't confirm in time. Read the receipt before sending again.
›
errors/timeout: Post was pressed but X didn't confirm in time. Read the receipt before sending again.application/problem+json
typestringrequiredtitlestringstatusintegerrequireddetailstringretry_atstring · date-timecodestringThe browser's own reason, when it refused before the click:
replies_limited,post_not_accepted,gif_not_found,browser_busy…
Was this page helpful?