Skip to content

Twitter X comments API: Manage Replies in 2026

On Twitter/X, a comment is a reply tweet, so managing comments means reading replies under your tweets, answering the ones worth answering, and cleaning up spam. This Twitter X comments API guide covers how to list replies, post a reply, delete a reply, and hide a reply or unhide it, with the exact request fields, response shapes, scope requirement, and credit costs for each operation.

What a Twitter/X comment is and the four operations covered

Twitter/X treats comments as reply tweets. A single workflow therefore covers discovery, response, and cleanup: inspect incoming replies, answer useful ones, and remove unwanted ones. The shared /v1/comments surface keeps those steps consistent across platforms. Below, each operation is presented in execution order, beginning with discovery and ending with visibility control.

What you need

Preparation involves three items: an account, a credential obtained from the Access Keys page, and a linked Twitter/X identity. Authentication travels in the x-access-key header on every call. Visibility control has an extra prerequisite. The tweet.moderate.write permission is required for hiding, and accounts linked before that permission existed need a fresh link to receive it. Discovery, response, and deletion do not depend on that permission. The field map that follows separates path, query, and body inputs and clarifies the distinct roles of postId and commentId.

Step 1: Get your API key

Create an account, open the dashboard, and copy the credential shown on the Access Keys page. Include that value in the x-access-key header for each request described in this guide.

Step 2: Connect your Twitter/X account

Request the Twitter connection endpoint to receive an authorization URL. Visit that URL, approve access, and finish linking the Twitter/X identity. Next, request the integrations collection and locate the identifier belonging to the linked identity. Use that identifier as accountId in subsequent calls; the worked examples use 6ad622af5ce6839ab1b27be6. The integrations dashboard offers an alternative way to retrieve the same identifier.

Step 3: List replies on a tweet

Supply platform, accountId, and postId to retrieve replies attached to a tweet. Returned objects expose author details, creation time, engagement count, and current visibility state. A nextCursor token supports continued paging when a thread contains many replies. Discovery has two timing constraints. Recent search reaches back only about seven days, so older threads are outside its range. Indexing also lags by roughly a minute, meaning an immediate repeat request may be needed after a reply appears. Availability of search depends on the X developer plan associated with the account. Budget 1 credit for each list request and pass the returned nextCursor to continue.

Step 4: Post a reply

A POST to /v1/comments with postId and text creates a reply attached to the original tweet. Success returns a commentId identifying the newly created reply tweet. Attaching a response beneath an existing reply requires commentId instead of postId, together with the reply identifier and text. In short, postId targets the parent tweet while commentId targets a nested reply. Pricing is 5 credits normally and 50 credits when text includes a link, reflecting per-request billing for a reply treated as a tweet. A narrower alternative exists through POST /v1/posts using platformSpecificData.replyToTweetId, suitable when posting is the only requirement. Choose the comments surface when reading and moderation are also part of the workflow.

Step 5: Delete a reply

Removal of your own reply uses DELETE with the reply identifier in the path and platform plus accountId in the query string. A successful response contains success set to true. Because deletion cannot be undone, reserve it for retracting your own content. For reducing noise from someone else's reply, visibility control is the appropriate tool. Budget 3 credits for deletion.

Step 6: Hide or unhide a reply

Visibility control applies to replies on your own tweets. Setting hidden to true removes the reply from public display while leaving it accessible to its author, a softer response to spam or irrelevant content than deletion. Setting hidden to false restores public display. This operation requires tweet.moderate.write. An authorization failure usually indicates that the linked account predates that permission; linking the account again and repeating the PATCH request resolves it. Budget 2 credits for either direction.

Failure matrix: scope, search window, indexing delay, and delete versus hide

Consult the failure matrix before changing code. Authorization failures during hiding point to the tweet.moderate.write permission and call for relinking. Missing recent replies suggest waiting for indexing and trying again. Empty results for older tweets reflect the seven-day search boundary. Finally, confirm intent before acting: deletion permanently retracts your own reply, whereas hiding suppresses another reply publicly without removing it for its author.

Credits and a worked moderation loop

The credit table provides the basis for estimating a moderation workflow. Discovery is inexpensive, while creation carries the highest cost because each reply is billed like a tweet. Combining the operations yields a complete loop: periodically fetch replies with GET /v1/comments, evaluate each item with custom rules or a model, then respond, suppress, or remove it as appropriate. Polling frequency should account for the seven-day discovery window, and projected volume multiplied by per-operation costs gives a practical credit estimate.

Field map for list, post, delete, and hide/unhide operations
OperationMethod and pathRequired inputsTarget selectionCredits
List repliesGET /v1/commentsplatform=twitter, accountId, postId; x-access-key headerpostId selects the tweet whose replies are listed1 per call
Post a reply to a tweetPOST /v1/commentsplatform, accountId, postId, text; x-access-key headerpostId replies to the original tweet5, or 50 if text contains a link
Post a reply under a replyPOST /v1/commentsplatform, accountId, commentId, text; x-access-key headercommentId threads the response under that reply5, or 50 if text contains a link
Delete a replyDELETE /v1/comments/{commentId}platform and accountId as query params; reply tweet ID in path; x-access-key headerPath ID selects the reply to delete (own replies only)3
Hide or unhide a replyPATCH /v1/comments/{commentId}platform, accountId, hidden (true or false); x-access-key header; tweet.moderate.write scopePath ID selects the reply to hide or unhide2

Contract as captured in source; origin modularized as {{API_BASE_URL}}.

Failure matrix
Failure or conditionWhat you observeCauseFix
Hide returns an authorization errorPATCH /v1/comments/{commentId} failsMissing tweet.moderate.write scope on the connected accountReconnect the Twitter/X account so the scope is granted, then retry
New reply missing from list resultsGET /v1/comments returns no new replyFresh replies take about a minute to become searchableWait about a minute and retry the list call
No replies found on an older tweetGET /v1/comments returns an empty listRecent search covers roughly the last 7 days onlyOnly list replies on tweets within the search window
Wrong moderation outcomeReply deleted when only thread cleanup was intendedDelete is permanent; hide only removes the reply from the public threadUse hide a reply for thread cleanup and delete a reply only to retract your own reply

Conditions as described in source; no verified error/status contract supplied.

Credit costs per operation
OperationCredit cost
List replies1 credit per call
Post a reply5 credits, or 50 if the text contains a link
Delete a reply3 credits
Hide or unhide a reply2 credits

Credit costs as captured in source.

Frequently asked questions

What is the difference between postId and commentId when posting a reply?

Send postId when the new reply should attach to the original tweet. Send commentId when it should attach beneath a specific reply. That single choice controls threading.

Why does hiding a reply return an authorization error?

The hide operation depends on tweet.moderate.write. Accounts linked earlier may lack it, so link the Twitter/X account again to obtain the scope, then repeat the PATCH request.

Why might a new reply not appear when listing replies?

Discovery relies on recent search, limited to roughly seven days, and indexing lags by about a minute. Older threads fall outside the window, while very recent replies may need a short wait before a repeat list call.

Should I delete a reply or hide a reply?

Choose delete for your own reply when permanent removal is intended. Choose hide for another account's reply when the goal is removing it from public view while the author can still access it.

What are the credit costs for each comments operation?

A list call uses 1 credit. Posting uses 5 credits, rising to 50 when text includes a link. Deletion uses 3 credits. Hiding or unhiding uses 2 credits.

Connect a Twitter/X account
curl {{API_BASE_URL}}/v1/connect/twitter \
  -H "x-access-key: YOUR_API_KEY"
List connected integrations to obtain accountId
curl {{API_BASE_URL}}/v1/connect/integrations \
  -H "x-access-key: YOUR_API_KEY"
List replies on a tweet
curl "{{API_BASE_URL}}/v1/comments?platform=twitter&accountId=6ad622af5ce6839ab1b27be6&postId=1797453210987654321" \
  -H "x-access-key: YOUR_API_KEY"
List replies response example
{
  "success": true,
  "comments": [
    {
      "id": "1797460011223344556",
      "text": "An example comment.",
      "author": { "id": "1588012345678901234", "name": "maria.builds" },
      "timestamp": "2026-10-24T14:22:10.000Z",
      "likeCount": 2,
      "hidden": false
    }
  ],
  "nextCursor": "b26v89c19zqg8o3fosvc9fp..."
}
Post a reply to a tweet using postId
curl -X POST {{API_BASE_URL}}/v1/comments \
  -H "x-access-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "platform": "twitter",
    "accountId": "6ad622af5ce6839ab1b27be6",
    "postId": "1797453210987654321",
    "text": "An example comment."
  }'
Post a reply response example
{
  "success": true,
  "commentId": "1797461122334455667"
}
Post a reply under an existing reply using commentId
curl -X POST {{API_BASE_URL}}/v1/comments \
  -H "x-access-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "platform": "twitter",
    "accountId": "6ad622af5ce6839ab1b27be6",
    "commentId": "1797460011223344556",
    "text": "An example comment."
  }'
Delete a reply
curl -X DELETE "{{API_BASE_URL}}/v1/comments/1797461122334455667?platform=twitter&accountId=6ad622af5ce6839ab1b27be6" \
  -H "x-access-key: YOUR_API_KEY"
Delete a reply response example
{
  "success": true
}
Hide a reply
curl -X PATCH {{API_BASE_URL}}/v1/comments/1797460011223344556 \
  -H "x-access-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "platform": "twitter",
    "accountId": "6ad622af5ce6839ab1b27be6",
    "hidden": true
  }'