Skip to main content

Batch Analysis API

Submit multiple resume–job pairs in a single request. Each item runs through the same premium analysis pipeline used by the single-analysis endpoint.

Authentication

Miri-Api-Key: miri_live_sk_xxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Every batch request must include a valid MIRI API key. Use X-Request-ID to deduplicate accidental retries at the batch level.

Create Batch

Endpoint

POST /public/v1/analyses/batch

Headers

Miri-Api-Key: miri_live_sk_xxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Content-Type: application/json
X-Request-ID: 3f3e6d77-9ad3-4ec8-81ad-308b74fb8193 (optional)

Request Body

Content encoding

Each item follows the single-analysis rules: text/html payloads use UTF-8, while pdf/docx payloads are base64-encoded. The total request payload must remain under 10 MB.

{
"analyses": [
{
"referenceId": "candidate-001",
"resumeData": {
"type": "pdf",
"content": "UEsDBBQABgAIAAAAIQAAAAAAAAAAAAAAAAAJAAAAdXJsLnR4dFxTZW5pb3IgQmFja2VuZCBFbmdpbmVlciAtIFJlc3VtZSBFeGNlcnB0cy4uLg=="
},
"jobPostingData": {
"type": "html",
"content": "<h1>Principal Backend Engineer</h1><p>Lead scalable services...</p>"
}
}
],
"options": {
"parallel": 20,
"webhook": {
"url": "https://partner.example.com/webhooks/batch",
"secret": "optional-hmac-secret"
}
}
}

Field Reference

FieldTypeRequiredDescription
analysesarrayYes1–100 analysis items.
analyses[].referenceIdstringYesPartner-defined identifier echoed in status responses.
analyses[].resumeDataobjectYesSame schema as the single Analysis API.
analyses[].resumeData.contentstringYesUTF-8 text/HTML, or base64-encoded binary when type is pdf/docx (counts toward the 10 MB limit).
analyses[].jobPostingDataobjectYesSame schema as the single Analysis API.
analyses[].jobPostingData.contentstringYesUTF-8 text/HTML, or base64-encoded binary when type is pdf/docx.
optionsobjectNoBatch-wide settings.
options.parallelintegerNoMaximum concurrent workers (1–50, default 10).
options.webhookobjectNoBatch-level webhook configuration.
options.webhook.urlstringYesHTTPS endpoint.
options.webhook.secretstringNoOptional signing secret.

Response (202 Accepted)

{
"success": true,
"data": {
"id": "b59c996e-4d0e-4c08-840a-5a0b4b2bb691",
"status": "QUEUED",
"totalCount": 25,
"estimatedTime": 750,
"createdAt": "2025-09-19T10:15:23.456Z",
"webhook": {
"url": "https://partner.example.com/webhooks/batch",
"delivery": {
"state": "PENDING",
"lastAttemptAt": null,
"lastStatusCode": null,
"attemptCount": 0,
"lastError": null
}
},
"links": {
"self": "/public/v1/analyses/batch/b59c996e-4d0e-4c08-840a-5a0b4b2bb691",
"cancel": "/public/v1/analyses/batch/b59c996e-4d0e-4c08-840a-5a0b4b2bb691"
},
"metadata": {
"creditsUsed": 25
}
},
"message": null,
"code": "SUCCESS",
"metadata": null
}

Response Fields

FieldTypeDescription
idstringBatch identifier for status polling.
totalCountintegerNumber of analyses submitted.
estimatedTimeintegertotalCount × 30 seconds. Not recalculated after acceptance.
webhookobject/nullEcho of the configured batch webhook plus delivery telemetry.
links.selfstringStatus URL for the batch.
links.cancelstringCancellation URL (same as self).
metadata.creditsUsedintegerCredits reserved (equal to totalCount). Omitted while the batch is pending or if reservation fails.
Credit usage

Credits are reserved for every item when the batch is accepted. Actual deductions happen as each underlying analysis completes successfully; items that fail are automatically refunded.

Check Batch Status

Endpoint

GET /public/v1/analyses/batch/{batchId}

Response (200 OK)

{
"success": true,
"data": {
"id": "b59c996e-4d0e-4c08-840a-5a0b4b2bb691",
"status": "PROCESSING",
"totalCount": 25,
"completedCount": 12,
"failedCount": 1,
"progressPercentage": 52,
"items": [
{
"referenceId": "candidate-001",
"status": "COMPLETED",
"analysisId": "0199f6ac-5c23-41b0-904b-6b9f7c5f2c11",
"error": null
},
{
"referenceId": "candidate-002",
"status": "FAILED",
"analysisId": null,
"error": {
"code": "PROCESSING_ERROR",
"message": "Input validation failed"
}
}
],
"createdAt": "2025-09-19T10:15:23.456Z",
"startedAt": "2025-09-19T10:15:24.010Z",
"completedAt": null,
"webhook": {
"url": "https://partner.example.com/webhooks/batch",
"delivery": {
"state": "PENDING",
"lastAttemptAt": null,
"lastStatusCode": null,
"attemptCount": 0,
"lastError": null
}
},
"links": {
"self": "/public/v1/analyses/batch/b59c996e-4d0e-4c08-840a-5a0b4b2bb691",
"cancel": "/public/v1/analyses/batch/b59c996e-4d0e-4c08-840a-5a0b4b2bb691"
},
"metadata": {
"creditsUsed": 25
}
},
"message": null,
"code": "SUCCESS",
"metadata": null
}

Field Reference

FieldTypeDescription
statusstringQUEUED, PROCESSING, COMPLETED, PARTIAL, FAILED, or CANCELLED.
completedCountintegerNumber of items that finished successfully.
failedCountintegerNumber of items with terminal failure.
progressPercentageintegerRounded percent completion across all items.
items[].statusstringPENDING, PROCESSING, COMPLETED, or FAILED.
items[].analysisIdstring/nullID of the single-analysis job (set after creation).
items[].errorobject/nullFailure details—code values include PROCESSING_ERROR and CANCELLED.
metadata.creditsUsedintegerCredits reserved across the batch.
Credit reservation

metadata.creditsUsed reflects the total credits reserved for the batch. Each underlying analysis deducts its credit only when it completes successfully; entries marked FAILED are automatically refunded.

Cancel Batch

DELETE /public/v1/analyses/batch/{batchId}
  • Returns 204 No Content when the cancellation request is accepted.
  • Allowed while status is QUEUED or PROCESSING.
  • Pending items transition to FAILED with error.code = "CANCELLED".

Sandbox Endpoints

Validate integrations without consuming credits.

Create Sandbox Batch

POST /public/v1/analyses/batch/test-run
  • Request schema matches the production endpoint.
  • Always returns deterministic sample items with metadata.creditsUsed = 0.
  • Sandbox batches expire after 10 minutes (NOT001).

Retrieve Sandbox Batch

GET /public/v1/analyses/batch/test-run/{batchId}

Sandbox analysis IDs are only valid for sandbox flows and are rejected by live endpoints.

Webhook Events

When options.webhook.url is provided, the service emits:

  • analysis.completed and analysis.failed for each item.
  • batch.completed once every item is in a terminal state (COMPLETED, PARTIAL, FAILED, or CANCELLED).

Delivery attempts follow the same policy as the single Analysis API: up to three retries with a fixed two-second interval, and delivery telemetry is reflected in the webhook.delivery object.

Error Codes

CodeHTTP StatusDescription
INVALID_API_KEY401Missing or malformed Miri-Api-Key.
AUTH001401API key authentication failed.
AUTH003403Key is suspended.
VAL001400Request body cannot be parsed.
VAL002400Batch payload missing required fields.
VAL003400Field validation failed (type mismatch, invalid size, etc.).
VAL004400Payload exceeds the size or batch-count limits.
BUS002402Insufficient credits to reserve the batch.
NOT001404Batch not found (live or sandbox).
SVC001503Temporary platform outage.
SVC002503Circuit breaker open.
SVC003503Downstream timeout.
INT001500Unexpected server error.