Skip to main content
The Articles endpoints allow developers to create draft Articles and publish them on X programmatically. Articles are long-form posts that support rich text formatting, embedded posts, links, and images. These endpoints require user-auth authentication via OAuth 1.0a or OAuth 2.0 PKCE with the tweet.read, tweet.write, and users.read scopes. Currently, the API supports two endpoints:

Create a draft Article

Developers can create a new draft Article using the POST https://api.x.com/2/articles/draft endpoint. The request body contains the article title, the body content as a DraftJS content state of text blocks and entities, and optional cover media uploaded via the media upload endpoints.

Publish an Article

Once a draft is ready, developers can make it publicly visible using the POST https://api.x.com/2/articles/{article_id}/publish endpoint, where article_id is the ID returned when the draft was created.

Getting started

To use the endpoints, you need a user access token. For details on generating one, see the OAuth 2.0 Authorization Code Flow with PKCE documentation. Once you have the access token, you can create a draft Article as shown below:
curl --request POST 'https://api.x.com/2/articles/draft' \
  --header 'Authorization: Bearer XXXXX' \
  --header 'Content-Type: application/json' \
  --data '{
    "title": "My first Article",
    "content_state": {
      "blocks": [
        {
          "text": "Hello from the Articles API!",
          "type": "unstyled"
        }
      ],
      "entities": []
    }
  }'
If the request is successful, you should see the JSON response as shown below:
{
  "data": {
    "id": "1146654567674912769",
    "title": "My first Article"
  }
}
You can then publish the draft using the returned Article ID:
curl --request POST 'https://api.x.com/2/articles/1146654567674912769/publish' \
  --header 'Authorization: Bearer XXXXX'
If the request is successful, the response contains the ID of the post created for the published Article:
{
  "data": {
    "post_id": "1346889436626259968"
  }
}