Skip to main content
POST
/
upload
/
presigned
Get presigned upload URL
curl --request POST \
  --url https://asteragents.com/api/upload/presigned \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "filename": "report.pdf",
  "contentType": "application/pdf"
}
'
{
  "url": "https://account-id.r2.cloudflarestorage.com/bucket/...",
  "method": "PUT",
  "fileId": "550e8400-e29b-41d4-a716-446655440000",
  "key": "org_xxx/uploads/550e8400-e29b-41d4-a716-446655440000/report.pdf",
  "contentKey": "org_xxx/contents/550e8400-e29b-41d4-a716-446655440000.md",
  "metadata": {
    "contentType": "application/pdf",
    "orgId": "org_xxx",
    "userId": "user_xxx"
  }
}

Authorizations

Authorization
string
header
required

JWT token from Clerk authentication.

Must be from a user with org:admin role.

Body

application/json
filename
string
required

The name of the file being uploaded

Example:

"report.pdf"

contentType
string
required

The MIME type of the file

Example:

"application/pdf"

Response

Presigned URL generated successfully

url
string<uri>
required

The presigned URL to upload the file to

Example:

"https://account-id.r2.cloudflarestorage.com/bucket/..."

method
enum<string>
required

The HTTP method to use (always PUT)

Available options:
PUT
Example:

"PUT"

fileId
string<uuid>
required

Unique identifier for the uploaded file

Example:

"550e8400-e29b-41d4-a716-446655440000"

key
string
required

The storage key/path where the file will be stored

Example:

"org_xxx/uploads/550e8400-e29b-41d4-a716-446655440000/report.pdf"

contentKey
string
required

The storage key for extracted text content (for documents)

Example:

"org_xxx/contents/550e8400-e29b-41d4-a716-446655440000.md"

metadata
object
required

Values that MUST be included as headers when uploading to the presigned URL