Social media5 min readBy Purrkey teamUpdated

How to fetch an X post's text and engagement by URL

Fetch one X post by URL and return its full text, author, timestamp, media, and engagement counts for evidence-backed analysis

On this page

You have 12 X post URLs from a campaign and need the text, author, timestamp and engagement counts for each post in one table. Use anyapi.twitter.tweet once per URL, then compare the rows to decide which posts to quote, reply to or retire from the content calendar

The worksheet below is the deliverable. No run has been executed for this guide. Values here are placeholders showing the shape

Example input and worksheet design

Example URL: https://x.com/NASA/status/1732824684683784517. Replace it with the canonical URL for the post you need. The contract accepts x.com or twitter.com status URLs with a numeric tweet ID, including /i/web/status and media-share variants

One row per post. If a post has more than one media item, add a child row for each item and repeat id. The reader-added Post URL column keeps the source link beside the returned fields

Post URL (reader-added)idtextauthorHandleauthorNameauthorVerifiedcreatedUtclikesretweetsrepliesquotesbookmarksviewsmedia.typemedia.urlmedia.videoUrlmedia.widthmedia.height
Example URL1732824684683784517Example post text@example_handleExample Nametrue1700000000120186249000photohttps://pbs.twimg.com/example.jpgempty for photo1200800

The row above is a design placeholder, not a result from a call. Keep createdUtc as Unix seconds in the raw table, then format it for reading

Input fields and the lookup step

The required field is url. It takes the canonical x.com or twitter.com status URL with a numeric tweet ID. The optional requireFields array accepts only height, videoUrl and width. Omit it and routing is unchanged, with the cheapest source serving. Name a field only when your table must include that media value. When the cheapest source cannot return a named field, a dearer source serves, and you are quoted and charged its price. A named field can still be absent on a tweet that genuinely lacks it. Naming a combination that no single source returns together is refused as invalid input, with no charge

anyapi.twitter.tweet is called through POST /v1/runs with toolId anyapi.twitter.tweet. Make one call per URL in the campaign list

A response where found is false is a successful call, not an error, and is still billed. When a URL has no result, data is null and reason is not_found. Keep that row in the worksheet with the reason, because the lookup still consumes a call

How to read the output fields

Read found first. When it is true, data holds the post object. Use id to match the row to the URL and text for the quote decision. Attribution comes from authorHandle, authorName and authorVerified, with authorId available if you need the stable account id. createdUtc is a UTC epoch timestamp in seconds, so multiply by 1000 for a JavaScript Date in milliseconds

The engagement counts are likes, retweets, replies, quotes, bookmarks and views. Treat views with care: null means X does not report a view count for that tweet, while 0 means the tweet has no views. Compare counts across the 12 rows to sort posts into quote, reply or retire. The tool supplies the counts; your campaign thresholds decide the cutoff

media is an array, empty when the post has none. Each item has type, url, and for video or gif items a videoUrl. The url is the image URL, or the poster thumbnail for a video or GIF. width and height are pixel sizes when the lane reports them. videoUrl is present only for video and gif items. The contract also returns authorImage, conversationId, inReplyToId and lang; leave those out of the first worksheet unless a review needs them

The agent prompt

Agent prompt
Set up https://purrkey.app/SKILL.md, then use Purrkey to fetch text and engagement for the X post URLs below. Check the current inputs and price of anyapi.twitter.tweet before running anything. Call the tool once per URL. Return a table with Post URL, id, text, authorHandle, authorName, authorVerified, createdUtc, likes, retweets, replies, quotes, bookmarks, views, media.type, media.url, media.videoUrl, media.width and media.height. If the table must include media width, height or videoUrl, set requireFields to the named fields you need; otherwise omit requireFields. Do not guess values. If found is false, keep the row and record reason. Do not schedule, publish or send any reply.

https://x.com/NASA/status/1732824684683784517

Replace the example URL with your own campaign URLs. Run one URL first to confirm the column shape before you spend 12 calls

Estimated tool cost

Prices read through the Purrkey catalog on November 13, 2026. The unit is max_call: "Maximum per call. Successful runs settle at the actual AnyAPI charge." The totals below are ceilings, not settled charges. Agent model fees are not counted

StepFormulaUnit pricePlanned quantityTotal
One post lookup1 call x max priceup to $0.0012 per call1$0.0012
Twelve post lookups12 calls x max priceup to $0.0012 per call12$0.0144

The 12-call plan is at most $0.0144. A first run of one URL is at most $0.0012

Next action

Open the X post tool to check the current inputs and price, then run your first URL

Get started by giving this to your agent

  • Claude Code
  • Codex
  • Gemini CLI
  • Cursor
  • GitHub Copilot
Set up https://purrkey.app/SKILL.md, then use Purrkey to show me what I can do with X (Twitter).
Explore X (Twitter) tools and pricing

FAQ

How do I fetch an X post's text and engagement by URL?

Call anyapi.twitter.tweet once per post URL. The response returns text, author fields, createdUtc and the engagement counts for that post.

What inputs does anyapi.twitter.tweet take?

It requires url, a canonical x.com or twitter.com status URL with a numeric tweet ID. The optional requireFields array accepts height, videoUrl or width when the table must include those media fields.

What does a found:false answer mean?

A found:false answer is a successful call, not an error, and is still billed. data is null and reason is not_found.

How much does it cost to fetch 12 X posts?

At up to $0.0012 per call, 12 lookups cost at most $0.0144. A single lookup costs at most $0.0012, and successful runs settle at the actual AnyAPI charge.

Which output fields drive the quote, reply or retire decision?

Use text, authorHandle, authorName, authorVerified, createdUtc, likes, retweets, replies, quotes, bookmarks and views. The media array adds media.type, media.url, media.videoUrl, media.width and media.height.

What does views null mean?

views is null when X does not report a view count for the tweet. Null is distinct from 0, which means the tweet has no views.

Do media width, height and videoUrl always come back?

A named field can still be absent on a tweet that genuinely lacks it. videoUrl is present only for video and gif media items, while width and height are reported when the serving lane has them.

Next step

Try this with X (Twitter)

The tool directory lists every endpoint with its current price. Inspect the inputs there, then let your agent run a small batch before scaling up.

See X (Twitter) tools

Share this article