---
title: "Generate AI subject lines for many leads (async batch)"
method: POST
path: "/v1/ai/subject/batch"
tags: ["AI Personalization"]
---

# Generate AI subject lines for many leads (async batch)

`POST /v1/ai/subject/batch`

## Request

- Base URL: `https://api.meirra.com`
- URL: `https://api.meirra.com/v1/ai/subject/batch`
- Auth: one of:
  - HTTP bearer
  - API key in header `x-api-key`
- TypeScript: <https://skmtc.dev/meirra/apis/meirra-api/docs/v1/ai/subject/batch/post.ts> (a function with typed inputs; its response is checked against the schema)

Creates an async job. The create call is not charged; each successful lead is charged when the job processes it. The whole batch must be affordable or the call returns 402. Poll `pollUrl` (GET /v1/jobs/{id}) for results.

## Headers

- `Idempotency-Key` string

## Request body

- BatchGenerateAiSubjectsRequest
  - `leads` object[], required
    - `leadId` string, uuid, required
    - `locale` string
    - `mode` 'native' | 'translate'

## Response `200`

Success

- AiBatchResponse
  - `success` boolean
  - `data` object
    - `jobId` string, uuid
    - `status` string
    - `pollUrl` string
    - `estimatedCost` AiCost
      - `credits` integer
      - `pence` integer

## Other responses

- `400`: The request is invalid: VALIDATION_ERROR (body fails the schema; see `details`), INVALID_REQUEST (body is not JSON, or a bad parameter), INVALID_IDEMPOTENCY_KEY, or CONFLICTING_API_KEYS (the two key headers differ).
- `401`: MISSING_API_KEY, INVALID_API_KEY (malformed, unknown or revoked) or INVALID_AUTHORIZATION_HEADER (not a single Bearer token).
- `402`: INSUFFICIENT_BALANCE (add credit, then retry) or PAYMENT_FAILED (the account has an unpaid payment). The call did not run and nothing was charged.
- `403`: IP_NOT_ALLOWED: the caller is outside the key's IP allowlist. On /v1/jobs/{id}, ACCESS_DENIED: the job belongs to another account.
- `409`: IDEMPOTENCY_KEY_CONFLICT: this Idempotency-Key was used with a different request body.
- `429`: RATE_LIMIT_EXCEEDED: more than 1000 requests per key per endpoint per hour. Wait `Retry-After` seconds.
- `500`: SERVICE_ERROR: an internal error. Not charged.
- `503`: BALANCE_UNAVAILABLE (the balance could not be checked; nothing was charged) or an upstream provider is unavailable. Retry after `Retry-After` seconds when present.

## Changes

- **2026-11-11** `fe00e1fbf676`: 6 breaking, 2 warning, 42 info
  - the `error` response's property type changed from `string` to `object` for status `400`
  - the `error` response's property type changed from `string` to `object` for status `401`
  - the `success` response's property type changed from `boolean` to no type for status `400`
  - the `success` response's property type changed from `boolean` to no type for status `401`
  - …46 more
- **2026-11-08** `a487d818c900`: 2 info
  - added the optional property `error/details/items/code` to the response with the `402` status
  - added the optional property `error/details/items/code` to the response with the `429` status
- **2026-11-01** `292da843ca31`: 1 info
  - the endpoint scheme security `bearerAuth` was added to the API

[Operation history](https://skmtc.dev/meirra/apis/meirra-api/changes/v1/ai/subject/batch/post.md)

---

[API](https://skmtc.dev/meirra/apis/meirra-api.md) - [All operations](https://skmtc.dev/meirra/apis/meirra-api/llms.txt) - [OpenAPI document](https://skmtc.dev/meirra/apis/meirra-api/revisions/fe00e1fbf676?raw)
