cURL
curl --request POST \ --url https://www.datalab.to/api/v1/files/upload \ --header 'Content-Type: application/json' \ --header 'X-API-Key: <api-key>' \ --data ' { "filename": "<string>", "content_type": "<string>" } '
{ "file_id": 123, "upload_url": "<string>", "reference": "<string>", "expires_in": 3600 }
Request a presigned upload URL for direct client-side upload to R2.
This is the recommended upload flow:
Request to get a presigned upload URL.
Original filename (used for R2 path and metadata)
MIME type of the file
Successful Response
Response with presigned PUT URL for direct R2 upload.
Unique file ID (use this to confirm upload)
Presigned PUT URL to upload the file to
File reference in datalab://file-{id} format
URL expiry time in seconds
Was this page helpful?