Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.getomni.ai/llms.txt

Use this file to discover all available pages before exploring further.

Triggered when the document processing pipeline finishes, whether or not extraction actually ran.

Event Type

document.extracted

Description

This event fires once per document outcome: completed when the pipeline finished (extraction may have been skipped because validation flagged the document), and failed when extraction itself errored. The payload always includes a classification object describing which checklist item(s) the document matched, with per-item validation results on each matched item.

Payload Structure

event
string
required
The event type, always document.extracted
workspaceId
string
required
ID of the workspace this event belongs to
leadId
string
required
ID of the lead this document belongs to
externalLeadId
string
required
External ID of the lead this document belongs to, if one was provided at creation
documentId
string
required
ID of the document that was processed
externalId
string
External identifier for the document, if one was provided at creation
status
string
required
completed when the pipeline finished or failed when extraction errored
parentActionId
string
ID of the parent action that triggered the pipeline
summary
string
One- to two-sentence document summary from OCR, when available (same as stored on the document)
type
string
Inferred document type from OCR (same as the type column on documents, e.g. Bank Statement, Tax Return). null when not set.
classification
object
required
How the document was classified before extraction (or an empty match list with a no-match reason)
extractionResult
object
required
Returns any checklist items extracted from documents.

Examples

Successful extraction

{
  "event": "document.extracted",
  "workspaceId": "6048d78a-584a-4f1e-9e39-e011ca4cc48c",
  "leadId": "910bb19a-2e9d-400f-8d15-9c461bb0f4aa",
  "externalLeadId": "SF-00142",
  "documentId": "ac52376a-fe68-4024-8b16-6acdcb9b3530",
  "externalId": "DOC-2025-001",
  "status": "completed",
  "parentActionId": "9d7fe2f3-ec1a-481c-b814-a0d1c8017e1f",
  "summary": "Business bank statement for Q1 2025 with ending balance and transactions.",
  "type": "Bank Statement",
  "classification": {
    "noMatchedItemReason": null,
    "matchedChecklistItems": [
      {
        "checklistItemCode": "company-legal-name",
        "fieldType": "TEXT",
        "label": "Company Name",
        "leadChecklistItemId": "adc887d0-7238-4ce0-998d-523a22c282f4",
        "validation": null
      }
    ]
  },
  "extractionResult": {
    "items": [
      {
        "checklistItemCode": "company-legal-name",
        "label": "Company Name",
        "leadChecklistItemId": "adc887d0-7238-4ce0-998d-523a22c282f4",
        "value": "OmniAI Technology Inc."
      }
    ],
    "extractedCount": 1
  }
}

Completed with validation failure

When at least one matched checklist item has validation.status: "invalid", extraction is not run, but the pipeline still reports status: completed. extractionResult is still present with an empty items array and extractedCount: 0; the per-item validation block on each matched item carries the failure reasons (null when no rules ran).
{
  "event": "document.extracted",
  "workspaceId": "6048d78a-584a-4f1e-9e39-e011ca4cc48c",
  "leadId": "910bb19a-2e9d-400f-8d15-9c461bb0f4aa",
  "externalLeadId": "SF-00142",
  "documentId": "8f0c3d1b-2a00-4f0d-8c1e-0e5f1a2b3c4d",
  "externalId": "DOC-2025-002",
  "status": "completed",
  "parentActionId": "9d7fe2f3-ec1a-481c-b814-a0d1c8017e1f",
  "summary": "Monthly business checking statement.",
  "type": "Bank Statement",
  "classification": {
    "noMatchedItemReason": null,
    "matchedChecklistItems": [
      {
        "checklistItemCode": "bank-statement",
        "fieldType": "BANK_STATEMENT",
        "label": "Recent bank statement",
        "leadChecklistItemId": "5e6f7a8b-9c0d-4e1f-a2b3-c4d5e6f7a8b9",
        "validation": {
          "reasons": [
            "The statement end date is earlier than the requested coverage period."
          ],
          "status": "invalid"
        }
      }
    ]
  },
  "extractionResult": {
    "items": [],
    "extractedCount": 0
  }
}