[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:
- ➡️
POST /x/articles/draft— getarticle_id PUT /x/articles/{article_id}/cover— (optional) set cover imagePUT /x/articles/{article_id}/title— set titlePUT /x/articles/{article_id}/content— set body (Markdown)POST /x/articles/{article_id}/publish— publish and gettweet_id
💡 Tip: For full control (e.g. preview before publish, retry individual steps), use the step-by-step flow above. Use
POST /x/articles/publishonly for quick one-shot publishing.
Back to API Reference
/Article Endpoints
POST
/x/articles/draftAuthorization
AuthorizationBearer token · headerrequiredGlobal API Bearer Token for TwexAPI. Included as: Authorization: Bearer <YOUR_TWEXAPI_KEY>.
Request Body
requiredapplication/jsoncookiestringrequiredThe 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
codeintegerrequired200 = success, 429 = rate limit, 500 = server error
msgstringrequiredHuman-readable result message
dataArticleDraftData | anyShow propertiesHide properties
Any of:
ArticleDraftData
article_idstringrequiredUnique article draft ID, required by all subsequent steps
preview_urlstringrequiredURL to preview the draft in X composer: https://x.com/compose/articles/edit/{article_id}
any
any422Validation Error
detailValidationError[]Show propertiesHide properties
Array of
ValidationErrorlocstring | integer[]requiredShow propertiesHide properties
Array of
string | integerAny of:
string
stringinteger
integermsgstringrequiredtypestringrequiredinputanyctxobject429Daily tweet limit reached
500Server error
⚡Interactive ConsolePOST
⚡Interactive Console / Try APIPOSTLive 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"
}'const response = await fetch("https://api.twexapi.io/x/articles/draft", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify({
"cookie": "string"
})
});import requests
response = requests.post(
"https://api.twexapi.io/x/articles/draft",
headers={
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
},
json={
"cookie": "string"
},
)Response
{
"code": 0,
"msg": "string",
"data": {
"article_id": "string",
"preview_url": "string"
}
}{
"detail": [
{
"loc": [
"string"
],
"msg": "string",
"type": "string",
"input": null,
"ctx": {}
}
]
}{
"code": 429,
"msg": "Daily tweet limit reached, please try again tomorrow."
}{
"code": 500,
"msg": "Internal server error"
}