> ## Documentation Index
> Fetch the complete documentation index at: https://docs.twexapi.io/llms.txt
> Use this file to discover all available pages before exploring further.

# [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.



## OpenAPI

````yaml /api-reference/openapi.json post /x/articles/draft
openapi: 3.1.0
info:
  title: Twitter API Service
  description: |2-

            A comprehensive Twitter API service that provides various Twitter operations including:
            
            * **Search Operations**: Advanced search, hashtags, cashtags
            * **Tweet Operations**: Post, like, retweet, quote, bookmark, delete
            * **User Operations**: Batch user information retrieval
            * **Influencer Operations**: Get tweets from top influencers
            
            All endpoints return standardized responses in the format:
            ```json
            {
                "code": 200,
                "msg": "success", 
                "data": {...}
            }
            ```
            
            ## Authentication
            
            This API uses Bearer token authentication. Include your token in the Authorization header:
            ```
            Authorization: Bearer your_token_here
            ```
            
  contact:
    name: API Support
    email: support@twitterxapi.com
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.twexapi.io
    description: Development server
security: []
paths:
  /x/articles/draft:
    post:
      tags:
        - Article Endpoints
      summary: '[Step 1/5] Create a new article draft'
      description: >-
        **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.
      operationId: article_create_draft_x_articles_draft_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ArticleCreateDraftBody'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ArticleDraftResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '429':
          description: Daily tweet limit reached
          content:
            application/json:
              example:
                code: 429
                msg: Daily tweet limit reached, please try again tomorrow.
        '500':
          description: Server error
          content:
            application/json:
              example:
                code: 500
                msg: Internal server error
      security:
        - HTTPBearer: []
components:
  schemas:
    ArticleCreateDraftBody:
      properties:
        cookie:
          type: string
          title: Cookie
          description: Twitter cookie string (auth_token=...; ct0=...; twid=...)
      type: object
      required:
        - cookie
      title: ArticleCreateDraftBody
    ArticleDraftResponse:
      properties:
        code:
          type: integer
          title: Code
          description: 200 = success, 429 = rate limit, 500 = server error
        msg:
          type: string
          title: Msg
          description: Human-readable result message
        data:
          anyOf:
            - $ref: '#/components/schemas/ArticleDraftData'
            - type: 'null'
      type: object
      required:
        - code
        - msg
      title: ArticleDraftResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ArticleDraftData:
      properties:
        article_id:
          type: string
          title: Article Id
          description: Unique article draft ID, required by all subsequent steps
        preview_url:
          type: string
          title: Preview Url
          description: >-
            URL to preview the draft in X composer:
            https://x.com/compose/articles/edit/{article_id}
      type: object
      required:
        - article_id
        - preview_url
      title: ArticleDraftData
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````