Limai Docs
API ReferenceDocument Processing

Process Files (Bulk Async)

Queue multiple documents for asynchronous extraction in a single request.

POST/api/v1/document/{extractionSchemaId}/process-files-asyncASYNCBULK

Queue multiple documents for asynchronous processing in a single request. Each file is processed independently and you can poll for individual results using the get-file-data endpoint.

Parameters

NameTypeInRequiredDescription
extractionSchemaIdstringpathYesThe model's ID, the ID of a deployment that points at it, or the model's extraction schema ID. The extraction schema ID is returned when listing a project's deployments, and is also shown at the bottom of the data page in the dashboard.
fileIdsstring[]bodyYesArray of file IDs to process, at most 250 per request. Each must have been uploaded via the get-url endpoint.

Body parameters

Besides fileIds, every body parameter is optional. Sending only fileIds does not guarantee a clean run: any file extracted before with overrides has them stored on its job and applied again when you send none. See Extraction Overrides.

NameTypeInRequiredDescription
columnDescriptionsobjectbodyNoReplacement extraction instructions for this run, keyed by column ID. Applies to every file in the request.
tableInstructionsobjectbodyNoReplacement table instructions for this run, keyed by table ID. Applies to every file in the request; there is no per-file variant.
columnsOverrideobject[]bodyNoValues you supply yourself, applied to every file in the request. Each array item is a single-key object mapping one column ID to its value; the column is then not extracted.
columnDescriptionsByFileIdobjectbodyNoPer-file description overrides, keyed by file ID. For a file listed here, this replaces the request-level columnDescriptions entirely.
columnsOverrideByFileIdobjectbodyNoPer-file value overrides, keyed by file ID. For a file listed here, this replaces the request-level columnsOverride entirely.

These are per-request overrides: they change these extractions without editing the model's schema, and they persist on each document's job for later re-runs. See Extraction Overrides for shapes, precedence, and limits.

Request

const response = await fetch(
`https://app.limai.io/api/v1/document/${SCHEMA_ID}/process-files-async`,
{
  method: "POST",
  headers: {
    "Authorization": `Bearer ${API_TOKEN}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    fileIds: ["file_abc123", "file_def456", "file_ghi789"]
  })
}
)
const result = await response.json()

Response

Response200
{
  "extractionSchemaId": "schema_abc123",
  "results": {
    "file_abc123": {
      "status": "queued",
      "jobId": "job_001"
    },
    "file_def456": {
      "status": "queued",
      "jobId": "job_002"
    },
    "file_ghi789": {
      "status": "error",
      "error": "File is actively being processed"
    }
  },
  "summary": {
    "queued": 2,
    "errors": 1,
    "total": 3
  },
  "modelId": "dep_abc123",
  "viaDeploymentId": "dpl_prod01",
  "schemaVersionId": "sv_7"
}

Each entry in results is keyed by file ID and reports either {"status": "queued", "jobId": ...} or {"status": "error", "error": ...}. Check summary.errors before assuming every file was queued.

modelId is the model the request resolved to, viaDeploymentId the deployment it arrived through (null when the request named the model directly), and schemaVersionId the schema version that deployment pins (null when it tracks the draft).

Paused Deployment (409)

A paused deployment takes no new extraction work, and the whole batch is refused before any file is queued. The same request addressed to the model, or through another active deployment on it, is unaffected.

Response409
{
  "error": "Deployment dpl_prod01 on model dep_abc123 is PAUSED. Resume it before processing documents through it.",
  "code": "DEPLOYMENT_PAUSED",
  "deploymentId": "dpl_prod01",
  "modelId": "dep_abc123",
  "status": "PAUSED"
}

Retrieving Results

Poll the get-file-data endpoint for each file individually, or use the get-files-data endpoint to fetch results for multiple files in a single request.

When polling per file, pass that file's jobId from results to get-file-data to validate each read against the job you queued — a wrong or stale ID fails with 404 instead of silently reading another document's job. COMPLETED guarantees the extracted data is present in the same response — no settle delay or empty-result retry is required. get-files-data reports each file's extraction job and does not accept a jobId.

On this page