Uploads
Overview
The Uploads API provides endpoints for generating signed URLs for secure file uploads to S3.
Endpoints
Get Signed Upload URL
Generate a pre-signed URL for uploading files.
Endpoint: POST /v1/uploads/sign
Authentication: Optional (recommended)
Request Body:
{
"fileName": "document.pdf",
"contentType": "application/pdf",
"expiresIn": 3600
}Response: 200 OK
{
"uploadUrl": "https://s3.amazonaws.com/...",
"expiresIn": 3600,
"fileId": "file_123"
}Usage
Upload Flow
Request signed URL from API
Upload file directly to S3 using signed URL
Include file ID in form submission
Example
// 1. Get signed URL
const { uploadUrl, fileId } = await fetch('/v1/uploads/sign', {
method: 'POST',
body: JSON.stringify({
fileName: 'document.pdf',
contentType: 'application/pdf'
})
}).then(r => r.json());
// 2. Upload to S3
await fetch(uploadUrl, {
method: 'PUT',
body: file,
headers: {
'Content-Type': 'application/pdf'
}
});
// 3. Submit form with file ID
await submitForm({
answers: {
document: fileId
}
});Security
Signed URLs expire after specified time (default: 1 hour)
Content-Type validation
File size limits (configured per form)
Virus scanning (optional)
Examples
Get Signed URL
curl -X POST https://api.formr.xyz/v1/uploads/sign \
-H "Content-Type: application/json" \
-d '{
"fileName": "document.pdf",
"contentType": "application/pdf",
"expiresIn": 3600
}'Next Steps
API Reference - API overview
Submissions API - Form submission
Security - Security best practices
Last updated