# X Posts API. Pay per record.

> An X (Twitter) account's recent posts as JSON: text, views, likes, reposts, replies and quotes. From $0.000225 per post.

Canonical: https://apiforagents.dev/platforms/x_twitter/posts-api · Updated 2026-10-21

Get one X (Twitter) account's recent posts with engagement: the text, when it was posted, views, likes, reposts, replies and quotes, plus what each post replied to or quoted. The author's card comes in the same answer when we hold it.

- Price: $0.000225 / post
- Billed: Per record
- Free to start: $0.10
- Endpoint: POST /v1/x_twitter

## What people build with the X Posts API

- **Monitor accounts.** Follow a list of founders, analysts or competitors and see what they posted and how it did.
- **Personalise outreach.** Read what a prospect posted this week and open with something they actually said.
- **Feed an agent.** Give your agent an account's last fifty posts before it writes about that person or company.

## Quote it, then run it

1. free quote: the exact price, nothing charged:

```bash
curl -X POST https://apiforagents.dev/v1/x_twitter \
  -H "Authorization: Bearer $AFA_KEY" \
  -H "Content-Type: application/json" \
  -d '{"op":"posts","subject":"@NASA","limit":20,"estimateOnly":true}'
```

2. the same call, run:

```bash
curl -X POST https://apiforagents.dev/v1/x_twitter \
  -H "Authorization: Bearer $AFA_KEY" \
  -H "Content-Type: application/json" \
  -d '{"op":"posts","subject":"@NASA","limit":20}'
```

## Inputs

Everything you can send in one posts call. Required inputs first.

| Input | Type | What it does |
|---|---|---|
| subject * | string | One @handle or profile URL. ≤400 chars |
| limit | integer | 1-50 |

## What comes back

The fields of every row, always present. Nothing is guessed: a value that could not be measured is null, and the answer's coverage says why.

| Field | Type |
|---|---|
| postId | string |
| body | string |
| kind | string |
| postedAt | string |
| permalink | string |
| language | string |
| mediaUrl | string |
| likes | integer |
| replies | integer |
| reposts | integer |
| quotes | integer |
| views | integer |
| bookmarks | integer |
| isReply | boolean |
| isQuote | boolean |
| isPinned | boolean |
| replyToHandle | string |
| quotedPostUrl | string |
| repostedPostUrl | string |
| hashtags | list of string |
| mentions | list of string |
| authorUsername | string |
| authorId | string |
| author | object |
| conversationId | string |
| media | list of object |
| outboundLinks | list of string |
| details | object |

details is always the last field: everything else the source sent for that row, under our own field names. Its keys depend on the source that answered, so read them defensively; it is {} when there is nothing more.

## A sample answer

Made-up names and values in the real field names, so you can see the shape before you spend anything.

| authorUsername | body | kind | postedAt | views | likes |
|---|---|---|---|---|---|
| northfoldhq | Month-end close in 2 days, not 10. Here's how teams do it ↓ | post | 2026-10-14T13:00:00Z | 84200 | 1210 |
| northfoldhq | We're at Finance Leaders London next week. Come say hi! | post | 2026-10-10T09:00:00Z | 12100 | 140 |
| northfoldhq | @kitebank thanks for having us on the panel! | reply | 2026-10-08T17:30:00Z | 3200 | 48 |

## Pricing

Pay as you go, in US dollars, per record. No subscription, nothing expires, $5 first top-up, and every new agent starts with $0.10 free.

| Request | Records | At the list price |
|---|---|---|
| One post | 1 | $0.000225 |
| 10 posts | 10 | $0.0022 |
| A full page | 50 | $0.011 |

These are per-record list prices. Some calls also carry a minimum, such as a page of search results, so a small request can cost more than the table shows. The quote ("estimateOnly": true) is free, gives the most your exact request can cost, and the charge then settles to what came back. Records that do not come back are refunded.

## Try it without writing code

- [Open the X Posts API in the playground](https://apiforagents.dev/dashboard/run?platform=x_twitter&op=posts): The playground runs any endpoint by hand: pick a platform and what you want from it, fill a short form named in plain words (or press Use sample input), see the free quote on the Run button, run it, then read the answer as a table or JSON and download it as CSV or JSON. The same call is written out as cURL, Python and Node while you type.

## Why this one, and not a scraper you run yourself

- No login, no X / Twitter account, no cookies, no proxies, no browser to babysit.
- When the site changes its pages, your request stays the same: keeping the reads working is our job, not yours.
- A fetch that fails costs nothing: it is named in the answer with a reason, and the quote says the most a call can cost before it runs.

## Use it from your tools

- [X / Twitter in n8n](https://apiforagents.dev/integrations/n8n/x_twitter)
- [X / Twitter in Make](https://apiforagents.dev/integrations/make/x_twitter)
- [X / Twitter in Zapier](https://apiforagents.dev/integrations/zapier/x_twitter)
- [X / Twitter in Python](https://apiforagents.dev/integrations/python/x_twitter)
- [X / Twitter in LangChain](https://apiforagents.dev/integrations/langchain/x_twitter)
- [X / Twitter in Claude Code](https://apiforagents.dev/integrations/claude-code/x_twitter)

## Questions

### What does the X Posts API return?

One row per post: author username, text, kind, posted time, views, likes, reposts, replies, quotes, whether it is a reply and to whom, whether it is a quote or pinned, the quoted or reposted post URL, post id, permalink, media URL and author id.

### What do I pass in?

One @handle or profile URL in subject and a limit from 1 to 50.

### How much does it cost?

$0.000225 per post at the list price. A small call can carry a minimum, so quote first with "estimateOnly": true, which is free and is the most the call can cost. You pay for what comes back.

## Why API for Agents

- One key for 26 platforms: social, commerce, jobs, places, search and contacts, with one request shape and one response shape.
- A free quote before any spend: add "estimateOnly": true to any call and see the most it can cost.
- Pay per record in US dollars. No subscription, nothing expires, top-ups from $5.
- $0.10 free to try, no card. An AI agent can sign itself up in one request; a person claims it later.
- Measured, not estimated: every answer says when each row was measured, whether it was fresh or a recent capture, and how sure to be of each field.
- Partial success is success: anything that could not be fetched is named with a reason, and the charge settles to what came back, never above the quote.
- Typed fields that keep their names whichever source answered, and a details object last with everything else the source sent, under our own field names.
- Try any endpoint in the playground and download the answer as CSV or JSON.

## Start

The playground runs any endpoint by hand: pick a platform and what you want from it, fill a short form named in plain words (or press Use sample input), see the free quote on the Run button, run it, then read the answer as a table or JSON and download it as CSV or JSON. The same call is written out as cURL, Python and Node while you type. Open it at https://apiforagents.dev/dashboard/run?platform=x_twitter&op=posts (sign in first).

Agents register at https://apiforagents.dev/auth.md (one POST, $0.10 free). People: https://apiforagents.dev/docs#start. Prices: https://apiforagents.dev/pricing.md
