# Work with documents

Upload, extract, and retain the source location behind each piece of evidence.

Documentation index: https://webcite.co/llms.txt
Canonical page: https://webcite.co/api-docs/document-workflows
API origin: https://api.webcite.co
Authentication: x-api-key header. Keep keys on your server.

## Choose the next operation

1. [Upload a file](/api-docs/upload) and retain its asset ID.
2. [Extract text](/api-docs/extract) for reading, or [extract anchored chunks](/api-docs/chunks) for retrieval.
3. Check extraction `state`, `code`, and `lost` before using the content.
4. Use [source preview](/api-docs/source-preview) or [batch quote matching](/api-docs/batch) to inspect cited evidence.

For numbers, use [analyze document figures](/api-docs/analyze-document). For a question over text, send extracted text to [Ask a document](/api-docs/ask), then poll its result.

## Check extraction coverage

`state` is `complete`, `partial`, `unsupported`, or `error`. A partial result can contain useful content and missing sections at the same time. `complete: false` and `lost` identify incomplete recovery when present.

Branch on `code`, not on free-form `reason`:

- `source_too_large`: send a smaller file.
- `source_encrypted`: provide an unlocked copy.
- `source_corrupt`: re-export the document.
- `unsupported_format`: convert to a supported format.
- `ocr_unavailable`: provide a text-layer document or use an OCR-enabled environment.
- `partial_extraction`: inspect the missing parts.
- `empty_source`: the source was read but held no content.
- `extraction_error`: extraction failed; inspect the error before a bounded retry.

## Retain source identity

Keep asset IDs, page/sheet/cell anchors, and any `source_version_id`, `representation_id`, and `source_unit_id` returned by the workflow. A mutable filename or URL is not an immutable source reference.

V2 numeric verification and OCR preparation require existing retained-source identities. The public upload response does not guarantee that it supplies those identities. Do not invent IDs to bridge that gap.
