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. Validates that the file belongs to this schema.

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",
        "columns": [
          {
            "id": "col_1",
            "name": "Invoice Number",
            "type": "TEXT"
          }
        ],
        "rows": [
          {
            "id": "row_1",
            "index": "0",
            "status": "PENDING",
            "cells": {
              "Invoice Number": {
                "value": "INV-001",
                "columnId": "col_1"
              }
            }
          }
        ]
      }
    }
  }
}

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"
}