/v1/packets
Concepts, routing, definitions and the packet object are explained in Packets. This page lists the endpoints.
Create a packet
Section titled “Create a packet”POST https://api.deskew.dev/v1/packets
Scope extract:write. Multipart form. Always answers 202 with the packet; the documents run as background jobs.
| Form field | Type | Description |
|---|---|---|
files |
file, repeated | The documents. A .zip is expanded one level (nested zips refused). At most 40 documents |
packet |
string | Name of a packet definition. Omitted, the packet only routes and runs, no cross-document rules |
assignments |
JSON string | {"<file name>": "<extractor>"} to skip routing for those files |
webhook_url |
string | Receives packet.completed for this packet, in addition to subscribed endpoints |
curl https://api.deskew.dev/v1/packets \ -H "Authorization: Bearer $DESKEW_API_KEY" \ -F "packet=health-claim" \ -F "files=@claim-form.pdf" -F "files=@final-bill.pdf" -F "files=@pharmacy-1.jpg" \ -F 'assignments={"claim-form.pdf": "health-claim-form"}'files = [("files", open(p, "rb")) for p in ("claim-form.pdf", "final-bill.pdf", "pharmacy-1.jpg")]r = requests.post(f"{API}/v1/packets", headers=HEADERS, files=files, data={"packet": "health-claim", "assignments": '{"claim-form.pdf": "health-claim-form"}'})packet = r.json() # 202const fd = new FormData();fd.set("packet", "health-claim");for (const name of ["claim-form.pdf", "final-bill.pdf", "pharmacy-1.jpg"]) fd.append("files", new Blob([await fs.readFile(name)]), name);const packet = await fetch(`${API}/v1/packets`, { method: "POST", headers: { Authorization: `Bearer ${KEY}` }, body: fd }).then((r) => r.json());Credits: each document is billed as its own job (parse plus extractor credits), plus 1 credit per document that was routed rather than assigned.
Get a packet
Section titled “Get a packet”GET https://api.deskew.dev/v1/packets/{id}
Scope jobs:read. The full packet object, including data once completed. Poll it, or wait for the webhook.
List packets
Section titled “List packets”GET https://api.deskew.dev/v1/packets
Scope jobs:read. Query: status (queued, processing, completed, flagged, failed, canceled), limit (1 to 100, default 20), starting_after (a packet id). Answers { "object": "list", "data": [...], "has_more": bool, "counts": { "<status>": n } }; entries omit data. counts covers every packet in this mode regardless of the filter.
Cancel a packet
Section titled “Cancel a packet”DELETE https://api.deskew.dev/v1/packets/{id}
Scope jobs:write. While queued or processing, jobs that have not started are cancelled and the packet becomes canceled; documents already running finish but no rules run. On a finished packet it does nothing and returns the packet.
Packet definitions
Section titled “Packet definitions”All under scope extractors:read for GET and extractors:write otherwise.
| Method and path | Body | Answer |
|---|---|---|
GET /v1/packet-definitions?include_archived= |
{ "data": [definition, ...] } |
|
POST /v1/packet-definitions |
{ "name", "definition"? , "from_starter"? } |
201 the definition (version 1) |
GET /v1/packet-definitions/{name} |
the definition | |
PUT /v1/packet-definitions/{name} |
{ "definition" } |
{ "valid": true, "definition", "version" } or { "valid": false, "problems": [{path, message}] } (nothing stored) |
DELETE /v1/packet-definitions/{name} |
archives; the definition | |
GET /v1/packet-starters |
{ "data": [{ id, title, summary, roles, extractors, rules }] } |
|
GET /v1/packet-starters/{id} |
the starter with its full definition |
The definition object:
{ "object": "packet_definition", "id": "pkd_01M…", "name": "health-claim", "title": "Health claim packet", "version": 2, "definition": { "title": "…", "description": "…", "roles": { "claim": { "extractor": "health-claim-form", "min": 1, "max": 1, "description": "" } }, "rules": [ … ] }, "from_starter": "health-claim", "archived_at": null, "created_at": "…", "updated_at": "…"}Every PUT that validates increments version; a packet records the definition snapshot it started with. Audit log actions: packet_definition.created, packet_definition.updated, packet_definition.archived.
Errors
Section titled “Errors”| Status | Code | When |
|---|---|---|
| 404 | packet_not_found |
Unknown id, or a packet from the other mode |
| 404 | packet_definition_not_found |
Unknown or archived definition name |
| 404 | extractor_not_found |
An assignments entry names an extractor that is not published |
| 404 | starter_not_found |
Unknown from_starter |
| 409 | packet_definition_exists |
The name is taken |
| 409 | extractor_unpublished |
A role of the definition needs an extractor this project has not published |
| 422 | packet_definition_invalid |
The body does not validate; problems lists paths and messages |
| 422 | validation_error |
No files, too many files, nested zip, malformed assignments |
| 422 | archive_too_large, corrupt_file |
The zip has more than 40 members or is not a zip |