Limai Docs
API ReferenceDeployments

Document Data (Flat)

Retrieve a document's extracted data in a flat, slug-keyed structure

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

Returns a document's extracted data in the flattest available structure: tables keyed by table slug, rows keyed by column slug, child tables nested inline. No column types, descriptions, or metadata objects — this is the recommended endpoint for consuming extraction results. For the full metadata-rich shape, use Get File Data. To fetch several documents in one call, use Documents Data (Flat, Bulk).

Parameters

NameTypeInRequiredDescription
deploymentIdstringpathYesThe model or deployment the document belongs to.
fileIdstringpathYesThe file ID from the upload response or webhook event payload.
includestringqueryNoComma-separated list of optional enrichments: confidence, boundingBoxes, validations.

Shape rules

  • Every key that is not $-prefixed is your data, keyed by slug. Everything $-prefixed is system-provided.
  • Tables are always arrays of rows — a single-row table is a one-element array.
  • Every row carries $id (the row id, stable for corrections and cross-references) and $index (its position).
  • Every cell is always an object with a value key, so row["total_amount"].value works regardless of what you include. Enrichments only ever add keys next to value:
    • include=confidenceconfidence: the overall score (0–1, null when not computed).
    • include=boundingBoxesboundingBoxes: array of {"page": "2", "bbox": [yMin, xMin, yMax, xMax]} in normalized 0–1000 coordinates, or null when never computed.
    • include=validationsvalidations: array of {check, source, passed, message} per cell, plus a top-level validations object with the aggregate failCount and per-check results.
  • Child tables appear inside their parent row under the child table's slug, as an array of rows with the same rules.

Requires slugs on every table and column, unique within their scope. Schemas predating the slug backfill, or schemas where two tables or columns resolve to the same slug, return 422 with a message naming the offending table or column.

Note: documents processed through the synchronous process-file endpoint skip the confidence and bounding-box stages, so those fields stay null for such files even when requested.

Request

const response = await fetch(
`https://app.limai.io/api/v1/deployments/${deploymentId}/documents/${fileId}/data?include=confidence,validations`,
{
  headers: { "Authorization": `Bearer ${API_TOKEN}` }
}
)
const data = await response.json()

Response

Plain call (no include):

Response200
{
  "fileId": "file_9k2mx4",
  "status": "COMPLETED",
  "jobId": "job_5tr8n1",
  "data": {
    "invoices": [
      {
        "$id": "row_h1",
        "$index": "0",
        "invoice_number": {
          "value": "INV-2041"
        },
        "total_amount": {
          "value": "1250.00"
        },
        "line_items": [
          {
            "$id": "row_li1",
            "$index": "0",
            "description": {
              "value": "Solar panel mounting kit"
            },
            "amount": {
              "value": "740.00"
            }
          }
        ]
      }
    ]
  }
}

With include=confidence,validations:

Response200
{
  "fileId": "file_9k2mx4",
  "status": "COMPLETED",
  "data": {
    "invoices": [
      {
        "$id": "row_h1",
        "$index": "0",
        "invoice_number": {
          "value": "INV-2041",
          "confidence": 0.947,
          "validations": [
            {
              "check": "invoice-number-format",
              "source": "SCRIPT",
              "passed": true,
              "message": "Matches AP numbering scheme"
            }
          ]
        },
        "total_amount": {
          "value": "1250.00",
          "confidence": 0.882,
          "validations": [
            {
              "check": "line-item-reconciliation",
              "source": "SCRIPT",
              "passed": false,
              "message": "Line items sum to 1180.00, total reads 1250.00"
            }
          ]
        },
        "line_items": []
      }
    ]
  },
  "validations": {
    "failCount": 1,
    "checks": [
      {
        "key": "line-item-reconciliation",
        "source": "STATIC",
        "status": "RESEND_FAILED",
        "passed": false,
        "message": "Line items sum to 1180.00, total reads 1250.00"
      }
    ]
  }
}

While processing, and on failure:

Response200
{
  "fileId": "file_9k2mx4",
  "status": "PROCESSING",
  "jobId": "job_5tr8n1"
}
Response422
{
  "error": "Column \"Invoice Number\" (col_8s3k1) has no slug. Run the slug backfill for this schema."
}

On this page