Limai Docs
API ReferenceDeployments

Document Detail

Get document details, pages, and content for a specific file

Get Document Detail

GET/api/v1/deployments/{deploymentId}/documents/{fileId}

Returns detailed information about a document including its metadata, row references, file conversions, and validation results.

Parameters

NameTypeInRequiredDescription
deploymentIdstringpathYesThe model or deployment ID
fileIdstringpathYesThe file ID

Request

const res = await fetch(
"https://app.limai.io/api/v1/deployments/dep_abc123/documents/file_001",
{
  headers: {
    Authorization: "Bearer YOUR_API_TOKEN",
  },
}
);
const doc = await res.json();

Response

Response200
{
  "id": "file_001",
  "name": "invoice.pdf",
  "originalExtension": "pdf",
  "status": "EXTRACTED",
  "extractionStatus": "COMPLETED",
  "validationStatus": "failed",
  "validationExpected": true,
  "validationAttemptId": "clx8f2k9a0001",
  "isReviewed": false,
  "createdAt": "2025-01-15T10:30:00.000Z",
  "updatedAt": "2025-01-15T10:31:00.000Z",
  "confidenceScore": 0.92,
  "validationFailCount": 1,
  "inExamplePool": false,
  "alias": null,
  "metadata": null,
  "conversions": [
    {
      "extension": "md",
      "status": "COMPLETED"
    }
  ],
  "rows": [
    {
      "rowId": "row_001",
      "status": "PENDING",
      "tableId": "tbl_001"
    }
  ],
  "validations": {
    "crossField": [
      {
        "ruleId": "vrule_9k1",
        "ruleName": "Net Amount vs Gross Amount",
        "passed": false,
        "fieldA": {
          "columnId": "col_net",
          "value": "1180.00"
        },
        "fieldB": {
          "columnId": "col_gross",
          "value": "1250.00"
        },
        "operator": "EQUALS",
        "expected": "1250.00",
        "actual": "1180.00"
      }
    ],
    "row": [],
    "document": []
  },
  "modelId": "dep_abc123",
  "viaDeploymentId": "dpl_prod01"
}

Response Fields

FieldTypeDescription
idstringThe file ID.
namestringOriginal file name.
originalExtensionstringExtension of the uploaded file.
statusstringUpload-level file status (UPLOADED, EXTRACTED, FAILED, …).
extractionStatusCOMPLETED | PROCESSING | FAILEDDerived from the latest extraction job for this document. A queued or in-flight job reports PROCESSING; a failed or stalled job reports FAILED; COMPLETED means the extraction finished (including documents that were never queued). Matches the status returned by Document Data.
validationStatuspending | passed | failed | error | nullDocument-wide aggregate over the model's validation rules and every custom validation check recorded for the document, across all attempts — it is not scoped to validationAttemptId. failed when a rule failed or a check reported findings, pending while a check is queued or running or a just-completed extraction job is still evaluating the model's rules, error when rule evaluation or a check could not run, null when the document has no rule verdict and no custom validations. Same value and precedence as validations.status on Document Data; see Validations.
validationExpectedbooleanWhether validation is configured for this document — validation rules on its model, enabled validation scripts, or a validator agent routed to the deployment. When true and validationStatus is null, nothing is recorded for the document yet: custom validation has not been dispatched, and the document holds no rule verdict — the state of a document extracted before its model had any rule.
validationAttemptIdstring | nullIdentifier of the most recent validation attempt. Correlates this document with the DOCUMENT_VALIDATION_STARTED, DOCUMENT_VALIDATION_FAILED, and DOCUMENT_VALIDATED webhook events of the same attempt. null when the document's only validations are rules, which run synchronously and start no attempt. Use it for event correlation, not to interpret validationStatus: after a partial revalidation the two lanes can sit on different attempts, and validationStatus still answers the document-wide question "is this document validated?".
isReviewedbooleanWhether a human has reviewed the extraction.
createdAtstringISO 8601 creation timestamp.
updatedAtstringISO 8601 last-update timestamp.
confidenceScorenumber | nullOverall extraction confidence, null when not computed.
validationFailCountnumberNumber of failing checks recorded on the document, failing validation rules included.
inExamplePoolbooleanWhether the document is part of the model's example pool.
aliasstring | nullUser-assigned alias.
metadataobject | nullMetadata attached at upload time.
conversionsarrayDerived artifacts, each {extension, status}.
rowsarrayExtracted rows, each {rowId, status, tableId}.
validationsobjectValidation rule results grouped by crossField, row, and document. See Rule results.
modelIdstringThe model this request resolved to.
viaDeploymentIdstring | nullThe deployment the request arrived through, null when the model was addressed directly.

Polling this endpoint alone is enough to follow a document end to end: extractionStatus covers extraction, and validationExpected plus validationStatus tell you whether to keep waiting for validation or that none is coming.

Rule results

validations holds the model's cross-field, row and document rules, evaluated against the document's current values when you make the request. Field and column rules are not here — their results sit on the cells, on Document Data and Get File Data. For one list covering every scope, read validations.rules[] on Document Data.

Because these results are computed for the request, they reflect corrections submitted since extraction and any edit to the rules themselves, while the stored results on the data endpoints reflect the last evaluation.

GroupEntry
crossField{ruleId, ruleName, passed, fieldA, fieldB, operator, expected, actual}, where fieldA and fieldB are {columnId, value} for the two compared fields
row{ruleId, ruleName, rowResults}, with one {rowId, passed, computedValue, targetValue, expected, actual} per row of the rule's table
document{ruleId, ruleName, passed, aggregationFunction, computedValue, targetValue, operator, expected, actual}

ruleName is the rule's name, or the same generated label the other endpoints use when the rule has none — for example Net Amount vs Gross Amount or SUM(Amount). Validations covers how those labels are built.


Get Document Pages

GET/api/v1/deployments/{deploymentId}/documents/{fileId}/pages

Returns page-level access URLs for a document. For PDFs, returns a single PDF URL. For images, returns the image URL directly.

Parameters

NameTypeInRequiredDescription
deploymentIdstringpathYesThe model or deployment ID
fileIdstringpathYesThe file ID

Request

const res = await fetch(
"https://app.limai.io/api/v1/deployments/dep_abc123/documents/file_001/pages",
{
  headers: {
    Authorization: "Bearer YOUR_API_TOKEN",
  },
}
);
const pages = await res.json();

Response

Response200
{
  "fileId": "file_001",
  "fileName": "invoice.pdf",
  "type": "pdf",
  "pageCount": 3,
  "pdfUrl": "https://s3.amazonaws.com/...presigned-url...",
  "pages": []
}

Get Document Content

GET/api/v1/deployments/{deploymentId}/documents/{fileId}/content

Returns the document content including markdown text, PDF URL, and source file URL.

Parameters

NameTypeInRequiredDescription
deploymentIdstringpathYesThe model or deployment ID
fileIdstringpathYesThe file ID

Request

const res = await fetch(
"https://app.limai.io/api/v1/deployments/dep_abc123/documents/file_001/content",
{
  headers: {
    Authorization: "Bearer YOUR_API_TOKEN",
  },
}
);
const content = await res.json();

Response

Response200
{
  "fileId": "file_001",
  "fileName": "invoice.pdf",
  "markdownContent": "# Invoice\\n\\nInvoice Number: INV-2025-001\\n...",
  "pdfUrl": "https://s3.amazonaws.com/...pdf-url...",
  "sourceFileUrl": "https://s3.amazonaws.com/...source-url...",
  "hasMarkdown": true,
  "hasPdf": true,
  "originalExtension": "pdf"
}

On this page