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": "pending",
  "validationExpected": true,
  "validationAttemptId": "clx8f2k9a0001",
  "isReviewed": false,
  "createdAt": "2025-01-15T10:30:00.000Z",
  "updatedAt": "2025-01-15T10:31:00.000Z",
  "confidenceScore": 0.92,
  "validationFailCount": 0,
  "inExamplePool": false,
  "alias": null,
  "metadata": null,
  "conversions": [
    {
      "extension": "md",
      "status": "COMPLETED"
    }
  ],
  "rows": [
    {
      "rowId": "row_001",
      "status": "PENDING",
      "tableId": "tbl_001"
    }
  ],
  "validations": {
    "crossField": [],
    "row": [],
    "document": []
  }
}

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. COMPLETED when no job is in flight or failed. Matches the status returned by Document Data.
validationStatuspending | passed | failed | error | nullDocument-wide aggregate over every validation check recorded for the document, across all attempts — it is not scoped to validationAttemptId. pending while any check is queued or running, failed when a check reports findings, error when a check could not run, null when no validation has ever been recorded for the document.
validationExpectedbooleanWhether validation is configured for this document — enabled validation scripts on its schema, or a validator agent routed to the deployment. When true and validationStatus is null, validation has not been dispatched yet.
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. 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 validation checks recorded on the document.
inExamplePoolbooleanWhether the document is part of the deployment's example pool.
aliasstring | nullUser-assigned alias.
metadataobject | nullMetadata attached at upload time.
conversionsarrayDerived artifacts, each {extension, status}.
rowsarrayExtracted rows, each {rowId, status, tableId}.
validationsobjectRule-based validation results grouped by crossField, row, and document.

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.


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