curl --request POST \
--url https://api.zerogen.com/v1/uploads \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"filename": "reference.png",
"contentType": "image/png",
"sizeBytes": 482113
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({filename: 'reference.png', contentType: 'image/png', sizeBytes: 482113})
};
fetch('https://api.zerogen.com/v1/uploads', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.zerogen.com/v1/uploads"
payload = {
"filename": "reference.png",
"contentType": "image/png",
"sizeBytes": 482113
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "<string>",
"projectId": "<string>",
"status": "upload_required",
"assetId": "<string>",
"upload": {
"method": "PUT",
"url": "<string>",
"headers": {},
"expiresAt": "2023-11-07T05:31:56Z"
},
"folder": {
"id": "<string>",
"filed": true,
"error": "<string>"
}
}{
"id": "<string>",
"projectId": "<string>",
"status": "upload_required",
"assetId": "<string>",
"upload": {
"method": "PUT",
"url": "<string>",
"headers": {},
"expiresAt": "2023-11-07T05:31:56Z"
},
"folder": {
"id": "<string>",
"filed": true,
"error": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
}
}Create an upload
Starts an upload into the Library. PUT the file’s exact bytes to the returned target, then complete the upload. With sha256, an identical file already in the project comes back ready, with nothing to send.
Needs the uploads:create scope.
curl --request POST \
--url https://api.zerogen.com/v1/uploads \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"filename": "reference.png",
"contentType": "image/png",
"sizeBytes": 482113
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({filename: 'reference.png', contentType: 'image/png', sizeBytes: 482113})
};
fetch('https://api.zerogen.com/v1/uploads', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.zerogen.com/v1/uploads"
payload = {
"filename": "reference.png",
"contentType": "image/png",
"sizeBytes": 482113
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "<string>",
"projectId": "<string>",
"status": "upload_required",
"assetId": "<string>",
"upload": {
"method": "PUT",
"url": "<string>",
"headers": {},
"expiresAt": "2023-11-07T05:31:56Z"
},
"folder": {
"id": "<string>",
"filed": true,
"error": "<string>"
}
}{
"id": "<string>",
"projectId": "<string>",
"status": "upload_required",
"assetId": "<string>",
"upload": {
"method": "PUT",
"url": "<string>",
"headers": {},
"expiresAt": "2023-11-07T05:31:56Z"
},
"folder": {
"id": "<string>",
"filed": true,
"error": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
}
}Authorizations
A ZeroGen API key: zg_ for a live key, zg_test_ for a test key.
Headers
Makes retries safe: a retry with the same key and body returns the first response for 24 hours instead of repeating the work. Reusing a key with a different body returns 409.
1 - 255^[\x21-\x7e]+$Body
1 - 1024^(?:.*[\\/])?[^\\/]{1,255}$audio/aac, audio/aiff, audio/flac, audio/mp4, audio/mpeg, audio/ogg, audio/wav, image/avif, image/bmp, image/gif, image/jpeg, image/png, image/tiff, image/webp, video/mp4, video/quicktime, video/webm, video/x-matroska, video/x-msvideo 1 <= x <= 5368709120The project to upload into; omit for the organization's default project.
^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$Add the asset to this folder in the project.
^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$Lowercase hex SHA-256 of the file, to reuse an identical file in the project.
^[0-9a-f]{64}$Response
An identical file is already in the project.
The upload's ID, which completes it
upload_required: PUT the bytes, then complete; ready: the asset can be used
upload_required, ready Once ready, the Library asset to send as a generation input; an identical file already in the project is reused
Where to PUT the file's exact bytes, with these headers, before expiresAt
Show child attributes
Show child attributes
Whether the asset was added to the folder named at create
Show child attributes
Show child attributes