Downloads
You can retrieve the original uploaded document or a generated result file.
Choose one of three response styles:
- Raw bytes for direct streaming
- Base64 JSON for JSON-only clients
- A temporary URL for browser downloads and larger files
Retrieve the original document
Request a temporary URL:
curl \
"https://sandbox-api.shipwell.com/document-store/documents/<document-id>/presigned-url" \
-H "Authorization: Token <user-token>"import requests
response = requests.get(
"https://sandbox-api.shipwell.com/document-store/documents/<document-id>/presigned-url",
headers={"Authorization": "Token <user-token>"},
timeout=30,
)
response.raise_for_status()
temporary_url = response.json()["download_url"]Use GET /document-store/documents/{id}/file to stream the original bytes. Add encoding=base64 for a JSON response.
Base64 responses have an inline size limit. If the endpoint returns 413, use a temporary URL.
The temporary URL response includes download_url and expires_in. Treat the URL as sensitive and do not store it as a permanent document reference.
Retrieve a split result file
When split processing creates a generated PDF for a result, use the result identifier rather than the parent document identifier.
Use GET /document-store/results/{id}/file for raw bytes, add encoding=base64 for JSON, or use GET /document-store/results/{id}/presigned-url for a temporary URL.
Result file endpoints return 404 when the result does not have a generated file.
Find result identifiers
Retrieve every result for a completed run:
Use GET /document-store/documents/{id}/results?run_id={run_id}.
Use a row's id with the result file endpoints. output_file_ref indicates that the result has a generated file, but applications should use the authenticated download endpoints rather than that reference directly.
Download recommendations
-
Store
document_idorresult_id, not temporary URLs. -
Follow the returned
content_typeinstead of assuming every source is a PDF. - Stream large responses rather than buffering them entirely in memory.
- Validate filenames before writing to a local filesystem.
- Request a fresh temporary URL after the previous URL expires.
- Do not expose temporary URLs in analytics, logs, or error messages.