Skip to navigation

Confirm a presigned upload

Step 3 of the direct-to-S3 upload path. Call after the PUT to the presigned uploadUrl succeeded. No request body.

The API downloads the object, applies the same checks as the other upload paths (MIME allowlist, 25 MiB ceiling, non-empty, EICAR test file, contents match the declared type), records the real fileSize and contentSha256, sets status: active, and starts the validation + extraction workflow in the background (fire-and-forget: the response does not wait for it). The other active document of the same category for this subcontractor and organization is replaced once this one has been read, as the multipart upload describes (a license or background_check file replaces it right away). A document.uploaded event is published on the organization’s event stream.

Outcomes:

  • 200 with the document — confirmed and activated. Idempotent: a document that already has a content hash is returned unchanged.
  • 200 with duplicate: true — the same bytes are already on file for this subcontractor under your organization; the placeholder row and its S3 object are deleted and the existing document is returned.
  • 409 — no object at the upload key (you never uploaded, or the URL expired). The placeholder row is deleted, so presign again; a retried confirm returns 404.
  • 422 — rejected as malware (the EICAR test file); the object and the placeholder row are deleted.
  • 400 / 413 — unsupported type, contents that don’t match mimeType, empty file or too large; the placeholder and object are left in place.

Sandbox: sample documents (see GET /v1/sandbox/fixtures) are recognized at upload and get a canned reading with no LLM call. Any other file uploaded in the sandbox is accepted but fails validation; the document’s metadata.statusReason says “Sandbox only reads sample documents” and how to download one.

Requires scope documents:write.

Authentication

AuthorizationBearer

Session JWT or API key (ak_...)

Path parameters

subcontractorIdstringRequiredformat: "uuid"
documentIdstringRequiredformat: "uuid"

Response

Document confirmed (or already confirmed), or a duplicate of an existing document

object
OR
DuplicateDocumentResponseobject

Returned with status 200 (not 201) when the uploaded bytes match a document already on file for this subcontractor under your organization. data is the existing document, in the same shape a new upload returns (read data.id), plus duplicate: true. No new document is created and no processing starts (unless the existing document’s last read failed; see rereading); to re-process the existing document, call Extract.

Errors

400
Bad Request Error
401
Unauthorized Error
403
Forbidden Error
404
Not Found Error
409
Conflict Error
413
Content Too Large Error
422
Unprocessable Entity Error
429
Too Many Requests Error
500
Internal Server Error