Twitter/X API
Posting to Twitter/X via RelayAPI — features, limits, and platform-specific settings.
Overview
RelayAPI supports publishing to Twitter/X through the unified API. Connect your Twitter/X account and start posting programmatically.
Getting Started
- Connect your Twitter/X account via the dashboard or Connect Account API
- Use the account ID as a target when creating posts
Quick Example
curl -X POST https://api.relayapi.dev/v1/posts \
-H "Authorization: Bearer rlay_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"content": "Hello from RelayAPI!",
"targets": ["acc_twitter_123"]
}'Content Limits
| Property | Limit |
|---|---|
| Character limit | 280 |
| Supported media | Images (4), GIF (1), Video (1) |
| Media size limits | 5 MB images, 512 MB video |
Thread Support
For content exceeding 280 characters, RelayAPI automatically splits your post into a thread. You can also manually define thread segments using the thread field.
Platform-Specific Settings
Use platform_overrides to customize content for Twitter/X:
Content Overrides
{
"content": "Default content for all platforms",
"platform_overrides": {
"twitter": {
"content": "Custom content for Twitter/X"
}
}
}Supported Fields
content— Custom text for Twitter/Xmedia— Platform-specific media attachmentsreply_to— Reply to an existing tweet by ID
Rate Limits
Twitter/X enforces its own rate limits. RelayAPI automatically queues and retries posts when platform rate limits are reached. See Rate Limits for details.
Retry Behavior
When a rate limit is hit, RelayAPI will automatically retry with exponential backoff. Posts transition to publishing status during retries.