Get Storage Upload URL
GET/api/v1/assets/new/content_storage_url
Get a pre-signed URL for uploading a file directly to cloud storage (S3). The returned URL and signing fields allow the client to POST the file to S3 without routing file bytes through the FileSpin API server.
This is a three-step upload flow:
- Get storage URL — Call this endpoint with the
filenameparameter. The response contains a pre-signed S3 POST URL, signing fields, and anasset_id. - Upload to S3 — POST the file as
multipart/form-datato the returnedstorage.url, including allstorage.fieldsas form fields and the file as thefilefield. - Register the asset — Call
POST /api/v1/assets/new/register_assetwith theasset_id, filesize,checksum, and upload timestamps to register the asset in FileSpin and trigger processing.
When to use this endpoint
Use this endpoint when you need to upload files from a client that can POST directly to S3 (e.g., the FileSpin File Picker widget, Teleport, or a custom uploader). For simpler server-side uploads, use the standard Upload Asset endpoint instead.
Pre-signed URL expiry
The returned URL is valid for 24 hours (expiry: 86400 seconds). After expiry, you must request a new URL.
Example response
{
"asset_id": "ec279822540b412e903827f473bb53a3",
"storage": {
"name": "photo.jpg",
"url": "https://my-bucket.s3.amazonaws.com/",
"fields": {
"key": "originals/ec279822540b412e903827f473bb53a3/original/original__photo.jpg",
"x-amz-algorithm": "AWS4-HMAC-SHA256",
"x-amz-credential": "AKIA.../20240515/eu-west-2/s3/aws4_request",
"x-amz-date": "20240515T154302Z",
"policy": "eyJleHBpcmF0aW9uIjog...",
"x-amz-signature": "cc47e86f1353..."
},
"protocol": "POST",
"expiry": 86400,
"key": "/originals/ec279822540b412e903827f473bb53a3/original/original__photo.jpg",
"bucket": "my-bucket",
"storage_type": "AMAZON_S3"
}
}
Uploading to S3
Use the storage.url and storage.fields to construct a multipart POST request to S3:
curl -X POST "https://my-bucket.s3.amazonaws.com/" \
-F "key=originals/ec279822.../original/original__photo.jpg" \
-F "x-amz-algorithm=AWS4-HMAC-SHA256" \
-F "x-amz-credential=AKIA.../20240515/eu-west-2/s3/aws4_request" \
-F "x-amz-date=20240515T154302Z" \
-F "policy=eyJleHBpcmF0aW9uIjog..." \
-F "x-amz-signature=cc47e86f1353..." \
-F "file=@photo.jpg"
Registering the asset
After a successful S3 upload, register the asset so FileSpin can begin processing:
curl -X POST "https://app.filespin.io/api/v1/assets/new/register_asset" \
-H "X-FileSpin-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"asset_id": "ec279822540b412e903827f473bb53a3",
"size": 1048576,
"checksum": "d41d8cd98f00b204e9800998ecf8427e",
"upload_time": "2024-05-15T15:43:02Z",
"upload_started_at": "2024-05-15T15:43:00Z",
"upload_completed_at": "2024-05-15T15:43:02Z",
"service_data": {
"app": "MyApp",
"build": "1.0.0",
"deployment_data": {
"client": "WebUploader",
"location": "LONDON"
},
"network_bandwidth": 50
}
}'
Request
Responses
- 200
- 400
- 401
- 403
- 500
Pre-signed upload URL generated successfully
Bad request. Possible error messages:
MISSING_MANDATORY_PARAMETERS—filenamequery parameter is missingASSET_ID_EXISTS— the providedasset_idalready existsINVALID_REQUEST— unsupported protocol value
Unauthorized — invalid or missing authentication
Forbidden. Possible reasons:
- Authentication failed
- Upload limit exceeded (FREE plan)
- User account is disabled
Internal server error — storage URL generation failed