POST
/
v1
/
storage
/
presigned-upload
curl -X POST https://api.verbalisai.com/v1/storage/presigned-upload \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "filename": "audio-recording.mp3",
    "contentType": "audio/mpeg",
    "fileSize": 1048576
  }'
{
  "success": true,
  "data": {
    "uploadUrl": "https://r2-bucket.domain.com/upload-path?X-Amz-Algorithm=...",
    "fileKey": "user123/audio-recording-1642234567.mp3",
    "expiresIn": 3600,
    "maxFileSize": 1073741824,
    "allowedContentTypes": ["audio/mpeg", "audio/wav", "audio/flac"]
  }
}

Generate a presigned URL that allows direct file upload to R2 storage without going through the API server. This is useful for large files or client-side uploads.

This endpoint requires authentication via API key.

filename
string
required

Name of the file to upload

contentType
string
required

MIME type of the file (e.g., ‘audio/mpeg’, ‘audio/wav’)

fileSize
number

Size of the file in bytes (for validation)

curl -X POST https://api.verbalisai.com/v1/storage/presigned-upload \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "filename": "audio-recording.mp3",
    "contentType": "audio/mpeg",
    "fileSize": 1048576
  }'
{
  "success": true,
  "data": {
    "uploadUrl": "https://r2-bucket.domain.com/upload-path?X-Amz-Algorithm=...",
    "fileKey": "user123/audio-recording-1642234567.mp3",
    "expiresIn": 3600,
    "maxFileSize": 1073741824,
    "allowedContentTypes": ["audio/mpeg", "audio/wav", "audio/flac"]
  }
}

Response Fields

success
boolean

Indicates if the request was successful

data
object

Usage Notes

  • The presigned URL expires after the specified time (typically 1 hour)
  • Use PUT method to upload the file to the presigned URL
  • Include the correct Content-Type header when uploading
  • File size must not exceed the maximum limit
  • After successful upload, use the fileKey to reference the file in other API calls