Add assets to a folder
curl --request POST \
--url https://api.zerogen.com/v1/projects/{projectId}/folders/{folderId}/assets \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"assetIds": [
"3f6c2a1e-8b4d-4e2a-9c7f-1a2b3c4d5e6f"
]
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({assetIds: ['3f6c2a1e-8b4d-4e2a-9c7f-1a2b3c4d5e6f']})
};
fetch('https://api.zerogen.com/v1/projects/{projectId}/folders/{folderId}/assets', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.zerogen.com/v1/projects/{projectId}/folders/{folderId}/assets"
payload = { "assetIds": ["3f6c2a1e-8b4d-4e2a-9c7f-1a2b3c4d5e6f"] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"folderId": "<string>",
"updatedAssetIds": [
"<string>"
],
"skippedAssetIds": [
"<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": {}
}
}Folders
Add assets to a folder
Adds up to 100 assets to the folder, keeping their other folders. The response lists the assets changed and those skipped.
Needs the library:organize scope.
POST
/
projects
/
{projectId}
/
folders
/
{folderId}
/
assets
Add assets to a folder
curl --request POST \
--url https://api.zerogen.com/v1/projects/{projectId}/folders/{folderId}/assets \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"assetIds": [
"3f6c2a1e-8b4d-4e2a-9c7f-1a2b3c4d5e6f"
]
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({assetIds: ['3f6c2a1e-8b4d-4e2a-9c7f-1a2b3c4d5e6f']})
};
fetch('https://api.zerogen.com/v1/projects/{projectId}/folders/{folderId}/assets', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.zerogen.com/v1/projects/{projectId}/folders/{folderId}/assets"
payload = { "assetIds": ["3f6c2a1e-8b4d-4e2a-9c7f-1a2b3c4d5e6f"] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"folderId": "<string>",
"updatedAssetIds": [
"<string>"
],
"skippedAssetIds": [
"<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.
Required string length:
1 - 255Pattern:
^[\x21-\x7e]+$Body
application/json
Up to 100 assets
Required array length:
1 - 100 elementsPattern:
^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$