Presigned R2 PUT for one xorb
POST
/v1/datasets/upload/prepare-object
const url = 'https://example.com/v1/datasets/upload/prepare-object';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"blob_id":"example","content_length":1,"ttl_seconds":300}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/v1/datasets/upload/prepare-object \ --header 'Content-Type: application/json' \ --data '{ "blob_id": "example", "content_length": 1, "ttl_seconds": 300 }'Content-addressed presigned PUT URL. The customer PUTs the xorb bytes straight to R2 with this URL — bytes never touch the gateway.
Parameters
Section titled “ Parameters ”Header Parameters
Section titled “Header Parameters ” x-api-key
string | null
Request Body required
Section titled “Request Body required ” Media type application/json
PrepareUploadBody
object
blob_id
required
string
content_length
required
integer
ttl_seconds
integer
Responses
Section titled “ Responses ”Successful Response
Media type application/json
Example generated
exampleValidation Error
Media type application/json
HTTPValidationError
object
detail
Array<object>
ValidationErrorobject
loc
required
Location
Array<string | integer>
msg
required
Message
string
type
required
Error Type
string
input
ctx
Context
object
Example generated
{ "detail": [ { "loc": [ "example" ], "msg": "example", "type": "example", "input": "example", "ctx": {} } ]}