Limai Docs
API ReferenceDocument Processing

Get File Data

Retrieve extracted data and processing status for a single file.

GET/api/v1/document/get-file-data

Retrieve processed document data and check processing status. This endpoint supports both synchronous and asynchronous workflows, returning either the extracted data or processing status based on the job state.

Use this endpoint to:

  • Poll for results after submitting an async processing job
  • Fetch extracted data using metadata from webhook events

Parameters

NameTypeInRequiredDescription
fileIdstringqueryYesThe file ID from the upload response or webhook event payload.
extractionSchemaIdstringqueryNoOptional. The model or deployment's extraction schema ID; validates that the file belongs to it.
includestringqueryNoComma-separated list of optional enrichments to include: confidence, boundingBoxes, validations. Omit for the plain data payload.

Optional Enrichments

By default the response contains only the extracted values. Pass include to enrich each cell (and, for validations, the file envelope):

  • confidence — adds a confidence object to every cell with overall, llm, layout, and consensus scores (0–1, null when not computed).
  • boundingBoxes — adds a boundingBoxes array to every cell. Each box is {"page": "2", "bbox": [yMin, xMin, yMax, xMax]} in normalized 0–1000 coordinates with the origin at the top-left. null when boxes were never computed for the cell.
  • validations — adds a validations array to every cell (normalized entries with checkKey, source of RULE/SCRIPT/AGENT, passed, message, expected, actual, amended) plus a file-level validations object containing the aggregate failCount, per-check results (checks), and declarative rule results (rules).

Every cell's metadata also carries the column slug, alongside the table-level and column-list slugs, so responses can be consumed by stable slug instead of display name.

Note: documents processed through the synchronous process-file endpoint skip the confidence and bounding-box stages, so those fields stay null for such files even when requested. Use the async processing endpoints when you need them.

Request

const response = await fetch(
`https://app.limai.io/api/v1/document/get-file-data?fileId=${fileId}`,
{
  headers: { "Authorization": `Bearer ${API_TOKEN}` }
}
)
const data = await response.json()

Response Types

The response format depends on the processing state of the file.

PROCESSING

The job is still running. Continue polling.

Response200
{
  "status": "PROCESSING",
  "fileId": "file_abc123def456",
  "jobId": "job_789xyz012"
}

CLASSIFYING

The file is being classified (when using async classification).

Response200
{
  "status": "CLASSIFYING",
  "fileId": "file_abc123def456",
  "message": "Document is being classified"
}

COMPLETED

Processing finished successfully. Contains the full extracted data.

Response200
{
  "status": "COMPLETED",
  "message": "File data retrieved successfully.",
  "fileId": "file_abc123def456",
  "extractionSchemaId": "schema_xyz789",
  "deployment": {
    "id": "dep_abc123",
    "name": "Invoice Extraction v1"
  },
  "data": {
    "tables": {
      "table_id_1": {
        "id": "table_id_1",
        "name": "Invoices",
        "slug": "invoices",
        "columns": [
          {
            "id": "col_1",
            "name": "Invoice Number",
            "type": "TEXT",
            "slug": "invoice_number"
          }
        ],
        "rows": [
          {
            "id": "row_1",
            "index": "0",
            "status": "PENDING",
            "cells": {
              "Invoice Number": {
                "value": "INV-001",
                "columnId": "col_1",
                "metadata": {
                  "id": "col_1",
                  "type": "TEXT",
                  "description": null,
                  "slug": "invoice_number"
                }
              }
            }
          }
        ]
      }
    }
  }
}

COMPLETED with enrichments

With include=confidence,boundingBoxes,validations, each cell carries the requested extras and the envelope gains a file-level validations object.

Response200
{
  "status": "COMPLETED",
  "fileId": "file_abc123def456",
  "data": {
    "tables": {
      "table_id_1": {
        "rows": [
          {
            "id": "row_1",
            "cells": {
              "Invoice Number": {
                "value": "INV-001",
                "columnId": "col_1",
                "metadata": {
                  "id": "col_1",
                  "type": "TEXT",
                  "description": null,
                  "slug": "invoice_number"
                },
                "confidence": {
                  "overall": 0.94,
                  "llm": 0.95,
                  "layout": 0.91,
                  "consensus": null
                },
                "boundingBoxes": [
                  {
                    "page": "1",
                    "bbox": [
                      120,
                      45,
                      160,
                      300
                    ]
                  }
                ],
                "validations": [
                  {
                    "checkKey": "invoice-number-format",
                    "source": "SCRIPT",
                    "passed": true,
                    "message": "Matches expected format",
                    "expected": null,
                    "actual": null,
                    "amended": false
                  }
                ]
              }
            }
          }
        ]
      }
    }
  },
  "validations": {
    "failCount": 0,
    "checks": [
      {
        "key": "invoice-number-format",
        "name": "Invoice number format",
        "source": "STATIC",
        "status": "PASSED",
        "behavior": "SURFACE",
        "findings": [],
        "errorMessage": null,
        "startedAt": "2026-07-21T10:00:00.000Z",
        "completedAt": "2026-07-21T10:00:05.000Z"
      }
    ],
    "rules": {
      "crossField": [],
      "row": [],
      "document": []
    }
  }
}

FAILED

Processing failed. Check the error message for details.

Response200
{
  "status": "FAILED",
  "fileId": "file_abc123def456",
  "jobId": "job_789xyz012",
  "errorMessage": "Document format not supported or file is corrupted"
}

On this page