Skip to content
Twexapi
English
Esc
navigateopen⌘Jpreview

[Step 1/5] Create a new article draft

Step 1 of 5 — Create an empty draft and get an article_id.

The article_id returned here is required by all subsequent steps.

Full flow:

  1. ➡️ POST /x/articles/draft — get article_id
  2. PUT /x/articles/{article_id}/cover(optional) set cover image
  3. PUT /x/articles/{article_id}/title — set title
  4. PUT /x/articles/{article_id}/content — set body (Markdown)
  5. POST /x/articles/{article_id}/publish — publish and get tweet_id

💡 Tip: For full control (e.g. preview before publish, retry individual steps), use the step-by-step flow above. Use POST /x/articles/publish only for quick one-shot publishing.

Back to API Reference
/Article Endpoints
POST/x/articles/draft
Authorization
AuthorizationBearer token · headerrequired
Global API Bearer Token for TwexAPI. Included as: Authorization: Bearer <YOUR_TWEXAPI_KEY>.
Request Body
requiredapplication/json
cookiestringrequired
The user's own authorized Twitter session credentials or auth_token (BYOC — Bring Your Own Cookie). Stateless proxy execution with zero credential retention. See [Authentication Security](/authentication#write-operations--byoc-bring-your-own-cookie) and [How to get Cookie](https://youtube-promotion.pages.dev/how-to-get-twitter-cookie).
Responses
200Successful Response
codeintegerrequired
200 = success, 429 = rate limit, 500 = server error
msgstringrequired
Human-readable result message
dataArticleDraftData | any
Show properties
Any of:
ArticleDraftData
article_idstringrequired
Unique article draft ID, required by all subsequent steps
preview_urlstringrequired
URL to preview the draft in X composer: https://x.com/compose/articles/edit/{article_id}
any
any
422Validation Error
detailValidationError[]
Show properties
Array of ValidationError
locstring | integer[]required
Show properties
Array of string | integer
Any of:
string
string
integer
integer
msgstringrequired
typestringrequired
inputany
ctxobject
429Daily tweet limit reached
500Server error
Interactive ConsolePOST
Interactive Console / Try APIPOST
Live Console
🌐Target Server:https://api.twexapi.io
● Production Ready
✍️
Write Operation Credentials Guide (TwexAPI Key + Twitter Cookie)

1. TwexAPI Platform Key (Bearer Token): Enter under "API Authorization" below for request billing & authentication.

2. Twitter Account Cookie: For write operations (tweet, like, follow, etc.), provide the target Twitter account's Cookie (e.g. auth_token=...; ct0=...) in the cookie field of Request Body below.

🔑API Authorization
📝Request Bodyapplication/json
📡
No Response Yet

Configure parameters in the Request tab and click Send Request below.

Request
curl -X POST "https://api.twexapi.io/x/articles/draft" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "cookie": "string"
}'
Response
{
  "code": 0,
  "msg": "string",
  "data": {
    "article_id": "string",
    "preview_url": "string"
  }
}