---
title: "Confirm an upload and start processing"
method: POST
path: "/documents/{documentId}/confirm-upload"
tags: ["Documents"]
---

# Confirm an upload and start processing

`POST /documents/{documentId}/confirm-upload`

## Request

- Base URL: `https://inkseal.net/api/v1`
- URL: `https://inkseal.net/api/v1/documents/{documentId}/confirm-upload`
- Auth: HTTP bearer

Hands the uploaded file back to InkSeal. Call this once the `PUT` to `uploadUrl` has succeeded.

The object is verified before anything is queued: its size is checked against the 25 MB cap, and its leading bytes are checked against the content type declared at creation. A file that fails either check is deleted from storage and the document is moved to `failed`.

The document is not usable when this returns. It is left in `processing` while a background job converts it to the normalized PDF, counts its pages, and renders page previews, and it moves from there to `ready` or `failed`. Two ways to learn which:

- Poll `GET /documents/{documentId}` until `status` is no longer `processing`. A few seconds of interval is plenty; conversion is usually quick.
- Subscribe to the `document.ready` and `document.failed` webhook events and do nothing until one arrives.

A document already in `ready` answers 200 with its existing status and re-queues nothing, so a duplicate confirmation is harmless. A `failed` document stays retryable, which is what makes recovery from a queue outage possible.

The object key comes from the document row, never from the request: the optional `objectKey` field exists only so older clients keep working and is verified rather than honoured, so a caller can never repoint a document at an object the server did not sign for.

Accepts an `Idempotency-Key`: a retry with the same key replays the original response instead of re-queuing processing.

## Headers

- `Idempotency-Key` string

## Request body

- DocumentConfirmUploadRequest: An empty body is the normal case.
  - `objectKey` string: Advisory, and kept only so older clients keep working. When present it is compared against the key the server signed for this document and a mismatch is refused with `key_mismatch`; it is never used to choose which object is read.

## Response `200`

The upload was verified and processing was queued. `status` is `processing`, or `ready` when this document had already finished processing.

- object
  - `data` DocumentUploadConfirmation, required
    - `documentId` string, required: A document's public id: a 21-character URL-safe nanoid. Internal row ids and storage keys are never exposed.
    - `status` 'processing' | 'ready' | 'failed', required: Where the document is in conversion. `processing` from the moment the record is created until the background job finishes; then `ready` or `failed`.

## Other responses

- `400`: The request is malformed or the resource is in the wrong state for a synchronous check. Codes: `validation_error`, `invalid_body`, `invalid_parameter`, `invalid_idempotency_key`, `invalid_event_id`, `invalid_file`, `invalid_url`, `invalid_status`, `key_mismatch`, `no_signers`, `not_completed`, `envelope_exists`, `document_not_ready`, `upload_failed`.
- `401`: The credential is missing, malformed, unknown, expired, revoked, or past its rotation grace window. Code: `unauthorized`. Every authentication failure is deliberately indistinguishable.
- `403`: The credential is valid but may not do this. Codes: `insufficient_scope` (the route's scopes are not all held; `details` names `requiredScopes` and `missingScopes`), `forbidden` (the capability check on the resolved resource failed), `scope_escalation` (a grant wider than the caller's own was requested).
- `404`: The resource does not exist, was deleted, or belongs to another workspace. Code: `not_found`. The three cases are answered identically on purpose, so a 404 never confirms that an identifier exists elsewhere.
- `409`: The resource's state forbids this transition, or another request owns the work. Codes: `invalid_state`, `invalid_status`, `credential_state`, `limit_exceeded`, `envelope_missing`, `not_retryable`, `owner_unavailable`, `workspace_unavailable`, `detection_not_completed`, `document_in_use`, `version_conflict`, `document_processing`, `document_processing_failed`, `normalized_pdf_unavailable`, `pages_not_rendered`, `document_not_ready`, `idempotency_in_progress` (which also carries `Retry-After`), `payment_replayed` (a USDC payment signature presented twice), `payment_pending` (a USDC settlement whose outcome is not yet known).
- `413`: The uploaded object exceeds the 25 MB limit. The object was deleted and the document moved to `failed` (`file_too_large`).
- `422`: The request parsed but its content is not acceptable. Codes: `validation_error` (envelope configuration, with an `issues` array in `details`), `invalid_envelope`, `envelope_not_ready`, `document_page_limit`, `idempotency_key_reuse`.
- `429`: A limit was reached. Codes: `rate_limited` (the credential's per-bucket HTTP limit, or the per-workspace detection throttle), `workspace_limit_exceeded` (a workspace content or send limit; `details.limit` names it), `daily_budget_exceeded` (the workspace's daily detection budget). The four rate-limit headers are sent on this response and on no successful one, so a client cannot read its remaining budget without being refused. Retrying after `Retry-After` is always safe: a rate-limit refusal happens before the handler runs.
- `500`: An unexpected server failure. Codes: `internal_error`, `queue_failed`, `upload_failed`, `validation_failed`. Safe to retry, and safe to retry with the same `Idempotency-Key`: a 5xx is never pinned to a key.
- `503`: A dependency the request needs is unreachable and nothing was changed. Codes: `queue_unavailable` (a background job could not be enqueued; retry the call), `billing_unavailable` (Stripe would not open a checkout session; nothing was charged, retry the call), `service_unavailable` (the rate-limit store is down, so the request was refused before running).

---

[API](https://skmtc.dev/inkseal/apis/inkseal-api.md) · [All operations](https://skmtc.dev/inkseal/apis/inkseal-api/llms.txt) · [OpenAPI document](https://skmtc.dev/inkseal/apis/inkseal-api/revisions/c440c981d578?raw)
