---
name: mailtoapi-agent
description: Configure MailToAPI inboxes for apps that need to receive structured API calls when emails arrive.
---

# MailToAPI Agent Skill

Use this skill when a user wants an app to receive structured JSON from forwarded emails.

## Workflow

1. Read `https://mailtoapi.app/llms.txt`, `https://mailtoapi.app/docs/api.md`, and `https://mailtoapi.app/openapi.json`.
2. If the user has not provided a bearer key, ask them to sign in at https://app.mailtoapi.app, open Settings -> Agent, create an agent key, and paste the token back.
3. Ask for the destination endpoint URL and any required headers. If they do not have one, tell them to use the dashboard Connect app snippet generator.
4. Define a flat JSON schema with string, number, boolean, date, or enum fields.
5. Call `POST /api/v1/inboxes` with the schema and destination.
6. Show the generated address, usually `name@in.mailtoapi.app`.
7. Ask the user to send one test email to the generated address.
8. Poll `GET /api/v1/runs` and inspect `GET /api/v1/runs/{id}` until the test email is delivered or a fix is needed.
9. Use `POST /api/v1/runs/{id}/replay` after the user edits JSON or fixes the destination API.

## Rules

- MailToAPI sends extracted JSON only, no envelope.
- One email credit is consumed when an inbound email run is processed, before extraction starts.
- Manual replay of the same run does not consume another email credit.
- Out-of-credit emails are held and require manual replay after top-up.
- Do not configure attachment extraction for v1.
- Do not ask the user for their magic-link URL or email account access.
- Do not create an inbox until the user confirms the JSON fields and destination URL.
