Tweets
Create Tweet
Post tweets with text, images, and videos via API. $0.002 per call. GetXAPI create tweet endpoint with media upload examples.
POST
/twitter/tweet/createThis endpoint costs $0.002 per API call.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
auth_token | string | Yes | User's auth token |
text | string | Yes | Tweet text |
reply_to_tweet_id | string | No | Tweet id to reply to |
quote_tweet_url | string | No | Full URL of the tweet to quote (e.g. https://x.com/username/status/123456) |
quote_tweet_id | string | No | Tweet ID to quote — resolved to URL automatically. Use quote_tweet_url for faster requests |
proxy | string | No | Your proxy URL (e.g. http://user:pass@host:port) |
media_ids | array of strings | No | Pre-uploaded Twitter media ids |
media_urls | array of strings | No | URLs to images/videos — fetched and uploaded automatically |
media | array of objects | No | Base64-encoded media — uploaded automatically |
media[].data | string | Yes* | Base64-encoded file content |
media[].type | string | Yes* | MIME type (e.g. image/png, video/mp4) |
* Required when using the media field.
Notes
- Creates a tweet for the auth token owner.
- Proxy: Pass your own proxy URL to post the tweet using your IP instead of the server's.
- Quote tweets: Use
quote_tweet_urlto quote by URL, orquote_tweet_idto quote by ID (resolved to URL automatically). - Supports 3 ways to attach media (can be mixed in a single request):
media_ids— use if you already have Twitter media idsmedia_urls— pass image/video URLs, the server fetches and uploads them to Twittermedia— pass base64-encoded files inline
- For videos, the server handles chunked upload (INIT → APPEND → FINALIZE) and waits for processing to complete.
- If X rejects the mutation, this endpoint returns
502.
Media Limits
Images (all tiers)
| Limit | |
|---|---|
| Max per tweet | 4 images |
| File size | 5 MB (JPEG/PNG), 15 MB (GIF) |
| Formats | JPEG, PNG, GIF, WEBP |
| Recommended size | 1600 × 900 px (16:9) |
GIFs (all tiers)
| Limit | |
|---|---|
| Max per tweet | 1 GIF |
| File size | 15 MB (mobile), 5 MB (web) |
Videos
| Free | Premium | Premium+ | |
|---|---|---|---|
| Max duration | 2 min 20 sec | ~3 hours | 4 hours (web/iOS) |
| File size | 512 MB | 8 GB | 16 GB |
| Android max | 2:20 | 10 min | 10 min |
| Resolution | 1080p | 1080p (≤2h), 720p (2–4h) | Same as Premium |
| Formats | MP4, MOV | MP4, MOV | MP4, MOV |
| Max per tweet | 1 video | 1 video | 1 video |
Limits depend on the X account tier of the auth_token owner. Most accounts are free tier (2 min 20 sec video, 512 MB max).
Response (200)
{
"status": "success",
"msg": "Tweet created successfully",
"data": {
"id": "2019384131067818211",
"text": "Hello world!",
"createdAt": "Thu Feb 05 12:14:29 +0000 2026"
}
}Error Responses
400 - Missing fields
{
"error": "Missing required field: text"
}401 - Invalid auth_token
{
"error": "Invalid auth_token - could not extract userId"
}502 - Mutation rejected by X
{
"error": "Tweet creation failed - Twitter did not return a tweet ID"
}Examples
Text only
curl -X POST "https://api.getxapi.com/twitter/tweet/create" \
-H "Authorization: Bearer API_KEY" \
-H "Content-Type: application/json" \
-d '{
"auth_token": "your_auth_token",
"text": "Hello world!"
}'const response = await fetch("https://api.getxapi.com/twitter/tweet/create", {
method: "POST",
headers: {
Authorization: "Bearer API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
auth_token: "your_auth_token",
text: "Hello world!",
}),
});
const data = await response.json();
console.log(data);import requests
response = requests.post(
"https://api.getxapi.com/twitter/tweet/create",
headers={"Authorization": "Bearer API_KEY"},
json={
"auth_token": "your_auth_token",
"text": "Hello world!",
},
)
print(response.json())With media URL
curl -X POST "https://api.getxapi.com/twitter/tweet/create" \
-H "Authorization: Bearer API_KEY" \
-H "Content-Type: application/json" \
-d '{
"auth_token": "your_auth_token",
"text": "Check this out",
"media_urls": ["https://example.com/photo.jpg"]
}'With base64 media
curl -X POST "https://api.getxapi.com/twitter/tweet/create" \
-H "Authorization: Bearer API_KEY" \
-H "Content-Type: application/json" \
-d '{
"auth_token": "your_auth_token",
"text": "Photo upload",
"media": [{"data": "iVBORw0KGgo...", "type": "image/png"}]
}'Quote tweet
curl -X POST "https://api.getxapi.com/twitter/tweet/create" \
-H "Authorization: Bearer API_KEY" \
-H "Content-Type: application/json" \
-d '{
"auth_token": "your_auth_token",
"text": "Interesting take!",
"quote_tweet_url": "https://x.com/elonmusk/status/2019264360682778716"
}'With your own proxy
curl -X POST "https://api.getxapi.com/twitter/tweet/create" \
-H "Authorization: Bearer API_KEY" \
-H "Content-Type: application/json" \
-d '{
"auth_token": "your_auth_token",
"proxy": "http://user:pass@host:port",
"text": "Posted via my own proxy!"
}'Reply with media
curl -X POST "https://api.getxapi.com/twitter/tweet/create" \
-H "Authorization: Bearer API_KEY" \
-H "Content-Type: application/json" \
-d '{
"auth_token": "your_auth_token",
"text": "Great thread!",
"reply_to_tweet_id": "2019264360682778716",
"media_urls": ["https://example.com/reaction.mp4"]
}'