> ## 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 Deployment

> Delete a stopped or failed deployment that has no sessions left

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 deployment that is `stopped` or `failed` and has no sessions left.

To delete a deployment that is still `ready`, [stop it](https://docs.archetypeai.app/api-reference/agents/deployments/stop-deployment.md)
first. Then delete each of its sessions with [Delete
Session](https://docs.archetypeai.app/api-reference/agents/sessions/delete-session.md); list them with [List
Sessions](https://docs.archetypeai.app/api-reference/agents/sessions/list-sessions.md) and `deployment_id`.

With its deployments gone, a package can be deleted, and then its project.

## Request

**deployment\_id** `string` *required*

Deployment `dpl_` id.

## Response

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

```bash cURL theme={"system"}
curl -X DELETE "$ATAI_API_ENDPOINT/agents/deployments/dpl_01jcf3n8q5vx2mt7r4k6hbzd9a" \
  -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}/agents/deployments/dpl_01jcf3n8q5vx2mt7r4k6hbzd9a",
    headers={"Authorization": f"Bearer {api_key}"},
)

if response.status_code == 204:
    print("Deployment deleted")
else:
    print(f"Error: {response.json()['errors']}")
```

```javascript JavaScript theme={"system"}
const response = await fetch(
  `${process.env.ATAI_API_ENDPOINT}/agents/deployments/dpl_01jcf3n8q5vx2mt7r4k6hbzd9a`,
  {
    method: 'DELETE',
    headers: {
      'Authorization': `Bearer ${process.env.ATAI_API_KEY}`
    }
  }
);

if (response.status === 204) {
  console.log('Deployment deleted');
} else {
  const body = await response.json();
  console.error('Error:', body.errors);
}
```

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

## Important Notes

> [!NOTE]
>
> * A `409` means the deployment is not `stopped` or `failed`, or still has sessions.
> * A `403` means you can see the deployment's project but cannot modify it.
> * A `404` means the deployment does not exist, belongs to another organization, or is in a project you cannot see.
> * Success returns `204` with no body. Check the status code rather than parsing a response.


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