SerpBase
Back to Blog

X (Twitter) Post API: Get a Post's Text and Author by ID as JSON

Look up one X post by its ID and get the text, author name, username and link as JSON. Tested on two posts and one missing ID, with a script for a list of links.

November 28, 2026
By SerpBase Team3 min read

Short answer: send a post ID to /x/post and you get that X (Twitter) post back as JSON — the text, the author's name and username, and the canonical link. It is a lookup of one post by ID. It is not keyword search, a timeline export or a stream.

The request

curl -X POST 'https://api.serpbase.dev/x/post' \
  -H 'Content-Type: application/json' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -d '{"id":"20"}'

The ID is the number at the end of a post's address: https://x.com/jack/status/20 has ID 20.

What comes back

We ran these on 28 November 2026.

ID 20. post.text was just setting up my twttr, post.author.name jack, post.author.username jack, and post.link https://x.com/jack/status/20. credits_charged was 1.

ID 1585841080431321088. post.text was the bird is freed, author name Elon Musk, username elonmusk, link https://x.com/elonmusk/status/1585841080431321088.

ID 1, which is not a post. status 1502 with error upstream service error, and credits_charged 0.

{
  "status": 0,
  "credits_charged": 1,
  "product_id": "x_post",
  "action": "post",
  "source": "x",
  "url": "https://x.com/jack/status/20",
  "post": {
    "id": "20",
    "text": "just setting up my twttr",
    "link": "https://x.com/jack/status/20",
    "author": {
      "name": "jack",
      "username": "jack",
      "link": "https://x.com/jack"
    }
  }
}
FieldWhat it holds
post.idThe post ID you sent
post.textThe text of the post
post.linkCanonical address, with the author's username in it
post.author.nameDisplay name
post.author.usernameHandle, without the @
post.author.linkThe author's profile address

Python: turn a list of post links into text

import re, time, requests

LINKS = [
    "https://x.com/jack/status/20",
    "https://x.com/elonmusk/status/1585841080431321088",
]

for link in LINKS:
    post_id = re.search(r"/status/(\d+)", link).group(1)
    r = requests.post(
        "https://api.serpbase.dev/x/post",
        headers={"X-API-Key": "YOUR_API_KEY"},
        json={"id": post_id},
        timeout=60,
    ).json()
    if r["status"] != 0:
        print(post_id, "failed:", r.get("error"))
        continue
    p = r["post"]
    print("@" + p["author"]["username"], "|", p["text"])
    time.sleep(1)

Things that trip people up

  • You only need the ID. The username in the address is not sent; the answer tells you who wrote the post.
  • Both posts in our test came back with text and author only. No like, repost or view counts, no post date and no media fields were in the answers. If you need engagement numbers, this endpoint did not give them on the day we tested.
  • A wrong ID does not come back as "not found". ID 1 returned status 1502, the same code as a temporary read failure. Retry once or twice; if the same ID keeps failing, treat it as missing or deleted.
  • It is one post per request. There is no batch parameter. Loop over your IDs and keep to your account's requests per second.
  • link and url carry the same address. Read one of them.

What people use it for

Checking that a post quoted in an article still exists, pulling the text of posts collected from search results, and attaching the author's handle to a list of post links. For finding posts by keyword on other platforms, see the TikTok search endpoint.

Cost and limits

Each lookup costs 1 credit; failed requests are not charged. The response is always HTTP 200 with a status field: 0 means success, anything else comes with an error string. Credits cost $0.25–$0.50 per 1,000 depending on the plan, and new accounts get 500 free credits without a card.