Skip to content
Docs

Replies

Reply under an X post or a reply, find the post in the account's feed first, and read a post's replies.

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

Reply To A Post#

POST /posts/{post_id}/comments (accounts.write, Idempotency-Key required):

Shell
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:

Shell
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 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" }] }

Was this page helpful?