Limai Docs
API ReferenceWebhooks

Document Extraction Failed Event

Webhook event fired when document extraction fails due to errors or timeouts.

The DOCUMENT_EXTRACTION_FAILED event fires when document extraction does not complete successfully. Subscribe to it when you need to react to failures separately from successful extractions.

When It Triggers

  • Extraction error -- When document processing fails due to an unrecoverable error
  • Timeout -- When processing exceeds the allowed time and is abandoned

This is a document event, routed to subscriptions by deployment route. It typically fires within 30-120 seconds after calling the process-file or process-file-async endpoint.

Payload Structure

Response200
{
  "eventId": "evt_extfail_789",
  "eventType": "DOCUMENT_EXTRACTION_FAILED",
  "timestamp": "2024-01-15T10:32:15Z",
  "organizationId": "org_xyz789",
  "projectId": "proj_abc123",
  "deploymentId": "dep_123abc",
  "extractionSchemaId": "schema_456def",
  "fileId": "file_bad123",
  "jobId": "job_error456",
  "data": {
    "status": "failed",
    "errorMessage": "Document format not supported"
  }
}

Payload Fields

FieldTypeDescription
eventIdstringUnique event identifier. Use for idempotency.
eventTypestringAlways "DOCUMENT_EXTRACTION_FAILED"
timestampISO 8601When the extraction failed (UTC)
organizationIdstringYour organization identifier
projectIdstringThe project the document belongs to
deploymentIdstringThe model or deployment that processed this document
extractionSchemaIdstringThe extraction schema ID of that model or deployment
fileIdstringThe processed file identifier
jobIdstring | nullThe extraction job identifier, if available
data.status"failed"Always "failed" for this event
data.errorMessagestring | nullError description

Handling the Event

function handleDocumentExtractionFailed(event) {
const { eventId, fileId, jobId, data } = event

console.error(`Document ${fileId} extraction failed (job: ${jobId}): ${data.errorMessage}`)

notifyOnCall(fileId, data.errorMessage)
scheduleReprocess(fileId)
}

Notes

Before PRD 0140 this event was defined but never delivered; extraction failures surfaced through the DOCUMENT_EXTRACTED event with data.status: "failed". It is now delivered as its own event type. If you previously relied on DOCUMENT_EXTRACTED to observe failures, subscribe to DOCUMENT_EXTRACTION_FAILED as well.

On this page