curl -X DELETE "$ATAI_API_ENDPOINT/inference/sessions/ses_01jcx4m8t2vq6xn3r7k5hbzw9e" \
-H "Authorization: Bearer $ATAI_API_KEY"
import os
import requests
base_url = os.environ["ATAI_API_ENDPOINT"]
api_key = os.environ["ATAI_API_KEY"]
response = requests.delete(
f"{base_url}/inference/sessions/ses_01jcx4m8t2vq6xn3r7k5hbzw9e",
headers={"Authorization": f"Bearer {api_key}"},
)
if response.status_code == 204:
print("Session deleted")
elif response.status_code == 409:
print("Session is still running: cancel it first")
else:
print(f"Error: {response.json()['errors']}")
const response = await fetch(
`${process.env.ATAI_API_ENDPOINT}/inference/sessions/ses_01jcx4m8t2vq6xn3r7k5hbzw9e`,
{
method: 'DELETE',
headers: {
'Authorization': `Bearer ${process.env.ATAI_API_KEY}`
}
}
);
if (response.status === 204) {
console.log('Session deleted');
} else {
const body = await response.json();
console.error('Error:', body.errors);
}
Sessions
Delete Model Session
Delete one of your ended sessions on a platform-hosted model
DELETE
/
api
/
inference
/
sessions
/
{session_id}
curl -X DELETE "$ATAI_API_ENDPOINT/inference/sessions/ses_01jcx4m8t2vq6xn3r7k5hbzw9e" \
-H "Authorization: Bearer $ATAI_API_KEY"
import os
import requests
base_url = os.environ["ATAI_API_ENDPOINT"]
api_key = os.environ["ATAI_API_KEY"]
response = requests.delete(
f"{base_url}/inference/sessions/ses_01jcx4m8t2vq6xn3r7k5hbzw9e",
headers={"Authorization": f"Bearer {api_key}"},
)
if response.status_code == 204:
print("Session deleted")
elif response.status_code == 409:
print("Session is still running: cancel it first")
else:
print(f"Error: {response.json()['errors']}")
const response = await fetch(
`${process.env.ATAI_API_ENDPOINT}/inference/sessions/ses_01jcx4m8t2vq6xn3r7k5hbzw9e`,
{
method: 'DELETE',
headers: {
'Authorization': `Bearer ${process.env.ATAI_API_KEY}`
}
}
);
if (response.status === 204) {
console.log('Session deleted');
} else {
const body = await response.json();
console.error('Error:', body.errors);
}
Requires version 2.0.1 or later of the Archetype platform.
Overview
This endpoint deletes a session that has ended, along with its event log.Only an ended session can be deleted. While the session is
running, this endpoint returns 409.
Cancel it first.Request
Response
Returns204 No Content with an empty body on success.
curl -X DELETE "$ATAI_API_ENDPOINT/inference/sessions/ses_01jcx4m8t2vq6xn3r7k5hbzw9e" \
-H "Authorization: Bearer $ATAI_API_KEY"
import os
import requests
base_url = os.environ["ATAI_API_ENDPOINT"]
api_key = os.environ["ATAI_API_KEY"]
response = requests.delete(
f"{base_url}/inference/sessions/ses_01jcx4m8t2vq6xn3r7k5hbzw9e",
headers={"Authorization": f"Bearer {api_key}"},
)
if response.status_code == 204:
print("Session deleted")
elif response.status_code == 409:
print("Session is still running: cancel it first")
else:
print(f"Error: {response.json()['errors']}")
const response = await fetch(
`${process.env.ATAI_API_ENDPOINT}/inference/sessions/ses_01jcx4m8t2vq6xn3r7k5hbzw9e`,
{
method: 'DELETE',
headers: {
'Authorization': `Bearer ${process.env.ATAI_API_KEY}`
}
}
);
if (response.status === 204) {
console.log('Session deleted');
} else {
const body = await response.json();
console.error('Error:', body.errors);
}
Important Notes
- Deleting a session is permanent.
404means the session doesn’t exist or isn’t visible to you.409means the session is still running.
Was this page helpful?