> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://agentinbox.space/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://agentinbox.space/_mcp/server.

## Кратко

**API черновиков** — составляйте и ведите черновики до отправки: создавать, обновлять, планировать время отправки и отправлять, когда готово. Подходит агентам, которые собирают ответ по шагам, держат тред ответов или откладывают отправку.

### Что нового

**Новые endpoints:**

* `GET /drafts` — список черновиков (с фильтрами)
* `GET /drafts/{draft_id}` — получить черновик
* `POST /inboxes/{inbox_id}/drafts` — создать в ящике
* `PATCH /inboxes/{inbox_id}/drafts/{draft_id}` — обновить
* `POST /inboxes/{inbox_id}/drafts/{draft_id}/send` — отправить
* `DELETE /inboxes/{inbox_id}/drafts/{draft_id}` — удалить

**Возможности черновиков:**

* Поля to, cc, bcc, тема, текст и HTML
* Тред через `in_reply_to` и `references`
* Отложенная отправка через `send_at`
* Вложения и метки
* Список и фильтры по ящику, меткам, времени

### Сценарии

Собирайте агентов, которые:

* готовят многошаговые ответы перед отправкой
* планируют фоллоу-апы
* ставят исходящие в очередь и шлют пакетами
* правят черновик по новому контексту
* сохраняют корректные треды с `in_reply_to`

**`Python`**

```python title="Python"
from agentinbox import Agentinbox

client = Agentinbox(api_key="your-api-key")

# create a draft in an inbox
draft = client.inboxes.drafts.create(
    inbox_id="support@example.com",
    to=["user@example.com"],
    subject="Re: Your request",
    text="We're looking into it.",
    in_reply_to="<message-id@example.com>"
)

# update the draft
client.inboxes.drafts.update(
    inbox_id="support@example.com",
    draft_id=draft.draft_id,
    text="We've resolved your request."
)

# send the draft
client.inboxes.drafts.send(
    inbox_id="support@example.com",
    draft_id=draft.draft_id
)
```

**`TypeScript`**

```typescript title="TypeScript"
import { Agentinbox } from "agentinbox";

const client = new Agentinbox({ apiKey: "your-api-key" });

// create a draft in an inbox
const draft = await client.inboxes.drafts.create("support@example.com", {
  to: ["user@example.com"],
  subject: "Re: Your request",
  text: "We're looking into it.",
  inReplyTo: "<message-id@example.com>",
});

// update the draft
await client.inboxes.drafts.update(
  "support@example.com",
  draft.draftId,
  { text: "We've resolved your request." }
);

// send the draft
await client.inboxes.drafts.send("support@example.com", draft.draftId);
```

> **Note**
>
> Подробнее — в разделе [Черновики](https://agentinbox.space/drafts).