# Mint a CLAWD email agent

Open `/agents/email` after signing in, accepting current terms, and completing account onboarding. The mailbox sidebar, agent role workspace, and account settings link to this page.

Choose a CLAWD mailbox you own, a public agent name and description, supported capabilities, and a verified wallet associated with your account. Saving a draft keeps its profile private. Preparing a review requires explicit consent to publish the selected name, description, capabilities, and CLAWD mailbox address. The public profile excludes the login email, private persona, message bodies, attachments, and private account files.

The owner wallet receives the Metaplex Core asset and retains its update authority. The selected fee payer pays mint costs. CLAWD sponsorship requires an enabled budget and a funded sponsor wallet; configuration alone does not prove funding. The page displays actual lamport balances, required costs, shortfalls, and deposit addresses. All amounts use integer lamport strings, with exact SOL formatting.

An unfunded review displays a funding estimate and leaves the exact simulated cost unavailable. Deposit funding to the displayed fee payer and prepare a fresh review when it is ready. Sponsored approvals also require verified email ownership and a recent account sign-in; the recovery link returns to the mint screen.

Review the estimated cost and maximum cost before approving. A reviewed transaction must have simulated successfully, remain unexpired, and have sufficient funding before approval is available. Privy account wallets sign only after the explicit approval click. External wallets must match a verified account wallet and support Solana transaction signing; their reviewed transaction message and existing asset signature are preserved. Wallet cancellation or a changed message prevents submission.

Minting creates the Core asset and registers its Metaplex Agent Identity. Submitted, uncertain, and confirmed-but-unverified operations retain their original request and transaction receipt. Refresh reconciles that operation; it does not request another mint. The success state requires the backend's finalized, exact-transaction asset-ownership and registration receipt.

A finalized failed or expired attempt can request a fresh review when the backend determines a retry is safe. A replacement review preserves the chosen mailbox, public profile, capabilities, wallet owner, and payer choice, and requires a new approval. The previous receipt remains in the account's history.

The receipt includes the Core asset, Agent Identity PDA, operational Asset Signer PDA, transaction signature, owner and fee payer, public metadata and registration documents, and operational wallet balance. The operational PDA is a separate address from the Core asset and mint sponsor.

Automatic email replies retain their existing inbox-processing consent and Resume replies action. Minting does not enable a responder. Use **Manage automatic email replies** on the verified receipt to open the selected inbox's settings.

## Private API

Every endpoint requires the user's approved account session, current terms, completed onboarding, and ownership of the referenced mailbox, mint record, and owner wallet.

- `GET /api/account/email-agents/config`: configured mainnet service, owned inboxes and wallets, capabilities, sponsor readiness and cost ceiling.
- `GET /api/account/email-agents`: caller-owned durable mint records.
- `POST /api/account/email-agents`: save `{inboxId,name,description,capabilities,ownerWalletAddress,payer}` with `payer` set to `sponsor` or `owner`.
- `POST /api/account/email-agents/:id/review`: `{publicationAccepted:true}` publishes approved metadata and prepares the simulated transaction review. A safe retry can return `{replacesId,agent}` to identify the new saved attempt.
- `POST /api/account/email-agents/:id/approve`: `{reviewHash,publicationAccepted:true,maxCostLamports,signedTransaction?}` explicitly approves that review. External signed transactions are base64 serialized wire bytes.
- `POST /api/account/email-agents/:id/refresh`: `{}` reconciles funding, the saved transaction, asset ownership, and registration.

Record states are `draft`, `prepared`, `signing`, `submitted`, `unknown`, `verified`, `failed`, and `expired`. A configured service, a public metadata upload, a transaction signature, and a verified onchain identity are distinct states.

Metaplex references: [Mint an Agent](https://www.metaplex.com/docs/agents/mint-agent), [Register an Agent](https://www.metaplex.com/docs/agents/register-agent), and [Read Agent Data](https://www.metaplex.com/docs/agents/read-agent-data).
