X (Twitter) API: posts, media and per-post cost with APIWings
Status: planned, optional. X will be billed at X's own per-post cost, passed through with no margin. This page describes how the integration works.
Accounts
Any X account. Posts from a protected account are only visible to its approved followers.
Connecting
POST /v1/profiles/{id}/connect/x returns a connect_url. The user signs in on X and allows APIWings to read their profile, post and upload media (tweet.read, tweet.write, users.read, media.write, offline.access). Access tokens last 2 hours and are renewed automatically.
X uses the account already signed in on x.com in that browser. Ask your users to check which account is shown before they authorise.
Cost
X charges for every post created through its API. APIWings passes that cost on at cost, with no margin, and reports it on each published target as platform_cost_usd:
| Post | Cost (USD) |
|---|---|
| Without a link | 0.015 |
| With a link in the text | 0.20 |
These are X's pay-per-use prices of 2026; if X changes them, the new price applies. Each customer has a monthly cap on per-post network spend: a post that would go over it is refused with rate_limited (429) when you create it.
Supported content
| Rule | |
|---|---|
| Text | Weighted as X counts it: a URL counts 23, emoji and CJK characters count 2, most other characters 1. Up to 280, or up to 25,000 if the account has X Premium (read when the account was connected). Through APIWings, at most 10,000 characters per request. |
| Text or media | A post needs text, media or both. |
| Images | Up to 4: JPEG, PNG or WebP, up to 5 MB each. |
| GIF | One GIF alone, up to 15 MB. |
| Video | One video alone: MP4 or MOV, up to 1 GB through APIWings (X allows 8 GB), up to 20 minutes. X applies its own limits when processing it. |
The 280-character limit of accounts without Premium is checked when publishing, because it depends on the account: a longer text fails that target with validation_failed.
Options
| Option | Type | Meaning |
|---|---|---|
reply_settings |
string | Who can reply: everyone, following, mentionedUsers, subscribers or verified. X's default (everyone) when omitted. |
Unknown options are refused (validation_failed).
{ "platform": "x", "options": { "reply_settings": "following" } }
Result and visibility
visibility:public, orprivateif the account is protected (read when it was connected). X does not return a visibility for new posts.url:https://x.com/<handle>/status/<id>.platform_cost_usd: what X charged for the post.
Limits
X limits posts per user per day and per time window; when a limit is hit the attempt fails with rate_limited and is retried later, up to 3 attempts in total.
Errors
| When | Code |
|---|---|
Text over 25,000 weighted characters, more than 4 images, a GIF or video with other media, an unknown reply_settings value |
validation_failed (when creating the post) |
| Wrong format or size | media_invalid (when creating the post) |
| Text over 280 on an account without Premium | validation_failed (when publishing) |
| A post identical to a recent one from the same account | platform_rejected |
| X could not process the media | media_invalid |
| Monthly spend cap for paid networks reached | rate_limited (when creating the post) |
| X's rate limits | rate_limited (retried) |
| Token revoked or permission removed | auth_expired, then account.disconnected |
| X unavailable | platform_down (retried) |
