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.

A splitter sends its segments to a model, to one of the model's deployments, or to a classifier. Segments sent to a deployment are stamped with it exactly as a direct upload through it is, so its pinned version applies. While that deployment is paused the splitter refuses documents at intake with 409 and code OUTPUT_DEPLOYMENT_NOT_ACTIVE; a splitter with no output target configured refuses them with 400.

Response409
{
  "error": "This splitter outputs to deployment \"production\", which is paused. Resume the deployment before sending documents to the splitter.",
  "code": "OUTPUT_DEPLOYMENT_NOT_ACTIVE",
  "deploymentId": "dpl_prod01",
  "modelId": "dep_abc123",
  "status": "PAUSED"
}

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