curl -X DELETE "$ATAI_API_URL/api/agents/packages/pkg_01jcb2x7m4qv8n3h5t6rk9dzs0" \
-H "Authorization: Bearer $ATAI_API_KEY"
import os
import requests
base_url = os.environ["ATAI_API_URL"]
api_key = os.environ["ATAI_API_KEY"]
response = requests.delete(
f"{base_url}/api/agents/packages/pkg_01jcb2x7m4qv8n3h5t6rk9dzs0",
headers={"Authorization": f"Bearer {api_key}"},
)
if response.status_code == 204:
print("Package deleted")
else:
print(f"Error: {response.json()['errors']}")
const response = await fetch(
`${process.env.ATAI_API_URL}/api/agents/packages/pkg_01jcb2x7m4qv8n3h5t6rk9dzs0`,
{
method: 'DELETE',
headers: {
'Authorization': `Bearer ${process.env.ATAI_API_KEY}`
}
}
);
if (response.status === 204) {
console.log('Package deleted');
} else {
const body = await response.json();
console.error('Error:', body.errors);
}
{
"errors": [
{
"code": "forbidden",
"message": "The package's project cannot be modified.",
"suggestion": null,
"error_uid": "err-xxxxxxxx"
}
]
}
{
"errors": [
{
"code": "not_found",
"message": "Package 'pkg_01jcb2x7m4qv8n3h5t6rk9dzs0' not found",
"suggestion": null,
"error_uid": "err-xxxxxxxx"
}
]
}
{
"errors": [
{
"code": "conflict",
"message": "package 'pkg_01jcb2x7m4qv8n3h5t6rk9dzs0' has agents run from it; delete them first (list them with `GET /api/agents/instances?package_id=pkg_01jcb2x7m4qv8n3h5t6rk9dzs0`)",
"suggestion": null,
"error_uid": "err-xxxxxxxx"
}
]
}
Packages
Delete Package
Delete a package by id once no agent runs from it remain
DELETE
/
api
/
agents
/
packages
/
{package_id}
curl -X DELETE "$ATAI_API_URL/api/agents/packages/pkg_01jcb2x7m4qv8n3h5t6rk9dzs0" \
-H "Authorization: Bearer $ATAI_API_KEY"
import os
import requests
base_url = os.environ["ATAI_API_URL"]
api_key = os.environ["ATAI_API_KEY"]
response = requests.delete(
f"{base_url}/api/agents/packages/pkg_01jcb2x7m4qv8n3h5t6rk9dzs0",
headers={"Authorization": f"Bearer {api_key}"},
)
if response.status_code == 204:
print("Package deleted")
else:
print(f"Error: {response.json()['errors']}")
const response = await fetch(
`${process.env.ATAI_API_URL}/api/agents/packages/pkg_01jcb2x7m4qv8n3h5t6rk9dzs0`,
{
method: 'DELETE',
headers: {
'Authorization': `Bearer ${process.env.ATAI_API_KEY}`
}
}
);
if (response.status === 204) {
console.log('Package deleted');
} else {
const body = await response.json();
console.error('Error:', body.errors);
}
{
"errors": [
{
"code": "forbidden",
"message": "The package's project cannot be modified.",
"suggestion": null,
"error_uid": "err-xxxxxxxx"
}
]
}
{
"errors": [
{
"code": "not_found",
"message": "Package 'pkg_01jcb2x7m4qv8n3h5t6rk9dzs0' not found",
"suggestion": null,
"error_uid": "err-xxxxxxxx"
}
]
}
{
"errors": [
{
"code": "conflict",
"message": "package 'pkg_01jcb2x7m4qv8n3h5t6rk9dzs0' has agents run from it; delete them first (list them with `GET /api/agents/instances?package_id=pkg_01jcb2x7m4qv8n3h5t6rk9dzs0`)",
"suggestion": null,
"error_uid": "err-xxxxxxxx"
}
]
}
Requires version 2.0.0 or later of the Archetype platform.
Overview
This endpoint deletes a package by itspkg_ id. The blueprint it held is untouched.
A run keeps the package it came from for its whole history, so a package that agents have been
run from returns 409. List those runs with List
Agents and package_id, delete them, then delete
the package.
Request
string
required
Package
pkg_ id.Response
Returns204 No Content with an empty body on success.
curl -X DELETE "$ATAI_API_URL/api/agents/packages/pkg_01jcb2x7m4qv8n3h5t6rk9dzs0" \
-H "Authorization: Bearer $ATAI_API_KEY"
import os
import requests
base_url = os.environ["ATAI_API_URL"]
api_key = os.environ["ATAI_API_KEY"]
response = requests.delete(
f"{base_url}/api/agents/packages/pkg_01jcb2x7m4qv8n3h5t6rk9dzs0",
headers={"Authorization": f"Bearer {api_key}"},
)
if response.status_code == 204:
print("Package deleted")
else:
print(f"Error: {response.json()['errors']}")
const response = await fetch(
`${process.env.ATAI_API_URL}/api/agents/packages/pkg_01jcb2x7m4qv8n3h5t6rk9dzs0`,
{
method: 'DELETE',
headers: {
'Authorization': `Bearer ${process.env.ATAI_API_KEY}`
}
}
);
if (response.status === 204) {
console.log('Package deleted');
} else {
const body = await response.json();
console.error('Error:', body.errors);
}
{
"errors": [
{
"code": "forbidden",
"message": "The package's project cannot be modified.",
"suggestion": null,
"error_uid": "err-xxxxxxxx"
}
]
}
{
"errors": [
{
"code": "not_found",
"message": "Package 'pkg_01jcb2x7m4qv8n3h5t6rk9dzs0' not found",
"suggestion": null,
"error_uid": "err-xxxxxxxx"
}
]
}
{
"errors": [
{
"code": "conflict",
"message": "package 'pkg_01jcb2x7m4qv8n3h5t6rk9dzs0' has agents run from it; delete them first (list them with `GET /api/agents/instances?package_id=pkg_01jcb2x7m4qv8n3h5t6rk9dzs0`)",
"suggestion": null,
"error_uid": "err-xxxxxxxx"
}
]
}
Important Notes
- A
409means agents have been run from the package. Delete those runs first; the message links the List Agents query that finds them. - Outside a project, a user who is not an org admin lists only their own runs. If other users’ runs block the delete, the
409message says so, and their owner or an org admin must delete them. - A
403means you can see the package’s project but cannot modify it. - A
404means the package does not exist, belongs to another organization, or is in a project you cannot see. - Success returns
204with no body. Check the status code rather than parsing a response.
Was this page helpful?