Skip to content

File Uploads

The StrawBlond API uses a secure three-step file upload process for optimal performance and security.

The file upload process involves:

  1. Request a signed upload URL - Get temporary upload credentials
  2. Upload file directly - Upload file using the provided signed URL
  3. Register the file - Use the UUID and key from the signed URL response to register the file in the system

This approach enables direct uploads with progress tracking while maintaining security.

Uploading Files

Step 1: Request Signed Upload URL

post
/vapor/signed-storage-url
Attribute (* required)TypeDescription
bucketString?Bucket name (defaults to configured bucket)
content_type *StringMIME type of the file being uploaded
expiresString?Expiration time for the signed URL
visibilityString?File visibility setting

Example response

json
// HTTP 201 Created
{
    "uuid": "550e8400-e29b-41d4-a716-446655440000",
    "bucket": "your-s3-bucket",
    "key": "tmp/550e8400-e29b-41d4-a716-446655440000",
    "url": "https://your-s3-bucket.s3.eu-central-1.amazonaws.com/tmp/550e8400-e29b-41d4-a716-446655440000?X-Amz-Algorithm=...",
    "headers": {
        "Content-Type": "image/jpeg",
        "x-amz-acl": "private"
    }
}

Step 2: Upload File to Signed URL

Use the signed URL to upload your file directly:

javascript
const response = await fetch(signedData.url, {
    method: 'PUT',
    headers: signedData.headers,
    body: file
});

Important Notes:

  • Remove the Host header if present (it's automatically set by browsers)
  • Use PUT method, not POST
  • Include all headers from the signed URL response
  • Upload progress can be tracked using XMLHttpRequest or axios

Step 3: Register the File

After uploading, you can use the response data from the signed URL request in subsequent API calls like:

File Size Limits

File uploads are subject to size limits. Maximum file size varies by file type and endpoint, and available storage quotas may apply per organization. Refer to specific endpoint documentation for size limits.