Request the presigned URL to upload a new file or a new version directly to R2 (valid for 1 hour)
const url = 'https://api.replifier.com/v1/brands/brd_01hx0000000000000000000000/drive/uploads';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"name":"example","mime":"example","bytes":1,"sha256":"example","folderId":"example","fileId":"example","forBrandKit":true}'};
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://api.replifier.com/v1/brands/brd_01hx0000000000000000000000/drive/uploads \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "name": "example", "mime": "example", "bytes": 1, "sha256": "example", "folderId": "example", "fileId": "example", "forBrandKit": true }'Upload with PUT to the returned URL sending EXACTLY the given headers (the type and the SHA-256 are signed), then call POST /v1/drive/uploads/{id}:complete. Per-file limits: image 25 MB and 40 megapixels, document 100 MB, font 5 MB.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Example
brd_01hx0000000000000000000000Request Bodyrequired
Section titled “Request Bodyrequired”object
Hex-encoded SHA-256 of the file. R2 verifies it when it receives the body.
If sent, the upload creates a new version of that file.
SVG is only accepted for the brand kit.
Example generated
{ "name": "example", "mime": "example", "bytes": 1, "sha256": "example", "folderId": "example", "fileId": "example", "forBrandKit": true}Responses
Section titled “Responses”Upload
object
object
object
An active file with the same SHA-256 already exists in the brand: offered for reuse.
object
Example
{ "status": "pending", "upload": { "method": "PUT" }}Invalid data
object
object
Example
{ "error": { "code": "not_found" }}No session, expired session, or invalid, expired or revoked API key
object
object
Example
{ "error": { "code": "not_found" }}Error
object
object
Example
{ "error": { "code": "not_found" }}Not allowed, API key missing the scope, IP not allowed, or request rejected (csrf_rejected)
object
object
Example
{ "error": { "code": "not_found" }}Does not exist or is not visible to you
object
object
Example
{ "error": { "code": "not_found" }}Error
object
object
Example
{ "error": { "code": "not_found" }}Error
object
object
Example
{ "error": { "code": "not_found" }}Internal error
object
object
Example
{ "error": { "code": "not_found" }}Service temporarily unavailable
object
object
Example
{ "error": { "code": "not_found" }}