Signed URLs
Signed URLs
Signed URLs
Generate temporary access URLs for private files.
POST
Signed URLs
Generate a signed URL to access a private file. Signed URLs expire after the specified duration.
This endpoint requires a secret key (
sk_). Public keys cannot generate signed URLs.Request
Path Parameters
The file ID. Example:
f_abc123xyzBody Parameters
URL validity in seconds. Max: 604800 (7 days).
Response
Signed URL that grants temporary access to the file.
ISO 8601 timestamp when the URL expires.
Examples
Generate a 1-Hour URL
Response
Common Expiration Times
| Duration | Seconds |
|---|---|
| 15 minutes | 900 |
| 1 hour | 3600 |
| 24 hours | 86400 |
| 7 days | 604800 |
Use Cases
Secure File Downloads
Image Previews
Errors
| Code | Status | Description |
|---|---|---|
unauthorized | 401 | Invalid or missing API key |
forbidden | 403 | Public key used (requires secret key) |
not_found | 404 | File not found |
bad_request | 400 | Invalid expires_in value |
rate_limit_exceeded | 429 | Too many requests |
Best Practices
Use short expiration times
Use short expiration times
Generate URLs with the minimum required validity. This limits exposure if a URL is leaked.
Generate on-demand
Generate on-demand
Don’t store signed URLs. Generate them when needed—they’re fast to create.
Don't expose in client-side code
Don't expose in client-side code
Generate signed URLs on your server and pass them to the client. Never expose your secret key.