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

1

Get API Key

Sign up for free and get your API key in seconds.

2

Connect Account

Use our OAuth flow to connect Twitter (X) accounts.

3

Start Posting

Make API calls to post content to Twitter (X).

Post a tweet
JavaScript
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

POST/v1/posts

Create or schedule a tweet (text, image, video, or GIF)

GET/v1/posts/{id}

Get status and details of a tweet

DELETE/v1/posts/{id}

Cancel a scheduled tweet

GET/v1/profiles

List all connected Twitter/X accounts

Media Specs

Media Requirements

TypeFormatMax SizeNotes
ImagePNG, JPEG, GIF, WebP5 MBUp to 4 images per tweet
VideoMP4512 MB0.5 - 140 sec duration
GIFGIF15 MBAnimated GIFs supported
TextUTF-8280 charsLinks 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

Response
200 OK
{
  "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