Quickstart

Everything below works with curl and nothing else. Every step is also an MCP tool of the same name; see MCP.

1. Get a sandbox

curl -s -X POST https://api.emailimport.com/sandbox | tee sandbox.json
export MXIMP_KEY=$(jq -r .key sandbox.json)

The response has key, http.base_url, mcp_url, and expires_at. Two starter buckets are already configured: support-requests and customer-orders.

2. Ingest an email

Any .eml file (raw RFC 822, as exported from a mail client or saved by a mail server):

curl -s -X POST https://api.emailimport.com/v1/messages/ingest \
  -H "authorization: Bearer $MXIMP_KEY" \
  -H "content-type: message/rfc822" \
  --data-binary @message.eml

Or a quick synthetic one:

curl -s -X POST https://api.emailimport.com/v1/messages/ingest \
  -H "authorization: Bearer $MXIMP_KEY" \
  -H "content-type: application/json" \
  -d '{"eml":"From: Dana <dana@brightleaf.example>\nTo: support@acme.example\nSubject: Help: login not working\n\nThis is urgent.\n\nAccount #: BL-4471\n"}'

The response is the pipeline result: classification (which bucket and why), capture (every field with value, confidence, and where in the text it came from), tasks (if a person is needed), sanitization flags, and next (what to do about it).

3. Look at what happened

curl -s https://api.emailimport.com/v1/messages -H "authorization: Bearer $MXIMP_KEY"
curl -s https://api.emailimport.com/v1/captures -H "authorization: Bearer $MXIMP_KEY"
curl -s https://api.emailimport.com/v1/tasks -H "authorization: Bearer $MXIMP_KEY"

4. Make a bucket of your own

Test the rule against a stored message first, then create the bucket.

curl -s -X POST https://api.emailimport.com/v1/dry-run/rule \
  -H "authorization: Bearer $MXIMP_KEY" -H "content-type: application/json" \
  -d '{"rule":{"any":[{"address":"coi@"},{"attachment_text_contains":["CERTIFICATE OF LIABILITY INSURANCE"]}]},"message_ids":["<id>"]}'

curl -s -X POST https://api.emailimport.com/v1/buckets \
  -H "authorization: Bearer $MXIMP_KEY" -H "content-type: application/json" \
  -d '{"name":"certificates","priority":10,"rule":{"any":[{"address":"coi@"},{"attachment_text_contains":["CERTIFICATE OF LIABILITY INSURANCE"]}]},"schema":{"fields":{"insured":{"type":"string","required":true,"extract":[{"kind":"labeled_value","labels":["Insured","Named insured"],"source":"attachments"}]},"expires":{"type":"date","extract":[{"kind":"labeled_value","labels":["Policy exp","Expiration"],"source":"attachments"}]}}}}'

Then reprocess a message that should now land there:

curl -s -X POST https://api.emailimport.com/v1/messages/<id>/reprocess -H "authorization: Bearer $MXIMP_KEY"

5. Deliver somewhere

curl -s -X POST https://api.emailimport.com/v1/destinations \
  -H "authorization: Bearer $MXIMP_KEY" -H "content-type: application/json" \
  -d '{"name":"main","url":"https://example.com/hooks/mximp","secret":"a-long-random-string"}'

curl -s -X PUT https://api.emailimport.com/v1/buckets/certificates \
  -H "authorization: Bearer $MXIMP_KEY" -H "content-type: application/json" \
  -d '{"destinations":["main"]}'

Applied captures are POSTed to the webhook, signed with the secret. See Destinations and events.

6. Keep it

Sandboxes expire. To keep addresses and data, create an account (coming with real mail receipt; see Sandbox and accounts).

This page as Markdown.