POST /upload is the entry point for generating Contractor and Carrier ESX files. Every accepted upload returns a document_id, which becomes the handle for polling, streaming, and downstream bookkeeping.
If you are using an agent client such as ChatGPT, Claude, or Codex, see CapOut MCP instead. The MCP staged upload flow is separate from the public REST POST /upload contract documented here.
Supported request shapes
Send a url
Use url when the document is already available at a fetchable HTTPS location.
Send file_base64
Use file_base64 when your application sends document bytes inline in the JSON payload.
Inline base64 uploads are supported up to 50 MiB.
Required fields
Every upload includesfile_name, the original filename shown in downstream responses.
Exactly one of these payload fields must be present:
url: an immediately downloadable HTTPS PDFfile_base64: PDF bytes encoded as base64s3_path: a protected staged path returned byPOST /upload-url
xn_address and profile_code. They are optional, deprecated compatibility fields from the older XactNet delivery flow. CapOut now generates both Contractor (8D) and Carrier (5L) ESX files for every successful export, regardless of a legacy profile_code value.
If multiple source fields are present, or if no source field is present, the API returns 422.
Your request chooses the PDF source. CapOut chooses the protected AWS storage
bucket and key used for intake; callers cannot override where the PDF is written
inside CapOut’s AWS storage.
Encode a local file to base64
These examples show the local-file-to-base64 step that teams often use before constructing an inline upload request, including workflows that start with scanner images or other local files.Python
Node.js
curl
Use the base64 string as the file_base64 field in the upload request:
What to store after upload
Persist at least these response fields on your side:document_idstatuscreated_atstatus_urldownload_url: stable Contractor download URL and the default linkcontractor_download_url: explicit Contractor (8D) linkcarrier_download_url: explicit Carrier (5L) link
409 until export completion. Store the clean api.capout.ai links, not the temporary S3 URL reached after redirect.
Validation and retries
- Review
422responses first when an upload is rejected. They indicate request-shape problems such as sending multiple PDF sources, sending no source, or omittingfile_name. - Retry upload failures from the same source document after correcting the request or transport problem.
- Reuse the returned
document_idfor all follow-up status checks, realtime subscriptions, and internal job mapping.
Typical follow-up flow
- Upload the document.
- Store
document_idon your internal job or claim record. - Poll
GET /status/{document_id}for simple backends, or open a realtime stream for richer UX while the export workflow completes. - Optionally query
GET /documentsto reconcile the authenticated organization’s recent uploads. - Give the user
download_urlfor Contractor orcarrier_download_urlfor Carrier after the export completes, and require their client to send the same organization’scapout-api-keywhen requesting it.