---
title: "Enqueue a document for AI extraction (human-review required)"
method: POST
path: "/v1/imports/contexts/{contextId}/sources/{sourceId}/extract-document"
tags: ["Ingestion"]
---

# Enqueue a document for AI extraction (human-review required)

`POST /v1/imports/contexts/{contextId}/sources/{sourceId}/extract-document`

Stores the uploaded source document tenant-scoped, runs deterministic + AI extraction, and enqueues the resulting transaction CANDIDATES in a human-review queue. AI output is NEVER authoritative: no transaction is reconciled until a human approves the review. The lane is gated by a global kill-switch AND a per-tenant opt-in (fail-closed: a non-opted-in tenant gets 403). The tenant is resolved from the JWT and the context/source from the path — never from the body.

## Path parameters

- `contextId` string, uuid, required — Context ID
- `sourceId` string, uuid, required — Source ID

## Response `202`

Accepted

- ExtractDocumentResponse
  - `candidateCount` integer, required — Number of transaction candidates queued for review
  - `reviewId` string, uuid, required — Identifier of the queued extraction review
  - `status` string, required — Lifecycle status of the queued review (always PENDING_REVIEW on enqueue)

## Other responses

- `default` — Error

---

[API](https://skmtc.net/lerian/apis/identity-plugin.md) · [All operations](https://skmtc.net/lerian/apis/identity-plugin/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/lerian/identity-plugin/versions/25daba385532/schema)
