# Article draft

> POST /api/generate/draft: an article outline as EditorJS blocks from a topic.

```text
POST https://api.prosecaptain.com/api/generate/draft?token=YOUR_TOKEN
```

Creates an article with a draft (outline) from a topic. The draft is in EditorJS block format. The article lands in your workspace, where you can expand it in the app.

## Request body

```json
{
  "context": "How to choose an AI chatbot for a service business",
  "title": "AI chatbots for service businesses",
  "keywords": ["AI chatbot", "customer service"],
  "toneOfVoice": "professional",
  "complexity": "moderate",
  "language": "english",
  "includeImages": true
}
```

| Field | Required | Description |
|---|---|---|
| `context` | yes | Topic or brief for the article. |
| `title` | no | Title, up to 120 characters. Defaults to the first line of `context`. |
| `articleId` | no | An existing article in your workspace to attach the draft to. |
| `includeImages` | no | Whether to generate a thumbnail. Default `true`. |

Plus the [common fields](/en/docs/article-api-auth/#common-fields).

## Response

```json
{
  "success": true,
  "article_id": "6f1c…",
  "draft": {
    "blocks": [
      { "type": "header", "data": { "text": "AI chatbots for service businesses", "level": 1 } },
      { "type": "paragraph", "data": { "text": "Introduction…" } }
    ],
    "version": "2.29.1"
  },
  "processing_time_ms": 41250,
  "workspace": { "id": "…", "name": "…" }
}
```

## Errors

| Status | `code` | Description |
|---|---|---|
| 400 | `validation_failed` | Invalid fields, details in `errors`. |
| 404 | `article_not_found` | `articleId` does not exist in your workspace. |
| 504 | `draft_generation_timeout` | Generation took too long. Try a shorter `context`. |
| 500 | `generation_failed` | Generation failed. Retry the request. |