GetXAPI
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/create

This endpoint costs $0.002 per API call.

Request Body

FieldTypeRequiredDescription
auth_tokenstringYesUser's auth token
textstringYesTweet text
reply_to_tweet_idstringNoTweet id to reply to
quote_tweet_urlstringNoFull URL of the tweet to quote (e.g. https://x.com/username/status/123456)
quote_tweet_idstringNoTweet ID to quote — resolved to URL automatically. Use quote_tweet_url for faster requests
proxystringNoYour proxy URL (e.g. http://user:pass@host:port)
media_idsarray of stringsNoPre-uploaded Twitter media ids
media_urlsarray of stringsNoURLs to images/videos — fetched and uploaded automatically
mediaarray of objectsNoBase64-encoded media — uploaded automatically
media[].datastringYes*Base64-encoded file content
media[].typestringYes*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_url to quote by URL, or quote_tweet_id to 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 ids
    • media_urls — pass image/video URLs, the server fetches and uploads them to Twitter
    • media — 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 tweet4 images
File size5 MB (JPEG/PNG), 15 MB (GIF)
FormatsJPEG, PNG, GIF, WEBP
Recommended size1600 × 900 px (16:9)

GIFs (all tiers)

Limit
Max per tweet1 GIF
File size15 MB (mobile), 5 MB (web)

Videos

FreePremiumPremium+
Max duration2 min 20 sec~3 hours4 hours (web/iOS)
File size512 MB8 GB16 GB
Android max2:2010 min10 min
Resolution1080p1080p (≤2h), 720p (2–4h)Same as Premium
FormatsMP4, MOVMP4, MOVMP4, MOV
Max per tweet1 video1 video1 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"]
  }'

On this page