curl -X DELETE "$ATAI_API_URL/agents/optimizations/opt_01jcb1m3t7v5xq8nr2h6kdzs4w" \
-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}/agents/optimizations/opt_01jcb1m3t7v5xq8nr2h6kdzs4w",
headers={"Authorization": f"Bearer {api_key}"},
)
if response.status_code == 204:
print("Optimization deleted")
elif response.status_code == 409:
print("Optimization is not terminal — cancel it first")
else:
print(f"Error: {response.json()['errors']}")
const response = await fetch(
`${process.env.ATAI_API_URL}/agents/optimizations/opt_01jcb1m3t7v5xq8nr2h6kdzs4w`,
{
method: 'DELETE',
headers: {
'Authorization': `Bearer ${process.env.ATAI_API_KEY}`
}
}
);
if (response.status === 204) {
console.log('Optimization deleted');
} else if (response.status === 409) {
console.error('Optimization is not terminal — cancel it first');
} else {
const body = await response.json();
console.error('Error:', body.errors);
}
{
"errors": [
{
"code": "<error_code>",
"message": "Optimization not found.",
"suggestion": null,
"error_uid": "err-xxxxxxxx"
}
]
}
{
"errors": [
{
"code": "<error_code>",
"message": "Optimization is not in a terminal state (cancel it first).",
"suggestion": null,
"error_uid": "err-xxxxxxxx"
}
]
}
Optimizations
Delete Optimization
Delete a terminal optimization run and its trials
DELETE
/
agents
/
optimizations
/
{optimization_id}
curl -X DELETE "$ATAI_API_URL/agents/optimizations/opt_01jcb1m3t7v5xq8nr2h6kdzs4w" \
-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}/agents/optimizations/opt_01jcb1m3t7v5xq8nr2h6kdzs4w",
headers={"Authorization": f"Bearer {api_key}"},
)
if response.status_code == 204:
print("Optimization deleted")
elif response.status_code == 409:
print("Optimization is not terminal — cancel it first")
else:
print(f"Error: {response.json()['errors']}")
const response = await fetch(
`${process.env.ATAI_API_URL}/agents/optimizations/opt_01jcb1m3t7v5xq8nr2h6kdzs4w`,
{
method: 'DELETE',
headers: {
'Authorization': `Bearer ${process.env.ATAI_API_KEY}`
}
}
);
if (response.status === 204) {
console.log('Optimization deleted');
} else if (response.status === 409) {
console.error('Optimization is not terminal — cancel it first');
} else {
const body = await response.json();
console.error('Error:', body.errors);
}
{
"errors": [
{
"code": "<error_code>",
"message": "Optimization not found.",
"suggestion": null,
"error_uid": "err-xxxxxxxx"
}
]
}
{
"errors": [
{
"code": "<error_code>",
"message": "Optimization is not in a terminal state (cancel it first).",
"suggestion": null,
"error_uid": "err-xxxxxxxx"
}
]
}
Requires version 1.1.12 or later of the Archetype platform.
Overview
This endpoint deletes a terminal optimization and its trials. Only a terminal run; that is, one whose status iscompleted, failed, or cancelled can be deleted. Anything else returns an
HTTP status code 409.
The winner-promoted blueprint, if any, is a separate row and is left in place — deleting the run
that produced it does not remove it from the catalog.
Deleting an optimization run also deletes its completed trials. A blueprint promoted from one
of those trials is a separate row and survives.
pending or running returns 409. Cancel it first using the
Cancel Optimization endpoint.
Request
string
required
Optimization
opt_ ID.Response
Returns204 No Content with an empty body on success. Check the status code rather than
parsing a response.
curl -X DELETE "$ATAI_API_URL/agents/optimizations/opt_01jcb1m3t7v5xq8nr2h6kdzs4w" \
-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}/agents/optimizations/opt_01jcb1m3t7v5xq8nr2h6kdzs4w",
headers={"Authorization": f"Bearer {api_key}"},
)
if response.status_code == 204:
print("Optimization deleted")
elif response.status_code == 409:
print("Optimization is not terminal — cancel it first")
else:
print(f"Error: {response.json()['errors']}")
const response = await fetch(
`${process.env.ATAI_API_URL}/agents/optimizations/opt_01jcb1m3t7v5xq8nr2h6kdzs4w`,
{
method: 'DELETE',
headers: {
'Authorization': `Bearer ${process.env.ATAI_API_KEY}`
}
}
);
if (response.status === 204) {
console.log('Optimization deleted');
} else if (response.status === 409) {
console.error('Optimization is not terminal — cancel it first');
} else {
const body = await response.json();
console.error('Error:', body.errors);
}
{
"errors": [
{
"code": "<error_code>",
"message": "Optimization not found.",
"suggestion": null,
"error_uid": "err-xxxxxxxx"
}
]
}
{
"errors": [
{
"code": "<error_code>",
"message": "Optimization is not in a terminal state (cancel it first).",
"suggestion": null,
"error_uid": "err-xxxxxxxx"
}
]
}
Was this page helpful?