# Write a DM opener for a lead with Xholic

> Have Xholic's AI write an opening DM for one lead from get_leads, from what they posted and the account's voice. Returns the stored opener for free when there is one; pass regenerate true for a new one. Use only when the user asks for Xholic to write it; otherwise write it yourself. Spends Xholic AI credits when it writes: quote first, show it to the user, and pass confirmCredits after they agree. Nothing is sent.

`leads.write_opener` · write

- **MCP tool:** `leads_write_opener`. Catalog: reach it with `find_actions` and `run_write_action`, or turn on the full toolset.
- **REST:** `POST /v1/leads/write-opener`
- **CLI:** `xholic leads write-opener`
- **Scope:** `write`
- **Plan:** Every plan, including the trial
- **Cost:** Xholic AI: up to about 3 credits (Xholic AI DM opener for this lead (free when one is stored)). Returns a quote first; pass `confirmCredits` after the user agrees.
- **Rate limit bucket:** `write`

## Input

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string (uuid) | Yes | Lead id from get_leads. |
| `regenerate` | boolean | No | Write a new opener even when one is stored. |
| `account` | string ≤ 64 chars | No | X account to act on, as @handle. Leave it out to use the connection's default account. |
| `note` | string ≤ 20000 chars | No | Optional, on any tool: one or two sentences for Xholic's shared memory about what the user just decided, asked for or said about themselves or their plans (e.g. "Dropping threads for now; focusing on replies to founders"). Every AI the user connects reads it, so they never repeat themselves. In your words, never other people's posts. Leave it out when nothing new was said. |
| `dryRun` | boolean | No | Return exactly what would happen without doing it. |
| `idempotencyKey` | string ≤ 200 chars | No | A unique key for this write. Repeating a call with the same key returns the first result instead of acting twice. |
| `confirmCredits` | number 0–100000 | No | Xholic AI credits the user agreed to spend. Call first without it to get the quote, show the quote to the user, and pass the amount only after they say yes. |
| `quoteId` | string ≤ 100 chars | No | The quoteId from the quote the user agreed to. Send it with confirmCredits. |
