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

# Create draft

> Save a tweet draft for later editing or posting from any connected X account

<blockquote className="agent-llms-directive">
  For the complete documentation index, see <a href="/llms.txt">llms.txt</a>.
</blockquote>

<Callout icon="circle-check" color="#16a34a">
  **Free** - does not consume credits
</Callout>

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://xquik.com/api/v1/drafts \
    -H "x-api-key: xq_YOUR_KEY_HERE" \
    -H "Content-Type: application/json" \
    -d '{
      "text": "Just shipped dark mode. What feature should we build next?",
      "topic": "product update",
      "goal": "conversation"
    }' | jq
  ```

  ```javascript Node.js theme={null}
  const response = await fetch("https://xquik.com/api/v1/drafts", {
    method: "POST",
    headers: {
      "x-api-key": "xq_YOUR_KEY_HERE",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      text: "Just shipped dark mode. What feature should we build next?",
      topic: "product update",
      goal: "conversation",
    }),
  });
  const data = await response.json();
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      "https://xquik.com/api/v1/drafts",
      headers={"x-api-key": "xq_YOUR_KEY_HERE"},
      json={
          "text": "Just shipped dark mode. What feature should we build next?",
          "topic": "product update",
          "goal": "conversation",
      },
  )
  data = response.json()
  ```

  ```go Go theme={null}
  package main

  import (
      "bytes"
      "encoding/json"
      "fmt"
      "net/http"
  )

  func main() {
      body, _ := json.Marshal(map[string]interface{}{
          "text":  "Just shipped dark mode. What feature should we build next?",
          "topic": "product update",
          "goal":  "conversation",
      })

      req, err := http.NewRequest("POST", "https://xquik.com/api/v1/drafts", bytes.NewReader(body))
      if err != nil {
          panic(err)
      }
      req.Header.Set("x-api-key", "xq_YOUR_KEY_HERE")
      req.Header.Set("Content-Type", "application/json")

      resp, err := http.DefaultClient.Do(req)
      if err != nil {
          panic(err)
      }
      defer resp.Body.Close()

      var data map[string]interface{}
      if err := json.NewDecoder(resp.Body).Decode(&data); err != nil {
          panic(err)
      }
      fmt.Println(data)
  }
  ```
</CodeGroup>

## Headers

<ParamField header="x-api-key" type="string" required>
  Your API key. Session cookie authentication is also supported. Generate a key from the [dashboard](https://xquik.com/dashboard).
</ParamField>

<ParamField header="Content-Type" type="string" required>
  Must be `application/json`.
</ParamField>

## Body

<ParamField body="text" type="string" required>
  The draft tweet text. Must be non-empty. Maximum 25,000 characters.
</ParamField>

<ParamField body="topic" type="string">
  Topic the tweet is about. Used for composition guidance. Maximum 500 characters (silently truncated if longer).
</ParamField>

<ParamField body="goal" type="string">
  Optimization goal. One of: `engagement`, `followers`, `authority`, `conversation`. Invalid values are silently ignored.
</ParamField>

## Response

<Tabs>
  <Tab title="201 Created">
    <ResponseField name="id" type="string">Unique draft ID.</ResponseField>
    <ResponseField name="text" type="string">The draft tweet text.</ResponseField>
    <ResponseField name="topic" type="string">Topic the tweet is about. Omitted if not set.</ResponseField>
    <ResponseField name="goal" type="string">Optimization goal. Omitted if not set.</ResponseField>
    <ResponseField name="createdAt" type="string">ISO 8601 creation timestamp.</ResponseField>
    <ResponseField name="updatedAt" type="string">ISO 8601 last update timestamp.</ResponseField>

    ```json theme={null}
    {
      "id": "42",
      "text": "Just shipped dark mode. What feature should we build next?",
      "topic": "product update",
      "goal": "conversation",
      "createdAt": "2026-02-24T10:30:00.000Z",
      "updatedAt": "2026-02-24T10:30:00.000Z"
    }
    ```
  </Tab>

  <Tab title="400 Invalid Input">
    ```json theme={null}
    { "error": "invalid_input" }
    ```

    Missing or empty `text` field.
  </Tab>

  <Tab title="401 Unauthenticated">
    ```json theme={null}
    { "error": "unauthenticated" }
    ```

    Missing or invalid API key.
  </Tab>

  <Tab title="429 Rate Limited">
    ```json theme={null}
    { "error": "rate_limit_exceeded", "message": "Too many requests. Try again later.", "retryAfter": 60 }
    ```

    Too many requests. Wait for the `Retry-After` header before retrying.
  </Tab>
</Tabs>

<Note>
  **Next steps:** [List Drafts](/api-reference/drafts/list) to see all your drafts, [Get Draft](/api-reference/drafts/get) to fetch a specific draft, or [Delete Draft](/api-reference/drafts/delete) to remove one.
</Note>
