Zernio
Zernio
PlatformsTwitter/XPosts & EditingReplies & QuotesMedia & VideoFields, Geo & PollsAnalytics & EngagementInboxLimits & Errors
Dashboard
llms.txtOpenAPI
OverviewPlatformsAPI ReferenceResources
Twitter/X

Posts & Editing

Create tweets, threads, and edit published tweets


Quick Start

Post a tweet in under 60 seconds:

const { post } = await zernio.posts.createPost({
  content: 'Hello from Zernio API!',
  platforms: [
    { platform: 'twitter', accountId: 'YOUR_ACCOUNT_ID' }
  ],
  publishNow: true
});
console.log('Tweet posted!', post._id);

Content Types

Text Tweet

A simple text-only tweet, exactly the Quick Start example above: content plus the platform entry. Keep it under 280 characters for free accounts.

Tweet with Image

Attach up to 4 images per tweet. JPEG, PNG, WebP, and GIF formats are supported.

const { post } = await zernio.posts.createPost({
  content: 'Check out this photo!',
  mediaItems: [
    { type: 'image', url: 'https://cdn.example.com/photo.jpg' }
  ],
  platforms: [
    { platform: 'twitter', accountId: 'YOUR_ACCOUNT_ID' }
  ],
  publishNow: true
});
console.log('Tweet with image posted!', post._id);

Tweet with Video

Attach a single video per tweet. MP4 and MOV formats, up to 512 MB, max 140 seconds (standard uploads).

const { post } = await zernio.posts.createPost({
  content: 'New product demo',
  mediaItems: [
    { type: 'video', url: 'https://cdn.example.com/demo.mp4' }
  ],
  platforms: [
    { platform: 'twitter', accountId: 'YOUR_ACCOUNT_ID' }
  ],
  publishNow: true
});
console.log('Tweet with video posted!', post._id);

Tweet with GIF

Only 1 GIF per tweet (it consumes all 4 image slots). Max 15 MB, 1280 x 1080 px. Animated GIFs auto-play in the timeline.

const { post } = await zernio.posts.createPost({
  content: 'Check out this animation!',
  mediaItems: [
    { type: 'gif', url: 'https://cdn.example.com/animation.gif' }
  ],
  platforms: [
    { platform: 'twitter', accountId: 'YOUR_ACCOUNT_ID' }
  ],
  publishNow: true
});
console.log('Tweet with GIF posted!', post._id);

Thread (Multi-Tweet)

Create Twitter threads with multiple connected tweets using platformSpecificData.threadItems. Each item becomes a reply to the previous tweet and can have its own content and media.

Note: When threadItems is provided, the top-level content field is used only for display and search purposes, it is NOT published. You must include your first tweet as threadItems[0].

const { post } = await zernio.posts.createPost({
  platforms: [{
    platform: 'twitter',
    accountId: 'YOUR_ACCOUNT_ID',
    platformSpecificData: {
      threadItems: [
        {
          content: '1/ Starting a thread about API design',
          mediaItems: [{ type: 'image', url: 'https://cdn.example.com/image1.jpg' }]
        },
        { content: '2/ First, always use proper HTTP methods...' },
        { content: '3/ Second, version your APIs from day one...' },
        { content: '4/ Finally, document everything! /end' }
      ]
    }
  }],
  publishNow: true
});
console.log('Thread posted!', post._id);

To publish a thread as a reply to an existing tweet, see Replies & Quotes.

Edit Published Tweets

Edit Post replaces the text of a published tweet via X's edit feature.

Note: Editing a tweet requires an active X Premium subscription on the connected account, must be within 1 hour of the original publish time, is limited to 5 edits per tweet (enforced by X), works on single tweets only (threads cannot be edited), and supports text-only edits (media changes are not supported). X mints a new post id on every edit, returned as id in the response.

curl -X POST https://zernio.com/api/v1/posts/YOUR_POST_ID/edit \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "platform": "twitter",
    "content": "Updated tweet text with corrected information"
  }'

If the post was published to several X accounts, pass accountId to pick which copy to edit. Without it, the first twitter entry on the post is used.

Was this page helpful?

Twitter/X

Schedule and automate Twitter/X posts with Zernio API

Replies & Quotes

Reply tweets and quote reposts

On this page

Quick StartContent TypesText TweetTweet with ImageTweet with VideoTweet with GIFThread (Multi-Tweet)Edit Published Tweets