versioning-documents
Use when the user wants to retrieve a stored document and its extraction result, list a document's versions, or diff two versions. Covers GET /v1/documents/{id}, GET /v1/documents/{id}/versions, and the sync-with-async-fallback diff at GET /v1/documents/{id}/diff plus its poll endpoint.
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-14
- Stars
- ★ 1.6k
- Forks
- 491
01 前言 Front Matter
- name
- versioning-documents
- description
- Use when the user wants to retrieve a stored document and its extraction result, list a document's versions, or diff two versions. Covers GET /v1/documents/{id}, GET /v1/documents/{id}/versions, and the sync-with-async-fallback diff at GET /v1/documents/{id}/diff plus its poll endpoint.
03 SKILL.md 正文
Versioning documents
Every extraction is stored against a stable document_id that persists
across re-processing. Use these endpoints when an application extracts the
same logical document more than once and needs the latest result, the full
version history, or a diff between two versions.
All four endpoints are GET and require a Bearer token.
Endpoints
| Method | Path | Purpose |
|---|---|---|
| GET | /v1/documents/{document_id} |
Latest version of a document with its extraction result. |
| GET | /v1/documents/{document_id}/versions |
List all versions (paginated), newest first. |
| GET | /v1/documents/{document_id}/diff?from={v}&to={v} |
Diff two versions — sync (200), async fallback (202) when over budget. |
| GET | /v1/documents/{document_id}/diff/{diff_job_id} |
Poll an async diff job. |
document_id is the UUID returned alongside each extraction job. The
from and to query params accept either a version sequence integer or a
job UUID.
Get the latest version
curl -s https://api.kreuzberg.dev/v1/documents/$DOC_ID \
-H "Authorization: Bearer $KREUZBERG_API_KEY"
Returns the latest version's extraction result (same result shape as
GET /v1/jobs/{id} — content, tables, images, metadata).
List versions
curl -s https://api.kreuzberg.dev/v1/documents/$DOC_ID/versions \
-H "Authorization: Bearer $KREUZBERG_API_KEY"
Returns an array of DocumentVersionEntry (paginated). Each entry carries
its version sequence number and the job ID that produced it — use either as
a from/to value when diffing.
Diff two versions
curl -s "https://api.kreuzberg.dev/v1/documents/$DOC_ID/diff?from=1&to=3" \
-H "Authorization: Bearer $KREUZBERG_API_KEY"
The diff is computed synchronously and returned inline as 200 when it
fits the request budget:
{
"document_id": "…",
"from_job_id": "…", "from_version": 1,
"to_job_id": "…", "to_version": 3,
"diff": { "…": "kreuzberg ExtractionDiff shape" },
"computed_at": "2026-06-20T10:00:00Z"
}
The diff field is the full kreuzberg::diff::ExtractionDiff. The OpenAPI
schema declares it opaque because the Rust type recurses; decode it against
kreuzberg's published diff schema if you need a typed surface — do not
hard-code a shape from this skill.
Async fallback
When the diff exceeds the inline compute budget, the endpoint returns 202
with a job handle instead:
{ "diff_job_id": "…", "status": "pending" }
Poll it the same way you poll extraction jobs — exponential backoff capped at ~30s — until terminal:
curl -s https://api.kreuzberg.dev/v1/documents/$DOC_ID/diff/$DIFF_JOB_ID \
-H "Authorization: Bearer $KREUZBERG_API_KEY"
Treat both 200 (inline) and 202 (queued) as success at submit time;
branch on the status code to decide whether to poll.
Errors
| Status | Meaning | Action |
|---|---|---|
400 |
Invalid from/to |
Pass a version sequence integer or a job UUID. |
401 |
Bad API key | Check the Authorization header. |
404 |
Version not found | Document or version doesn't exist in this project. |
422 |
Async diff failed | The queued diff errored server-side; resubmit or report. |
Other skills
tracking-cloud-jobs— polling cadence and terminal-status detection (reuse it for async diff jobs).offloading-extraction— produces thedocument_idthese endpoints read.
04 同仓库更多 Skills
worktable-review-with-annotations
Create, inspect, reply to, update, or resolve situated Worktable annotations. Use when feedback belongs to a Doc section, block, text range, or HTML Doc, or when the user asks to address existing review feedback and coordinate a requested artifact edit.
worktable-find-and-synthesize-context
Find, assess, and synthesize context from Worktable Docs and Records. Use when the user asks what a workspace contains, wants workspace-backed research, needs current facts reconciled across artifacts, or requests a cited synthesis without changing workspace state.
worktable-create-or-update-docs
Create, edit, rename, or maintain narrative Worktable Docs. Use for plans, decisions, briefs, notes, research syntheses, and other durable prose when the user requests a new artifact or a safe update to an existing one.
worktable-create-or-manage-records
Organize repeated structured information as durable Worktable Records. Use for research datasets, inventories, directories, pipelines, trackers, and other collections whose items need identity, fields, filtering, links, validation, or individual updates.
worktable-create-or-manage-interactive-html
Create or improve durable visual and interactive artifacts in Worktable. Use for dashboards, trackers, calculators, mini apps, slide presentations, and other requests that benefit from a polished HTML Doc.
worktable-collaborate-threads
Read, answer, and hand off messages through durable Worktable threads with users or other authenticated participants. Use when the user asks to check addressed messages, reply to a participant, continue a thread, request another agent's help, wait briefly for a response, or watch for comments and messages sent to the agent.