> Public product help. This page has no customer entries, projects, chat transcripts, API keys, or horizon contents.
> Reading that data requires `Authorization: Bearer` (a signed-in app session JWT, or a Headless access token).
> Do not call Supabase `/rest/v1` with a Headless JWT. Data reads go through `/casc/v1/headless/v1/rest`.

# Email Drafts

Compose collection-style or outreach emails in project chat, refine them in conversation, then save as a Zagger draft. Export markdown anytime, or push a draft into your personal Gmail Drafts folder (never auto-sends).

## Typical flow (accounts receivable)

1. Ingest AR / unpaid customer data into a horizon group and register search or analytics tools.
2. In project chat (or a workflow button), ask Zagger to list unpaid accounts and draft polite or escalating emails — one draft per recipient.
3. Refine tone and amounts in chat.
4. Call `save_email_draft` (or use the API) to persist each draft.
5. Download `.md` via `export_email_draft_md` / export API, and/or `save_email_draft_to_gmail` to create a Gmail draft.

## Chat tools

| Tool | Purpose |
| --- | --- |
| `save_email_draft` | Create or update a Zagger draft (`to`, `subject`, `body`, optional `tone`) |
| `export_email_draft_md` | Return markdown for a saved draft (no Google required) |
| `save_email_draft_to_gmail` | Create/update a Gmail draft for that row (requires `gmail.compose`) |

These tools are always available on the project global allowlist alongside horizon data tools. They never send mail.

## API

- `GET/POST /casc/v1/api/email-drafts/suffixes/:suffix` — list / create
- `GET/PATCH/DELETE .../:id` — read / update / delete
- `GET .../:id/export/md` — download markdown attachment
- `POST .../:id/gmail` — save to Gmail Drafts

## Google vs markdown

- **Markdown export:** no Google API or OAuth changes.
- **Gmail drafts:** enable Gmail API in Google Cloud, consent includes `gmail.compose`, then reconnect personal Google. See [google-auth](google-auth.md).

## Workflow prompt tip

Create a catalog prompt such as “AR collection drafts” whose system message tells the model to query unpaid accounts with horizon tools, draft escalating language by aging bucket, call `save_email_draft` once per recipient, and only call `save_email_draft_to_gmail` when the user explicitly asks to push to Gmail.
