Zernio
APIFor you
Zernio
APIFor you
Platforms

X

Overview

Publish

Posts & editingReplies & quotesMedia & videoFields, geo & polls

Engage

Analytics & engagementInbox

Reference

Limits & errors
Dashboard
OverviewPlatformsAPI ReferenceResources
X

Replies & quotes

Reply to a post on X with replyToTweetId, reply with a whole thread, and quote a post with quoteTweetId.


By the end of this page you can publish a reply, a reply thread and a quote post on X (platform value twitter) with two platformSpecificData fields.

Before you start

You need a connected X account (accountId) and the id of the post you are answering.

To find one, search the last 7 days with GET /v1/twitter/search or resolve a post URL with GET /v1/twitter/tweet.

Step 1: reply to a post

Set platformSpecificData.replyToTweetId on the X entry of POST /v1/posts.

X only accepts replies to your own posts or to posts that mention you. X rejects a reply to any other account's post.

replyToTweetId cannot be combined with replySettings.

import Zernio from '@zernio/node';

const zernio = new Zernio();

const { data: reply } = await zernio.posts.createPost({
  body: {
    content: 'Thanks, fixed in the release going out today.',
    platforms: [{
      platform: 'twitter',
      accountId: '66b2e19d8c3f5a7e9d0b1c2d',
      platformSpecificData: { replyToTweetId: '1748391029384756102' }
    }],
    publishNow: true
  }
});

console.log(reply.post.platforms[0].platformPostUrl);

Response (201):

{
  "post": {
    "_id": "65f1c0a9e2b5af0012ab34cd",
    "status": "published",
    "platforms": [
      {
        "platform": "twitter",
        "status": "published",
        "platformPostId": "1852634789012345678",
        "platformPostUrl": "https://twitter.com/acmecorp/status/1852634789012345678"
      }
    ]
  }
}

The two steps below change only the platforms entry of this request and return the same response.

Step 2: reply with a thread

Combine replyToTweetId with threadItems. Only threadItems[0] replies to the target.

The later items chain under it as in a standalone thread. The top-level content is not published.

{
  "platform": "twitter",
  "accountId": "66b2e19d8c3f5a7e9d0b1c2d",
  "platformSpecificData": {
    "replyToTweetId": "1748391029384756102",
    "threadItems": [
      { "content": "1/ Good question. The short answer is yes." },
      { "content": "2/ The longer answer: it depends on whether the account is Premium." }
    ]
  }
}

Step 3: quote a post

Set platformSpecificData.quoteTweetId to the id or the full status URL of the post to quote.

A quote cannot carry mediaItems or a poll. In a thread, it applies to the first post only.

X only accepts quotes of your own posts, of posts that mention you, or of posts in a conversation you are part of.

{
  "platform": "twitter",
  "accountId": "66b2e19d8c3f5a7e9d0b1c2d",
  "platformSpecificData": { "quoteTweetId": "1748391029384756102" }
}

X bills a quote made with quoteTweetId at the standard create rate.

Pasting the post's URL into content instead is billed at the URL rate, 13 times more. The rates are on X API usage.

If it fails

A 207 with post.status: "failed" means X rejected the reply or quote. platforms[].errorMessage carries the reason.

The common one is replying twice with the same text, because X rejects a post whose text it already has:

{
  "message": "Post created but publishing failed",
  "error": "All platforms failed",
  "post": {
    "_id": "65f1c0a9e2b5af0012ab34cd",
    "status": "failed",
    "platforms": [
      {
        "platform": "twitter",
        "status": "failed",
        "errorMessage": "X (Twitter) does not allow duplicate tweets"
      }
    ]
  }
}

Change the text and create the post again. A failed post is terminal and is not retried.

The same 207 shape reports a target post you are not allowed to answer. Check that it is your own post or one you are mentioned in.

Error handling covers the envelope.

Related

  • Posts & Editing: the base request and standalone threads.
  • Fields, Geo & Polls: replySettings and the other options.
  • Search recent tweets: find posts to reply to.
  • Look up a tweet: resolve a post URL to its id and metrics.
  • Limits & Errors: the full field table.
Was this page helpful?

Posts & editing

Create a post on X, attach images, a GIF or a video, publish a thread with threadItems, publish an Article and edit a published post.

Media & video

Image, GIF and video limits for X, and what the longVideo flag does on a Premium account.

On this page

Before you startStep 1: reply to a postStep 2: reply with a threadStep 3: quote a postIf it failsRelated