# X (Twitter) Posts by user API (twitter.user_posts)

- Canonical page: https://everyinfra.com/en/twitter-api/user_posts
- Endpoint: POST https://api.everyinfra.com/api/v1/social with {"platform": "twitter", "action": "user_posts", "params": {...}}
- Price: $0.000556 per call ($0.56 per 1,000 requests); failed calls and empty results are not charged
- Returns: list, default 20, max 200 per call
- Mode: sync; add "mode": "async" for slow tasks

X (Twitter) Posts by user reads what one X account has posted publicly, given the account's handle in `username`. For each post you get the text in full, its link and ID, the like, repost, reply and view counts, when it was published, and the author's handle, display name, profile link and follower count. Communications teams, researchers and analysts use it to see what an account has been saying and which posts landed: following a public figure's or brand's statements, benchmarking engagement against competitors, or archiving an account's output for later analysis.

Name the account by its handle, with or without the @, not by its profile link. `retweet_count` counts reposts and `reply_count` counts replies, and together with `like_count` they are the engagement measures to compare. `posted_at` is an ISO 8601 time in UTC; parse it defensively, since a non-standard string from the platform is passed through as is.

## Health

- Live health (24h percent, hourly and daily trends): https://api.everyinfra.com/api/v1/social/availability?platform=twitter&action=user_posts

## Parameters

| name | type | required | default | description |
|---|---|---|---|---|
| username | not declared | yes | not declared | X username, optionally prefixed with @, without entering a full profile URL. profile compiles data from author details within recent posts; followers_list and following_list retrieve visible followers and following accounts respectively. |
| limit | integer (1–200) | no | 20 | The most rows to return in this call, an integer from 1 to 200. The default applies when you leave it out, and a call can return fewer rows. Larger values return 422 before any charge. |

## Response fields (items in `results`)

| field | meaning |
|---|---|
| id | The record's unique ID on the platform. Unique only within one platform; IDs can repeat across platforms. |
| url | Link to the record on the platform. |
| text | Body text with HTML removed, returned in full and never cut short (on a few platforms the list results themselves carry only an excerpt; the platform's field notes say so). |
| like_count | Likes. null means the platform or this capability does not disclose it; it is not 0. |
| retweet_count | platform-native meaning |
| reply_count | Replies, usually replies to a comment. null means not disclosed. |
| view_count | Views or plays. null means not disclosed, not 0. |
| posted_at | Publish time in ISO 8601, UTC (for example 2026-08-07T12:34:56+00:00). Non-standard strings from the platform are passed through as is, so parse defensively. null means the platform does not disclose it. |
| author_username | Author's username (@handle), usually usable in URLs. |
| author_name | Author's display name. |
| author_url | Link to the author's profile on the platform. |
| author_follower_count | Author's follower count. null means not disclosed. |
| quote_count | platform-native meaning |
| bookmark_count | platform-native meaning |
| language | Content language code (for example zh, en) as judged by the platform; it can be wrong. |
| conversation_id | platform-native meaning |
| is_reply | platform-native meaning |
| is_quote | platform-native meaning |
| is_repost | platform-native meaning |
| is_pinned | platform-native meaning |
| reply_to_id | platform-native meaning |
| reply_to_user_id | platform-native meaning |
| reply_to | platform-native meaning |
| source | platform-native meaning |
| media | platform-native meaning |
| hashtags | Hashtags in the text, in order of appearance; absent when there are none. |
| mentions | platform-native meaning |
| links | platform-native meaning |
| author_id | Author's unique ID on the platform. |
| author_avatar_url | platform-native meaning |
| author_bio | platform-native meaning |
| author_is_verified | platform-native meaning |
| author_following_count | platform-native meaning |
| author_post_count | platform-native meaning |
| author_media_count | platform-native meaning |
| author_created_at | platform-native meaning |
| author_banner_url | platform-native meaning |
| platform | Source platform identifier, the same as platform in the request (for example xiaohongshu, tiktok). |

## Example

```bash
curl -X POST 'https://api.everyinfra.com/api/v1/social' \
  -H "Authorization: Bearer $EVERYINFRA_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "platform": "twitter",
  "action": "user_posts",
  "params": {
    "username": "nasa"
  }
}'
```

```python
import os
import requests

response = requests.post(
    "https://api.everyinfra.com/api/v1/social",
    headers={"Authorization": f"Bearer {os.environ['EVERYINFRA_API_KEY']}"},
    json={
        "platform": "twitter",
        "action": "user_posts",
        "params": {
            "username": "nasa",
        },
    },
    timeout=120,
)
print(response.status_code)
print(response.json())
```

## Response example

Real response to the example request above, captured 2026-09-26T08:56:04Z. `results` and `count` are real with personal information (names, handles, avatars, profile links, contact details) removed; the list keeps the first 2 of 20. `id`, `billing` and `quota` differ on every call, so only their shape is shown.

```text
{
  "id": "req_…",
  "platform": "twitter",
  "action": "user_posts",
  "results": [
    {
      "id": "•••",
      "url": "https://x.com/NASA/status/2103610284464316469",
      "text": "With @•••, we’ll provide an update on Starliner development and plans for regular crew flights to and from the @••• Watch live Monday, Sept. 28 at 3pm ET: https://t.co/bxg2gpZzog https://t.co/OJaD49OyHh",
      "like_count": 2460,
      "retweet_count": 312,
      "reply_count": 119,
      "view_count": 558723,
      "posted_at": "Fri Sep 25 22:19:09 +0000 2026",
      "author_username": "NASA",
      "author_name": "NASA",
      "author_url": "https://x.com/•••",
      "author_follower_count": 92375074,
      "platform": "twitter"
    },
    {
      "id": "•••",
      "url": "https://x.com/NASA/status/2103589735449141451",
      "text": "@••• 🤭",
      "like_count": 61,
      "retweet_count": 1,
      "reply_count": 7,
      "view_count": 5641,
      "posted_at": "Fri Sep 25 20:57:30 +0000 2026",
      "author_username": "NASA",
      "author_name": "NASA",
      "author_url": "https://x.com/•••",
      "author_follower_count": 92375074,
      "platform": "twitter"
    }
  ],
  "count": 20,
  "billing": {
    "charged": …,
    "charged_usd": …,
    "balance_after_usd": …,
    …
  },
  "quota": { … }
}
```

## FAQ

### Why is `view_count` null on some posts?

Null means the view count was not disclosed for that post; it does not mean nobody saw it. Compare such posts on `like_count`, `retweet_count` and `reply_count` instead, and keep them out of any average of views so the missing values do not distort it.

### How do I read the replies to one of these posts?

Take the number after /status/ in the row's `url` and pass it as the post ID to the X (Twitter) Comments capability, which lists the replies under that post. Keep the ID as text: X post IDs are longer than JavaScript numbers can hold exactly, so converting one to a number changes it.

### How do I compare engagement between accounts of different sizes?

Divide `like_count`, `retweet_count` and `reply_count` by `author_follower_count` to get engagement per follower, which puts a large and a small account on the same scale. Store the follower figure with each batch rather than reusing an old one, since audiences change between calls.

## Also

- Capability catalog (no key): https://api.everyinfra.com/api/v1/social/catalog?platform=twitter
- OpenAPI: https://everyinfra.com/openapi.json · Agents guide: https://everyinfra.com/agents.md
