# X (Twitter) inbox API

PubNio's X (Twitter) inbox reads direct messages, replies to the account's posts, and posts that mention it. It syncs them from webhooks only and reports, but does not enforce, a 30-day DM window (provider rules checked 2026-12-05).

## What the inbox reads

| Channel | Read | Writes | Attachments | Sync |
| --- | --- | --- | --- | --- |
| Direct messages | [Yes](https://pubnio.com/docs/reference/inbox-conversations-list/) | [send](https://pubnio.com/docs/reference/inbox-messages-send/) | No | Webhook only |
| Comments | [Yes](https://pubnio.com/docs/reference/inbox-comments-list/) | [reply](https://pubnio.com/docs/reference/inbox-comments-reply/), [hide, unhide](https://pubnio.com/docs/reference/inbox-comments-moderate/), [like, unlike](https://pubnio.com/docs/reference/inbox-comments-moderate/), [delete](https://pubnio.com/docs/reference/inbox-comments-delete/) | Yes | Webhook only |
| Mentions | [Yes](https://pubnio.com/docs/reference/inbox-mentions-list/) | [reply](https://pubnio.com/docs/reference/inbox-mentions-reply/) | No | Webhook only |

- Everything arrives as X Activity API events: `dm.received`, `dm.sent`, `dm.read`, `post.reply.create`, and `post.mention.create`. Replies are filed as comments in a thread for the conversation's first post.
- Encrypted XChat messages are separate X events PubNio does not subscribe to, so they never reach the inbox.
- The inbox needs a plan with X reads: Pro, Platform, or Enterprise. On any other plan every channel reports `unavailable` with reason `plan_required` and action `upgrade_plan`, and keeps only list and read.

## Reply window

Policy `x_dm_30_days`. The capabilities response names it; a conversation reports when it ends.

- A conversation's `replyWindow.endsAt` is 30 days after the last inbound message, but `open` stays `true`: PubNio does not refuse a send because a DM is old.
- The 30 days match how far back X's own DM lookup reaches: events from up to 30 days ago.

## Sync

Webhook events are the only source; there is no pull to fall back on.

- X is never polled. A sync started for an X account stops at once with `webhook_only`, so starting an inbox sync brings in nothing new.
- Missed deliveries are replayed from X's 24-hour replay window. A gap PubNio cannot replay shows on the account as `deliveryGap` with action `review_on_x` for 30 days.

## Scopes

| Channel | Scopes |
| --- | --- |
| Direct messages | `dm.read`, `dm.write`, `users.read` |
| Comments | `tweet.read`, `tweet.write`, `users.read` |
| Mentions | `tweet.read`, `tweet.write`, `users.read` |

Without a scope, reads keep working: the capabilities response lists it in `missingScopes` and drops send, reply, hide, like, and delete until the account reconnects with it. A write the channel lacks fails with HTTP 422 [capability-unsupported](https://pubnio.com/docs/problems/capability-unsupported/).

- The activity subscription itself needs `tweet.read`, `dm.read`, and `users.read`. Without all three, every channel reports `unavailable` with reason `missing_scopes` and action `reconnect_account`.
- `dm.write` is X's scope to send and manage Direct Messages for the user.

## Capabilities response

What [the inbox capabilities endpoint](https://pubnio.com/docs/reference/inbox-capabilities-get/) returns in `accounts[]` for an X account connected with every scope above on a plan without X reads. The other fields (`accountId`, `publishingReadiness`, `accountCapabilities`, `lastSyncError`, `deliveryGap`, `checkedAt`) are left out.

```json
{
  "provider": "x",
  "accountKind": "social_account",
  "messaging": {
    "resource": "conversation",
    "supported": true,
    "operations": ["list", "read"],
    "attachments": false,
    "quickReplies": false,
    "buttons": false,
    "readReceipts": false,
    "moderation": false,
    "syncMode": "webhook",
    "backfillDays": 0,
    "missingScopes": [],
    "missingTasks": [],
    "unavailable": {
      "reason": "plan_required",
      "action": "upgrade_plan"
    }
  },
  "comments": {
    "resource": "comment_thread",
    "supported": true,
    "operations": ["list", "read"],
    "attachments": true,
    "quickReplies": false,
    "buttons": false,
    "readReceipts": false,
    "moderation": true,
    "syncMode": "webhook",
    "backfillDays": 0,
    "missingScopes": [],
    "missingTasks": [],
    "unavailable": {
      "reason": "plan_required",
      "action": "upgrade_plan"
    }
  },
  "mentions": {
    "resource": "mention",
    "supported": true,
    "operations": ["list", "read"],
    "attachments": false,
    "quickReplies": false,
    "buttons": false,
    "readReceipts": false,
    "moderation": false,
    "syncMode": "webhook",
    "backfillDays": 0,
    "missingScopes": [],
    "missingTasks": [],
    "unavailable": {
      "reason": "plan_required",
      "action": "upgrade_plan"
    }
  },
  "replyWindow": {
    "open": true,
    "policy": "x_dm_30_days",
    "endsAt": null
  }
}
```

## Limits

- Hiding works on replies to the account's own posts only; X does not let an account hide replies elsewhere.
- No history: `backfillDays` is 0, so the inbox starts with the first event after the subscription goes live.
- PubNio clears message, comment, and mention text 90 days after the network created it, and deletes stored attachments after 30 days.

## Sources

- [X Activity API](https://docs.x.com/x-api/activity/introduction), read 2026-12-05
- [X API: Direct Messages Lookup](https://docs.x.com/x-api/direct-messages/lookup/introduction), read 2026-12-05
- [X API: Create Replay Job for Webhook](https://docs.x.com/x-api/webhooks/create-replay-job-for-webhook), read 2026-12-05
- [X API: OAuth 2.0 Authorization Code Flow with PKCE](https://docs.x.com/resources/fundamentals/authentication/oauth-2-0/authorization-code), read 2026-12-05
- [X API: Hide Replies](https://docs.x.com/x-api/posts/hide-replies/introduction), read 2026-12-05

## Related

- [X (Twitter) publishing API](https://pubnio.com/platforms/x)
- [X MCP server](https://pubnio.com/x-mcp)
- [X OAuth scopes explained](https://pubnio.com/docs/providers/x/scopes/)
- [X API rate limits explained](https://pubnio.com/docs/providers/x/limits/)
- [Inbox unavailable](https://pubnio.com/docs/problems/inbox-unavailable/)
- [Inbox webhook events](https://pubnio.com/docs/webhook-events/)

