API Reference
Twitter (X) API
Post tweets, threads, images, and videos to Twitter/X without expensive API tiers.
Quick Start
Get started in 3 steps
Get API Key
Sign up for free and get your API key in seconds.
Connect Account
Use our OAuth flow to connect Twitter (X) accounts.
Start Posting
Make API calls to post content to Twitter (X).
const response = await fetch('https://getlate.dev/api/v1/posts', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
content: 'Just shipped a new feature! 🚀 Check it out at example.com',
mediaItems: [{ type: 'image', url: 'https://example.com/screenshot.png' }],
platforms: [{
platform: 'twitter',
accountId: 'acc_abc123'
}],
publishNow: true
})
});
const post = await response.json();
console.log(post.post._id); // '65f1c0a9e2b5af0012ab34cd'Endpoints
Twitter (X) Endpoints
/v1/postsCreate or schedule a tweet (text, image, video, or GIF)
/v1/posts/{id}Get status and details of a tweet
/v1/posts/{id}Cancel a scheduled tweet
/v1/profilesList all connected Twitter/X accounts
Media Specs
Media Requirements
| Type | Format | Max Size | Notes |
|---|---|---|---|
| Image | PNG, JPEG, GIF, WebP | 5 MB | Up to 4 images per tweet |
| Video | MP4 | 512 MB | 0.5 - 140 sec duration |
| GIF | GIF | 15 MB | Animated GIFs supported |
| Text | UTF-8 | 280 chars | Links counted as 23 chars |
Late automatically transcodes and optimizes media for Twitter (X)'s requirements.
Rate Limits
API Limits
Twitter's v2 API has strict rate limits that vary by endpoint. Late manages these automatically, ensuring your posts go out reliably.
Late handles all rate limiting automatically. We queue and retry requests as needed.
Capabilities
Features
- Post tweets with images, videos, and GIFs
- Create multi-tweet threads
- Schedule tweets for optimal times
- Multi-account management
- Quote tweet and reply support
- Webhook notifications for post status
- No need for expensive Twitter API tiers
Response
Response Example
{
"post": {
"_id": "65f1c0a9e2b5af0012ab34cd",
"status": "published",
"content": "Just shipped a new feature! 🚀 Check it out at example.com",
"platforms": [{
"platform": "twitter",
"accountId": { "_id": "acc_abc123", "username": "@yourhandle" },
"status": "published",
"platformPostId": "1234567890123456789",
"platformPostUrl": "https://x.com/yourhandle/status/1234567890123456789"
}],
"publishedAt": "2025-01-10T10:30:00Z"
},
"message": "Post published successfully"
}Start building with Twitter (X) API
Skip Twitter's complicated API tiers. Late handles OAuth, media uploads, and rate limits so you can ship faster.
Free tier available • No credit card required • 99.97% uptime