Create a new upload. Supports two modes:
- Resumable (tus): Send only metadata headers to create the upload session, then upload data in chunks via Upload Chunk.
- Single request: Include the full file body in this request for a one-shot upload. Works with both
application/offset+octet-stream and multipart/form-data.
The upload ID returned is also the file ID in the file system.
Query Parameters
Target environment ID. Can also be provided in Upload-Metadata. Query params take precedence.
Parent folder ID. Defaults to environment root. Can also be in Upload-Metadata.
File name. Can also be provided in Upload-Metadata, or Content-Disposition header. Defaults to unnamed.
MIME type. Can also be provided in Upload-Metadata, or Content-Type header. Auto-detected from filename if omitted.
Total file size in bytes. Required for multi-chunk resumable uploads. For single-request uploads, Content-Length is used if this is omitted. Max: 2,621,440,000 (2.5 GB).
Base64-encoded key-value pairs. Supported keys: filename, filetype, vaultId, parentId, chunkSize, numberOfChunks.Format: key1 {base64_value},key2 {base64_value}
tus protocol version. Defaults to 1.0.0 if omitted.
application/offset+octet-stream for tus uploads, or multipart/form-data for single-request multipart uploads.
Response
Returns 201 Created.
Upload URL for subsequent PATCH and HEAD requests.
Current byte offset. 0 for a new upload, or equal to Upload-Length if the full file was included in this request.
When the upload completes (single request or final chunk), the response body contains:
{
"uploadId": "upload_xyz789"
}
Examples
curl -X POST "https://api.tusky.io/v2/uploads?vaultId=env_abc123&filename=photo.jpg" \
-H "Api-Key: YOUR_API_KEY" \
-F "file=@./photo.jpg"
curl -X POST "https://api.tusky.io/v2/uploads?vaultId=env_abc123&filename=photo.jpg&filetype=image/jpeg" \
-H "Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/offset+octet-stream" \
--data-binary @./photo.jpg
curl -X POST https://api.tusky.io/v2/uploads \
-H "Api-Key: YOUR_API_KEY" \
-H "Tus-Resumable: 1.0.0" \
-H "Upload-Length: 10485760" \
-H "Upload-Metadata: filename $(echo -n 'video.mp4' | base64),vaultId $(echo -n 'env_abc123' | base64),filetype $(echo -n 'video/mp4' | base64)" \
-D -
Response headers:HTTP/1.1 201 Created
Location: https://api.tusky.io/v2/uploads/upload_xyz789
Tus-Resumable: 1.0.0
Upload-Offset: 0
vaultId is required. Provide it via query parameter or Upload-Metadata. Query parameters take precedence over metadata headers.
Maximum file size is 2.5 GB. Maximum individual chunk size is 50 MB. Maximum number of chunks per upload is 10,000.