---
title: "Generate Inbox Draft"
method: POST
path: "/inbox/drafts/generate"
tags: ["AI Inbox"]
---

# Generate Inbox Draft

`POST /inbox/drafts/generate`

## Request

- Base URL: `https://be.graph8.com/api/v1`
- URL: `https://be.graph8.com/api/v1/inbox/drafts/generate`
- Auth: HTTP bearer

Write or rewrite a message with the model. THIS SPENDS CREDITS.

DELIVERS NOTHING. It returns text; sending it is a separate, `external`
call. Classified `billable` (`inbox:run`) because it charges - 402 when
the organisation has no credits left.

ONE CHARGE PER CALL, including a multi-operation call: pass a LIST in
`operation` to apply several transforms in a single generation rather than
paying per transform.

`generate_from_scratch` is the only operation that does not need
`message_html`; give it either a `conversation_id` + `channel_type` to
ground the reply in the thread, or free-text `instructions` to write
something with no thread at all.

Wider than the already-published `GET /inbox/{reply_id}/draft`, which only
ever generates from scratch on an existing thread.

## Headers

- `Authorization` string, nullable
- `X-Target-Org-Id` string, nullable

## Request body

- AiDraftGenerateRequest: Ask the model to write or rewrite a message. THIS SPENDS CREDITS. One charge per call, including a multi-operation call: pass a LIST in `operation` to apply several transforms in a single generation rather than paying for each. Nothing here is delivered anywhere - it returns text. Sending it is a separate call.
  - `conversation_id` string, nullable: Ground the draft in this thread's history.
  - `channel_type` 'email' | 'heyreach' | 'sms', nullable: Required alongside `conversation_id`. `heyreach` is the LinkedIn channel and additionally needs `linkedin_account_id`.
  - `linkedin_account_id` integer, nullable
  - `message_html` string: The text to transform. Required by every operation except `generate_from_scratch`.
  - `operation` union, required: One operation, or several applied together in a single charged call.
    - 'change_tone' | 'fix_grammar_spelling' | 'change_objective' | 'expand' | 'shorten' | 'change_persona' | 'generate_from_scratch'
    - string[]
  - `tone` 'professional' | 'friendly' | 'casual' | 'assertive' | 'empathetic' | 'urgent', nullable
  - `objective` 'book_meeting' | 'follow_up' | 're_engage' | 'provide_value' | 'handle_objection' | 'close_deal', nullable
  - `persona` 'sdr' | 'growth_manager' | 'account_executive' | 'customer_success' | 'founder', nullable
  - `instructions` string, nullable: Free-text prompt. With `generate_from_scratch` this writes a message with no thread at all.

## Response `200`

Successful Response

- ApiResponseInboxPayload
  - `data` InboxPayload, required: An open envelope for a comment, an assignment or a workspace. Open because a comment carries attachment refs and mention metadata that grow, and because an assignment result reports per-assignee outcomes.
  - `pagination` PaginationMeta
    - `page` integer, required: Current page number (1-indexed)
    - `limit` integer, required: Items per page
    - `total` integer, required: Total number of items
    - `has_next` boolean, required: Whether there are more pages
    - `next_cursor` string, nullable: Opaque cursor for the next page; null when there are no more items. Pass it back as the `cursor` query param to fetch the following page without computing page numbers.
    - `total_available` integer, nullable: Search endpoints only: how many records really match, when known. Can be larger than `total`, which is capped at the 10,000 results that can be paged. For company search this is a distinct-company estimate. Null when unknown; absent outside search.
    - `total_is_lower_bound` boolean, nullable: Search endpoints only: true when more records match than `total` shows (the result set is larger than the 10,000 results that can be paged). Absent outside search.
    - `notes` string[], nullable: Search endpoints only: plain-language notes about the result, e.g. that more records match than can be paged, or that a reversed `between` range was put in order.

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/graph8/apis/graph8-developer-api.md) · [All operations](https://skmtc.dev/graph8/apis/graph8-developer-api/llms.txt) · [OpenAPI document](https://skmtc.dev/graph8/apis/graph8-developer-api/revisions/89fc11143b70?raw)
