# Check eligibility in a batch

Page: https://app.myclaimhouse.com/docs/api/createEligibilityBatch

`POST /api/v1/eligibility/batches`

Runs up to 200 eligibility checks together: each item of checks is a check request exactly as POST /eligibility takes it, and becomes an ordinary check (billed and reported as any other) once the batch runs. The shape of every item is checked when you post: a request with a malformed item is refused as a whole, naming the item. A check's own rules (the service date range, the office and the payer) are applied when the item runs, so an item that breaks one is listed as failed with the code validation and the others still run. The reply is the batch, running (202); read it by its ID for progress and for each item's check. Needs an Idempotency-Key header and a key with the submit permission. A live key without a network is refused as a single check is.

Needs a key with `submit` permission.

## Request

### Headers

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `Idempotency-Key` | string | Yes | Makes the request safe to repeat: a request with the same key and body returns the first answer (the reply has an idempotent-replayed header), and the same key with a different request is refused. 1 to 255 printable characters; a UUID is a good choice. At least 1 character. At most 255 characters. Matches `^[\x21-\x7e]{1,255}$`. |

### Body

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `description` | value | No | A name for the batch, up to 120 characters. |
| `checks` | array of object | Yes | 1 to 200 check requests, each as POST /eligibility takes it. At most 200 items. |
| `checks[].office_id` | string | No | The office the check is for (off_...), from GET /offices. Its mode must match the key. Optional when your organization has exactly one office in the key's mode, test or live: that office is used. |
| `checks[].payer_id` | string | Yes | The payer: a Claim House payer ID (pyr_...), a payer ID or an alias from the payer directory. |
| `checks[].subscriber` | object | Yes | The plan holder. |
| `checks[].subscriber.first_name` | string | Yes | The subscriber's first name. At most 120 characters. |
| `checks[].subscriber.last_name` | string | Yes | The subscriber's last name. At most 120 characters. |
| `checks[].subscriber.date_of_birth` | string (date) | Yes | YYYY-MM-DD. |
| `checks[].subscriber.member_id` | string | Yes | The subscriber's member ID. In test mode it chooses the sandbox scenario. At most 80 characters. |
| `checks[].subscriber.group_number` | string or null | No | The plan group number. At most 80 characters. |
| `checks[].patient` | object or null | No | The patient, when a dependent is being checked. Leave it out when the subscriber is the person being checked. |
| `checks[].patient.first_name` | string | Yes | The patient's first name. At most 120 characters. |
| `checks[].patient.last_name` | string | Yes | The patient's last name. At most 120 characters. |
| `checks[].patient.date_of_birth` | string (date) | Yes | YYYY-MM-DD. |
| `checks[].patient.relationship` | string | Yes | How the patient relates to the subscriber: spouse, child, other. One of: `spouse`, `child`, `other`. |
| `checks[].service_date` | string (date) or null | No | YYYY-MM-DD, within 12 months of today. Default: today, in the office's time zone. |
| `checks[].procedure_codes` | array of string or null | No | Up to 10 CDT codes (D followed by 4 digits) to get coverage detail for. At most 10 items. Each item matches `^D\d{4}$`. |
| `checks[].detail_level` | string or null | No | One of standard, enhanced. Default: standard. One of: `standard`, `enhanced`. |
| `checks[].tenant_reference` | string or null | No | Your own reference for the check, returned with it. Up to 255 characters. At most 255 characters. |
| `checks[].parent_id` | value | No | The rejected check this one corrects (elg_...), when resending it with the fixes. |

## Response

The batch, running. Status `202`.

| Name | Type | Description |
| --- | --- | --- |
| `id` | string | An ID that starts with elb_. |
| `object` | string | Always `eligibility_batch`. |
| `state` | string | running: checks are still to run. completed: every check ran. cancelled: stopped; the checks not yet run were skipped. One of: `running`, `completed`, `cancelled`. |
| `source` | string | patients: started from the Patients list in the dashboard. api: started with POST /eligibility/batches. One of: `patients`, `api`. |
| `description` | value | The name given to the batch, when there was one. |
| `counts` | object |  |
| `counts.total` | integer | At least -9007199254740991. |
| `counts.completed` | integer | Checks that were made and answered. At least -9007199254740991. |
| `counts.failed` | integer | Checks that were rejected, could not be made, or ended in an error. At least -9007199254740991. |
| `counts.skipped` | integer | Checks that were not made (the batch was cancelled). At least -9007199254740991. |
| `counts.queued` | integer | Checks still to run, including the one running. At least -9007199254740991. |
| `service_date` | string (date) or null |  |
| `procedure_codes` | array of string or null |  |
| `request_id` | string or null | The API request that made the batch; null for one made in the dashboard. |
| `idempotency_key` | value |  |
| `created_at` | string (date-time) |  |
| `completed_at` | string (date-time) or null |  |
| `items` | array of object |  |
| `items[].position` | integer | The place of the check in the batch, from 1. At least -9007199254740991. |
| `items[].state` | string | One of: `queued`, `running`, `completed`, `failed`, `skipped`. |
| `items[].check_id` | string or null | The eligibility check this item made; read it with GET /eligibility/{id}. |
| `items[].patient_id` | string or null | An ID that starts with pat_. |
| `items[].failure` | object or null |  |
| `items[].failure.code` | string | One of: `rejected`, `payer_unavailable`, `error`, `unavailable`, `validation`, `forbidden`, `cancelled`. |
| `items[].failure.message` | value |  |
| `items[].started_at` | string (date-time) or null |  |
| `items[].finished_at` | string (date-time) or null |  |

## Errors

| HTTP status | Code | What it means |
| --- | --- | --- |
| 401 | `UNAUTHORIZED` | A valid API key is required. Send it as "Authorization: Bearer <key>". |
| 403 | `PERMISSION_DENIED` | This API key is not allowed to do that. |
| 422 | `INVALID_REQUEST` | The request is not valid. |
| 400 | `IDEMPOTENCY_KEY_REQUIRED` | This request needs an Idempotency-Key header: a value you make up (a UUID is good), new for each new request. |
| 400 | `IDEMPOTENCY_KEY_INVALID` | The Idempotency-Key header must be 1 to 255 printable characters. |
| 422 | `IDEMPOTENCY_KEY_REUSED` | That Idempotency-Key was already used with a different request. |
| 409 | `IDEMPOTENCY_KEY_IN_USE` | A request with that Idempotency-Key is still running. Send it again with the same key after Retry-After seconds. |
| 429 | `TOO_MANY_REQUESTS` | Too many requests of this kind lately. Wait, then try again. |
| 413 | `PAYLOAD_TOO_LARGE` | The request body is larger than 1 MB. |
| 504 | `TIMEOUT` | The request took too long. Send it again with the same Idempotency-Key and body after Retry-After seconds: a 409 means it is still finishing (wait and send again), and any other answer is final. If this 504 comes back, find what the request made by listing with ?idempotency_key=<the key>. |
| 503 | `ELIGIBILITY_UNAVAILABLE` | Eligibility checks are not available in live mode yet. Use a test key. |
| 500 | `INTERNAL` | Something went wrong on our side. Quote the request ID if you contact us. |

## Example

### Example request

```bash
curl -X POST "https://app.myclaimhouse.com/api/v1/eligibility/batches" \
  -H "Authorization: Bearer $CLAIMHOUSE_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
  "description": "Tomorrow'\''s schedule",
  "checks": [
    {
      "office_id": "off_01JM000000E008000000000003",
      "payer_id": "pyr_01JM000000E008000000000004",
      "subscriber": {
        "first_name": "Alex",
        "last_name": "Example",
        "date_of_birth": "1985-04-12",
        "member_id": "CH-ACTIVE-FULL",
        "group_number": "GRP-100"
      },
      "service_date": "2026-03-10",
      "procedure_codes": [
        "D0120",
        "D1110"
      ],
      "tenant_reference": "visit-1042"
    },
    {
      "office_id": "off_01JM000000E008000000000003",
      "payer_id": "pyr_01JM000000E008000000000004",
      "subscriber": {
        "first_name": "Alex",
        "last_name": "Example",
        "date_of_birth": "1985-04-12",
        "member_id": "CH-NOT-FOUND",
        "group_number": "GRP-100"
      },
      "service_date": "2026-03-10",
      "procedure_codes": [
        "D0120",
        "D1110"
      ],
      "tenant_reference": "visit-1042"
    }
  ]
}'
```

### Example response: 202

```json
{
  "id": "elb_01JM000000E00800000000003G",
  "object": "eligibility_batch",
  "state": "running",
  "source": "api",
  "description": "Tomorrow's schedule",
  "counts": {
    "total": 2,
    "completed": 0,
    "failed": 0,
    "skipped": 0,
    "queued": 2
  },
  "service_date": null,
  "procedure_codes": null,
  "request_id": "req_01JM000000E00800000000003H",
  "idempotency_key": "schedule-2026-03-10",
  "created_at": "2026-03-10T15:29:59.900000+00:00",
  "completed_at": null,
  "items": [
    {
      "position": 1,
      "state": "queued",
      "check_id": null,
      "patient_id": null,
      "failure": null,
      "started_at": null,
      "finished_at": null
    },
    {
      "position": 2,
      "state": "queued",
      "check_id": null,
      "patient_id": null,
      "failure": null,
      "started_at": null,
      "finished_at": null
    }
  ]
}
```
