TwitterAPIs Docs
API ReferenceWrite Actions

Edit Draft Tweet API

Replace an existing draft's contents on the account behind your registered session. The fields you send become the draft in full: text is required, and media_ids, reply_to and quote are re-applied rather than merged, so send everything the draft should keep. Billed at $0.0016 per call. Cost: $0.0016 per call.

POST draft/edit replaces the contents of one existing draft on the account behind your registered twitterapis session. Pass the draft id plus the new text, and optionally media_ids, reply_to and quote. The fields you send replace the draft rather than merging into it. It returns ok and draft_tweet_id for $0.0016 a call.

POST
/draft/edit

Authorization

bearerAuth
AuthorizationBearer <token>

Pass your API key as a bearer token on every request: Authorization: Bearer <API_KEY>.

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/draft/edit" \  -H "Content-Type: application/json" \  -d '{    "id": "2086650228950683648",    "text": "Draft v2: the Q1 changelog ships Thursday."  }'
{  "ok": true,  "draft_tweet_id": "2086650228950683648"}
{  "error": "bad_request",  "message": "Missing or malformed parameter. Fix the request before retrying."}
{  "error": "unauthorized",  "message": "The API key is missing, malformed, or revoked. Check the Authorization header."}
{  "error": "insufficient_credits",  "message": "Your balance is exhausted. Top up your credits to continue."}
{  "error": "forbidden",  "message": "The acting account is not authorized for this write action, or has no logged-in session."}
{  "error": "not_found",  "message": "The resource does not exist, for example a deleted tweet or a private account."}
{  "error": "rate_limited",  "message": "Too many requests. Back off and retry with exponential backoff."}
{  "error": "server_error",  "message": "Something failed on our side. Retry with backoff; if it persists, contact support."}

Pricing

UnitPrice
Per call$0.0016
Per 1,000 calls$1.60

When to use

Use draft/edit to revise a draft you already saved, for example after a review pass changed the wording. Get the id from draft/list; if you want the previous version kept, create a second draft instead, because this call overwrites the one you name.

Notes

  • The edit REPLACES the draft's contents. Anything you leave out is not carried over from the previous version.
  • Needs a session for the account you are acting as: either register one once (POST /customer/session), or pass per-call inline credentials as x-auth-token and x-ct0 request headers, which let a single API key act as many accounts. Returns 409 session_required if neither is supplied, 401 session_dead when the session has expired.
  • You can only edit drafts owned by the account behind the session.

FAQ

Does draft/edit merge my fields into the existing draft?

No. The fields you send become the draft. If you omit media_ids the draft is left without media, so read the draft first or keep your own copy of what it should contain, then send the whole thing.

Where do I get the draft id?

From draft/list, which returns draft_tweet_id for every draft on the account. draft/create also returns the id of the draft it just saved, so you can edit it without a second list call.