Limai Docs
API ReferenceSplitting

Split

Split a document synchronously and return the results

POST/api/v1/split/{splitterId}SYNC

Splits a previously uploaded file synchronously. The request blocks until splitting completes and returns the segment results. For large files, consider using the async endpoint instead.

If the file has already been split, the existing results are returned.

Parameters

NameTypeInRequiredDescription
splitterIdstringpathYesThe splitter ID
fileIdstringbodyYesID of the uploaded file (from get-url)

Request

const res = await fetch(
"https://app.limai.io/api/v1/split/spl_abc123",
{
  method: "POST",
  headers: {
    Authorization: "Bearer YOUR_API_TOKEN",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ fileId: "cuid_file_123" }),
}
);
const result = await res.json();

Response

Response200
{
  "splitId": "split_abc123",
  "status": "COMPLETED",
  "sourceFileName": "document.pdf",
  "segmentCount": 3,
  "segments": [
    {
      "segmentIndex": 0,
      "pageStart": 1,
      "pageEnd": 2,
      "detectedType": "invoice",
      "confidence": 0.95,
      "outputFileId": "file_001",
      "outputType": "FILE",
      "discarded": false
    },
    {
      "segmentIndex": 1,
      "pageStart": 3,
      "pageEnd": 5,
      "detectedType": "receipt",
      "confidence": 0.88,
      "outputFileId": "file_002",
      "outputType": "FILE",
      "discarded": false
    }
  ]
}

Webhooks

Every completed split also fires the DOCUMENT_SPLIT webhook, carrying the same segment list as this response. Subscribe to it if you want the result pushed to you rather than read from the response.

On this page