---
title: "Extract facts from a stored document"
method: POST
path: "/pots/{pot_id}/extract-from-document"
tags: ["ingestion"]
---

# Extract facts from a stored document

`POST /pots/{pot_id}/extract-from-document`

Re-extract facts from an already-stored document into a POT.

This allows extracting the same document into multiple POTs
without re-uploading the content.

## Path parameters

- `pot_id` string, uuid, required

## Request body

- ExtractFromDocumentRequest — Request to re-extract facts from an already-stored document. M21 adds ``context_attachment_ids`` — an optional explicit list of attachment ids to attach to this extraction. Three semantics: * ``None`` (default): the worker resolves to "all attachments on the document at snapshot time" (typical kb2b smart-upload helper flow). * ``[]``: explicitly no attachments — extraction runs without a context block. Distinct from ``None`` because the integrator is saying "ignore even attachments present on the doc." * ``[id, ...]``: explicit subset; ids that point at attachments on a different document or workspace cause a 422 at request-time with ``ATTACHMENT_REF_INVALID``.
  - `document_id` string, uuid, required — ID of the stored document to extract from
  - `language` string, nullable — ISO 639-1 override for extraction language. Falls back to POT default and then auto-detect when omitted.
  - `context_attachment_ids` string[], nullable — Optional explicit list of context_attachment_ids to inject into the extraction prompt. None (default) = use all attachments on the document. Empty list = no context block. Cross-document or cross-workspace ids cause a 422 with ATTACHMENT_REF_INVALID. Duplicate ids are silently deduplicated (preserving first-occurrence order) so they don't double-count against caps or duplicate provenance.

## Response `202`

Re-extraction queued

- IngestionAccepted — Response for POST /ingest (202 Accepted).
  - `job_id` string, uuid, required — Unique identifier for this ingestion job
  - `pot_id` string, uuid, required — Target POT ID
  - `status` 'pending' — Job status (always 'pending' for initial response)
  - `message` string — Human-readable status message

## Other responses

- `404` — POT or document not found
- `422` — Validation error
- `503` — Job queue unavailable

---

[API](https://skmtc.dev/scipot/apis/scipot-core-api.md) · [All operations](https://skmtc.dev/scipot/apis/scipot-core-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/scipot/scipot-core-api/revisions/e8712e9ffeae/schema)
