File Uploads
Learn how to securely upload files to sajn for use in document fields.Overview
Uploading a file uses a presigned flow that sends the bytes straight to storage, so there is no API-server size limit:- Request a presigned URL — call
POST /api/v1/fileswith the file’s metadata and checksum. You receive afileId, a storagekey, and a presigneduploadUrl. - Upload the bytes —
PUTthe raw file to theuploadUrl. Storage verifies the checksum on write. - Confirm the upload (recommended) — call
POST /api/v1/files/{id}/confirmto verify the stored object and flip the record fromPENDINGtoCONFIRMEDimmediately. - Use the storage key — reference the returned
keyin document fields.
Confirming is optional. If you skip step 3, the file is confirmed lazily the first time it is fetched via
GET /api/v1/files/{id}. Calling confirm explicitly verifies the upload up front and is idempotent.Benefits
- No byte-through step: bytes go directly to cloud storage (up to 25 MB per file).
- Integrity-checked: storage enforces the SHA-256 checksum you provide and rejects mismatched bytes.
- Secure: files are scoped to your organization, private by default.
Step 1: Request a Presigned URL
Compute the file’s SHA-256 hash, base64-encoded, then callPOST /api/v1/files:
Request
Request Fields
Response
fileId— the created file record ID. Its status isPENDINGuntil the upload is confirmed on first access.key— the storage key to reference in document fields.uploadUrl— presignedPUTURL, valid for 1 hour.
Step 2: Upload the Bytes
PUT the raw file to the uploadUrl. You must send the Content-Type and the x-amz-checksum-sha256 headers — storage verifies the checksum and rejects the upload if it doesn’t match:
Do not send your sajn
Authorization header to the presigned uploadUrl — authentication is already baked into the signed URL.Step 3: Confirm the Upload (Recommended)
Right after the uploadPUT returns 200, call POST /api/v1/files/{id}/confirm. The server reads the persisted object back from storage, verifies its size and checksum, then flips the file from PENDING to CONFIRMED:
Response
size— the byte size of the persisted object, read back from storage.checksumVerified— whether the storage backend reported a SHA-256 that matched the checksum you supplied at create time.
File Visibility
Control who can access your uploaded files via thevisibility field in Step 1:
PRIVATE(default) — access requires a fresh signed URL (valid for 60 minutes), retrieved viaGET /api/v1/files/{id}.PUBLIC— accessible via a permanent CloudFront URL.
Using Uploaded Files in Documents
After a successful upload, use the storagekey in document field metadata. You can either create a new PDF field or update an existing one:
PDF fields use
value for the file storage key, while TEXT and HTML fields use content for their data. See the API Reference for full details on each field type.Create New PDF Field
Use the Create Document Field endpoint to add the uploaded PDF:Update Existing PDF Field
Use the Update Document Field endpoint to replace an existing PDF:Complete Upload Workflow
cURL Example
Node.js Example
File Requirements
Supported Formats
Limits
- Maximum size: 25 MB per file (
26214400bytes). - Checksum: a valid base64-encoded SHA-256 of the exact bytes you upload is required.
Error Handling
Common Errors
File Too Large
size matches the actual byte count.
Checksum Mismatch
When the bytes youPUT don’t match the checksum you declared in Step 1, storage rejects the upload.
Solution: Re-compute the base64-encoded SHA-256 over the exact bytes you upload, and send it both in the create request and in the x-amz-checksum-sha256 header.
Missing Authentication
Authorization: Bearer header on the POST /api/v1/files call (but not on the presigned uploadUrl).
Best Practices
- Compute size and checksum together from the same byte buffer you upload.
- Validate file type and size client-side before requesting a presigned URL.
- Upload promptly — the presigned
uploadUrlis only valid for 1 hour. - Store storage keys for later reference in document fields.
Related Resources
Guides
- Creating Documents - Learn how to create and configure documents
- Send for Signing - Send your document for signatures
- Webhooks - Get notified when documents are signed
API Reference
- Create a File (presigned upload) - Request a presigned upload URL
- Confirm a File - Verify the upload and mark it CONFIRMED
- Get File - Retrieve a file (confirms the upload on first fetch)
- Create Document Field - Add fields to documents
- Update Document Field - Modify existing fields

