Limai Docs
API ReferenceDocument Processing

Process File (Sync)

Extract structured data from an uploaded document synchronously.

POST/api/v1/document/{extractionSchemaId}/process-file/{fileId}SYNC

Extract structured data from an uploaded file using AI-powered document processing. This endpoint processes the document synchronously and returns the extracted data immediately upon completion.

For large files or batch processing, consider using the async endpoint instead.

Parameters

NameTypeInRequiredDescription
extractionSchemaIdstringpathYesThe extraction schema ID to use for processing.
fileIdstringpathYesThe file ID returned from the get-url endpoint after uploading.

The request body should be an empty JSON object {}.

Request

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

Response

Response200
{
  "message": "File processed successfully.",
  "fileId": "file_abc123def456",
  "jobId": "job_789xyz012",
  "data": {
    "tables": {
      "table_id_1": {
        "id": "table_id_1",
        "name": "Invoices",
        "columns": [
          {
            "id": "col_1",
            "name": "Invoice Number",
            "type": "TEXT",
            "description": "Unique invoice identifier"
          },
          {
            "id": "col_2",
            "name": "Amount",
            "type": "NUMBER",
            "description": "Invoice total amount"
          }
        ],
        "rows": [
          {
            "id": "row_1",
            "index": "0",
            "status": "PENDING",
            "cells": {
              "Invoice Number": {
                "value": "INV-001",
                "columnId": "col_1"
              },
              "Amount": {
                "value": "1000.00",
                "columnId": "col_2"
              }
            }
          }
        ]
      }
    }
  }
}

Data Structure

Table

FieldTypeDescription
idstringUnique table identifier
namestringHuman-readable table name
columnsarrayArray of column definitions (id, name, type, description)
rowsarrayArray of extracted data rows

Row

FieldTypeDescription
idstringUnique row identifier
indexstringRow position
statusstringRow status: PENDING, ACCEPTED, or REJECTED
cellsobjectCell data keyed by column name
childTablesobjectNested child tables (if schema has relationships)

Cell

FieldTypeDescription
valuestringExtracted cell value
columnIdstringReference to the column definition

When to Use Sync vs Async

SynchronousAsynchronous
Best forSmall files (< 10MB), real-time UIsLarge files, batch processing
BehaviorBlocks until completeReturns job ID immediately
Timeout riskMay timeout on large filesNo timeout limitations