GetXAPI
Articles

Create Article

Create (and optionally publish) long-form Twitter/X articles in one call. $0.01 per call. Premium-only when publishing. GetXAPI article endpoint.

POST/twitter/article/create

This endpoint costs $0.01 per API call. Premium-only when publish: true — the auth_token account must have an active X Premium subscription.

Single endpoint that creates the draft, sets title + content + cover, and (optionally) publishes — all in one call.

For 100% success rate, pass your own proxy via the proxy field. Using a custom proxy posts the article from your own clean IP and gives the most reliable results.

Request Body

FieldTypeRequiredDescription
auth_tokenstringYesUser's auth token (Premium account when publishing)
titlestringYesArticle title
contentstringYesArticle body in Markdown. Supports H1, H2, paragraphs, bold/italic/strikethrough, ordered + unordered lists, blockquotes
publishboolNoIf true, publishes immediately after creation. Default false (saved as draft)
cover_media_idstringNoPre-uploaded media id (from /media/upload)
cover_image_urlstringNoURL of an image to fetch and upload as the cover
cover_image_base64stringNoBase64-encoded image data for the cover
proxystringNoYour proxy URL (e.g. http://user:pass@host:port)

Provide at most one of cover_media_id / cover_image_url / cover_image_base64.

Notes

  • When publish: false (default), the response returns a draft_url you can hand back to the user for in-app editing.
  • When publish: true, the article goes live as a wrapper tweet — tweet_id and public_url are returned.
  • Markdown limitations (X's article schema, not our limits):
    • Only H1 and H2 render distinctly. ### (H3) and deeper coerce to H2.
    • Code blocks (fenced ```) degrade to plain paragraphs — X doesn't support them.
    • Inline code ( x ) renders as plain text.
    • Inline links degrade to <text> (<href>) plain text.
    • Inline images inside the markdown body are not yet supported — use the cover_* fields for the header image.

Response (200) — Draft

{
  "status": "success",
  "data": {
    "article_id": "2055606612363202560",
    "status": "draft",
    "tweet_id": null,
    "draft_url": "https://x.com/compose/articles/edit/2055606612363202560",
    "public_url": null,
    "cover_media_id": "2055606606466023424"
  }
}

Response (200) — Published

{
  "status": "success",
  "data": {
    "article_id": "2055606612363202560",
    "status": "published",
    "tweet_id": "2055606621209002254",
    "draft_url": "https://x.com/compose/articles/edit/2055606612363202560",
    "public_url": "https://x.com/i/status/2055606621209002254",
    "cover_media_id": "2055606606466023424"
  }
}

Error Responses

400 - Missing fields

{ "error": "Missing required field: title" }

403 - Not Premium (when publish: true)

{ "error": "Publishing articles requires an active X Premium subscription on this account" }

502 - Mutation rejected by X

{ "error": "Twitter did not return an article_id from DraftCreate" }

Examples

curl -X POST "https://api.getxapi.com/twitter/article/create" \
  -H "Authorization: Bearer API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "auth_token": "your_auth_token",
    "title": "Three Books Worth Re-reading This Year",
    "content": "Some books reveal more on the second pass...\n\n## The Beginning of Infinity — David Deutsch\n\nDeutsch makes the case that **knowledge is the engine of change**...",
    "cover_image_url": "https://picsum.photos/1200/675",
    "publish": true
  }'
const response = await fetch("https://api.getxapi.com/twitter/article/create", {
  method: "POST",
  headers: {
    Authorization: "Bearer API_KEY",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    auth_token: "your_auth_token",
    title: "Three Books Worth Re-reading This Year",
    content: "Some books reveal more on the second pass...",
    cover_image_url: "https://picsum.photos/1200/675",
    publish: true,
  }),
});
const data = await response.json();
console.log(data);
import requests

response = requests.post(
    "https://api.getxapi.com/twitter/article/create",
    headers={"Authorization": "Bearer API_KEY"},
    json={
        "auth_token": "your_auth_token",
        "title": "Three Books Worth Re-reading This Year",
        "content": "Some books reveal more on the second pass...",
        "cover_image_url": "https://picsum.photos/1200/675",
        "publish": True,
    },
)
print(response.json())

Save as draft (no Premium required)

curl -X POST "https://api.getxapi.com/twitter/article/create" \
  -H "Authorization: Bearer API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "auth_token": "your_auth_token",
    "title": "Draft for later",
    "content": "Work in progress..."
  }'

On this page