# mail.rerunMany

Process up to 50 emails again in one request, with items [{id, expectedRevision}], from (everything, reading or review, as in mail.rerun) and idempotencyKey. Each email gets its own job; returns queued [{id, jobId, generation}] and failed [{id, code, message}] so one stale or already-added email doesn't stop the rest.

`POST /api/v1/accounting/mail.rerunMany`

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

MCP tool: `accounting_mail_rerun_many`

## Fields

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `items` | array of objects | Yes | 1–50 items. |
| `items[].id` | string (ID) | Yes | The record's ID. |
| `items[].expectedRevision` | integer | Yes | The record's current revision, from the last time you read it. If someone changed the record since, the request is refused with a conflict so you can reload and check before trying again. at most 9007199254740991; greater than 0. |
| `from` | enum |  | The first date to include, as YYYY-MM-DD. One of: `everything`, `reading`, `review`. Default `"everything"`. |
| `reason` | string |  | A short note saying why, kept in the record's history. 1–500 characters. |
| `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. |

## Example request

```bash
curl https://app.getoatmilk.com/api/v1/accounting/mail.rerunMany \
  -H "Authorization: Bearer $OATMILK_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
  "items": [
    {
      "id": "9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d",
      "expectedRevision": 3
    }
  ]
}'
```

Reference page: https://app.getoatmilk.com/docs/api/mail.rerunMany
