Skip to main content
GET
/
api
/
presigned-url
Presigned URLs
curl --request GET \
  --url https://cdn.sacul.cloud/api/presigned-url \
  --header 'Content-Type: <content-type>'

Documentation Index

Fetch the complete documentation index at: https://docs.sacul.cloud/llms.txt

Use this file to discover all available pages before exploring further.

Presigned URLs allow you to offload file handling to clients while maintaining security and path locking.

1. Generate Presigned Token

Create a short-lived token that locks an upload to a specific path or folder. Method: GET
Path: /api/presigned-url

Authentication

Requires an API Key via Authorization, X-API-Key, or apiKey query parameter.

Query Parameters

path
string
If ends with /, locks to a folder. Otherwise, locks to a specific filename.
expiresAt
number
TTL for the token in seconds (default 3600).
randomizeName
boolean
Force UUID filenames for the upload.

Response

{
    "success": true,
    "url": "https://cdn.sacul.cloud/api/presigned-url/TOKEN",
    "expiresIn": 3600
}

2. Upload via Token

Upload the file content using the generated token. Method: POST
Path: /api/presigned-url/:token

Headers

Content-Type
string
default:"multipart/form-data"
required
multipart/form-data

Note

The token is consumed immediately after one successful upload.

Example Flow

# 1. Get the URL
curl "https://cdn.sacul.cloud/api/presigned-url?path=avatars/&randomizeName=true" \
    -H "Authorization: Bearer <your-api-key>"

# 2. Upload using the resulting URL
curl -X POST https://cdn.sacul.cloud/api/presigned-url/YOUR_TOKEN \
    -F "[email protected]"