Skip to content

X (Twitter) API

Postproxy publishes tweets, native polls, and tweet chains (threads) to X. X is a bring-your-own-keys integration — you connect your own developer app. There is no comment or direct-message API.

Every request below uses the base URL https://api.postproxy.dev and an Authorization: Bearer YOUR_API_KEY header. Replace YOUR_API_KEY and the example IDs with your own.

Platform IDtwitter
Formatspost (default), poll
Character limit280 (free) / 25,000 (paid); polls always 280
MediaOptional (post); not allowed (poll)
PlacementsNone
CommentsNo
Direct messagesNo
Post chainsYes
FormatDescription
postTweet (default). Content type is inferred from the attached media
pollTweet with a native poll

The post format has no custom parameters.

MediaMax sizeFormatsCountDuration
Image5 MBjpg, png, webp, gif4
Video512 MBmp4, mov11 s – 140 s
  • Text-only tweets are allowed; media is optional.
  • Images and video cannot be mixed.
  • Minimum image dimensions 4×4 px; minimum video dimensions 32×32 px.
Terminal window
# Tweet with an image
curl -X POST "https://api.postproxy.dev/api/posts" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"post": { "body": "Just shipped a new feature! Check it out 🎉" },
"profiles": ["prof_abc123"],
"media": ["https://example.com/image.jpg"],
"platforms": { "twitter": {} }
}'
ParameterTypeRequiredDescription
formatstringYes"poll"
poll_optionsarray of stringsYes2–4 choices, max 25 characters each
poll_duration_minutesintegerYes5 to 10,080 (7 days)

Polls are capped at 280 characters and cannot include media or be part of a thread.

Terminal window
# Poll
curl -X POST "https://api.postproxy.dev/api/posts" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"post": { "body": "Which framework do you prefer?" },
"profiles": ["prof_abc123"],
"platforms": {
"twitter": {
"format": "poll",
"poll_options": ["Rails", "Django", "Laravel", "Other"],
"poll_duration_minutes": 1440
}
}
}'

X supports threads for the post format. Pass a thread array of follow-up tweets; each child can carry its own media. Polls cannot be threaded.

Terminal window
# A tweet thread
curl -X POST "https://api.postproxy.dev/api/posts" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"post": { "body": "1/ A short thread on what we learned 🧵" },
"profiles": ["prof_abc123"],
"thread": [
{ "body": "2/ Ship small, ship often." },
{ "body": "3/ Talk to users every week.", "media": ["https://example.com/chart.png"] }
]
}'

Not supported through the API.

Not supported.

Subscribe with the Webhooks API:

Terminal window
curl -X POST "https://api.postproxy.dev/api/webhooks" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/webhooks/postproxy",
"events": ["platform_post.published", "platform_post.failed", "platform_post.insights"]
}'

Events relevant to X:

EventWhen
post.processedA post is ready to publish
platform_post.publishedA post was published to the platform
platform_post.failedA post failed to publish (retries exhausted)
platform_post.failed_waiting_for_retryA publish attempt failed; will retry
platform_post.insightsNew analytics snapshot
profile.connected / .disconnectedConnection state changed
profile.statsNew profile stats snapshot
media.failedA media attachment failed to process
  • The character limit depends on your X account tier: 280 on free, 25,000 on paid. Polls are always capped at 280.
  • X requires your own API keys — see the X bring-your-own-keys guide.
  • poll, media, and threads are mutually exclusive.