Document Detail
Get document details, pages, and content for a specific file
Get Document Detail
/api/v1/deployments/{deploymentId}/documents/{fileId}Returns detailed information about a document including its metadata, row references, file conversions, and validation results.
Parameters
| Name | Type | In | Required | Description |
|---|---|---|---|---|
deploymentId | string | path | Yes | The model or deployment ID |
fileId | string | path | Yes | The 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
{
"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
| Field | Type | Description |
|---|---|---|
id | string | The file ID. |
name | string | Original file name. |
originalExtension | string | Extension of the uploaded file. |
status | string | Upload-level file status (UPLOADED, EXTRACTED, FAILED, …). |
extractionStatus | COMPLETED | PROCESSING | FAILED | Derived 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. |
validationStatus | pending | passed | failed | error | null | Document-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. |
validationExpected | boolean | Whether 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. |
validationAttemptId | string | null | Identifier 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?". |
isReviewed | boolean | Whether a human has reviewed the extraction. |
createdAt | string | ISO 8601 creation timestamp. |
updatedAt | string | ISO 8601 last-update timestamp. |
confidenceScore | number | null | Overall extraction confidence, null when not computed. |
validationFailCount | number | Number of failing checks recorded on the document, failing validation rules included. |
inExamplePool | boolean | Whether the document is part of the model's example pool. |
alias | string | null | User-assigned alias. |
metadata | object | null | Metadata attached at upload time. |
conversions | array | Derived artifacts, each {extension, status}. |
rows | array | Extracted rows, each {rowId, status, tableId}. |
validations | object | Validation rule results grouped by crossField, row, and document. See Rule results. |
modelId | string | The model this request resolved to. |
viaDeploymentId | string | null | The 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.
| Group | Entry |
|---|---|
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
/api/v1/deployments/{deploymentId}/documents/{fileId}/pagesReturns page-level access URLs for a document. For PDFs, returns a single PDF URL. For images, returns the image URL directly.
Parameters
| Name | Type | In | Required | Description |
|---|---|---|---|---|
deploymentId | string | path | Yes | The model or deployment ID |
fileId | string | path | Yes | The 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
{
"fileId": "file_001",
"fileName": "invoice.pdf",
"type": "pdf",
"pageCount": 3,
"pdfUrl": "https://s3.amazonaws.com/...presigned-url...",
"pages": []
}Get Document Content
/api/v1/deployments/{deploymentId}/documents/{fileId}/contentReturns the document content including markdown text, PDF URL, and source file URL.
Parameters
| Name | Type | In | Required | Description |
|---|---|---|---|---|
deploymentId | string | path | Yes | The model or deployment ID |
fileId | string | path | Yes | The 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
{
"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"
}