# emails.submitBatch

Submit original RFC822 emails using idempotencyKey and emails [{rawEmail,filename,metadata}]. Up to 20 emails and 3 MB total per request. Claimed sender metadata never authorizes a different user. Preserves original email bytes and returns processing jobs.

`POST /api/v1/accounting/emails.submitBatch`

Permissions: `accounting:read`, `accounting:write` · Roles: admin, finance, contributor · Idempotency key required

MCP tool: `accounting_submit_emails`

## Fields

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `idempotencyKey` | string | Yes | Any unique text you generate once per intended change, so a retried request only happens once. Send it as the Idempotency-Key header instead if you prefer; if you send both they must match. 8–160 characters. |
| `emails` | array of objects | Yes | 1–20 items. |
| `emails[].rawEmail` | string | Yes | 1–2000000 characters. |
| `emails[].filename` | string |  | The file's name, including its extension. at most 255 characters. Default `"original.eml"`. |
| `emails[].metadata` | map |  |  |

## Example request

```bash
curl https://app.getoatmilk.com/api/v1/accounting/emails.submitBatch \
  -H "Authorization: Bearer $OATMILK_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
  "emails": [
    {
      "rawEmail": "finance@example.com"
    }
  ]
}'
```

Reference page: https://app.getoatmilk.com/docs/api/emails.submitBatch
