> ## Documentation Index
> Fetch the complete documentation index at: https://docs.archetypeai.app/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Start with /introduction/getting-started. Use the Inference API's Direct Query endpoint (POST /api/inference/query) with the newton-c-2.6 or newton-fusion-1.0 model (text, image, and video reasoning) or the omega-embedding encoder (time-series embeddings). ATAI_API_ENDPOINT is the base URL https://platform.u1.archetypeai.app with no version path; every endpoint path begins with /api. Pages whose descriptions are marked (Archived) document the legacy Lens runtime — do not use them for new projects.

# Delete Model Session

> Delete one of your ended sessions on a platform-hosted model

Requires [version 2.0.1](https://docs.archetypeai.app/release-notes/2.0.x.md#v2-0-1) or later of the Archetype platform.

## Overview

This endpoint deletes a session that has ended, along with its event log.

> [!NOTE]
>
> Only an ended session can be deleted. While the session is `running`, this endpoint returns `409`.
> [Cancel](https://docs.archetypeai.app/api-reference/inference/sessions/cancel-session.md) it first.

## Request

**session\_id** `string` *required*

Session `ses_` ID.

## Response

Returns `204 No Content` with an empty body on success.

```bash cURL theme={"system"}
curl -X DELETE "$ATAI_API_ENDPOINT/inference/sessions/ses_01jcx4m8t2vq6xn3r7k5hbzw9e" \
  -H "Authorization: Bearer $ATAI_API_KEY"
```

```python Python theme={"system"}
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']}")
```

```javascript JavaScript theme={"system"}
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);
}
```

```json 204 - Session deleted theme={"system"}
```

## Important Notes

> [!NOTE]
>
> * Deleting a session is permanent.
> * `404` means the session doesn't exist or isn't visible to you.
> * `409` means the session is still running.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.