# Delete an agent version

`DELETE /agents/{agent_name}/versions/{agent_version}`

Deletes a specific version of an agent. For hosted agents, if the version has active
sessions, the request is rejected with HTTP 409 unless `force` is set to true. When
force is true, all sessions associated with this version are cascade-deleted.

## Parameters

### Path parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `agent_name` | `string` | Yes | The name of the agent to delete. |
| `agent_version` | `string` | Yes | The version of the agent to delete |

### Query parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `force` | `boolean` | No | For Hosted Agents, if `true`, force-deletes the version even if it has active sessions, cascading deletion to all associated sessions. The service defaults to `false` if a value is not specified by the caller. This value is not relevant for other Agent types. _Default:_ `false` |
| `api-version` | `string` | Yes | The API version to use for this operation. |

## Responses

### 200 — The request has succeeded.

Content-Type: `application/json`

A deleted agent version Object

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `object` | `enum` | Yes | The object type. Always 'agent.version.deleted'. _Constant:_ `agent.version.deleted` |
| `name` | `string` | Yes | The name of the agent. |
| `version` | `string` | Yes | The version identifier of the agent. |
| `deleted` | `boolean` | Yes | Whether the agent was successfully deleted. |

### 4XX — Client error

Content-Type: `application/json`

Error response for API failures.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `error` | `OpenAI.Error` | Yes |  |

#### `error` — `OpenAI.Error`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `code` | `string \| null` | Yes |  |
| `message` | `string` | Yes |  |
| `param` | `string \| null` | No |  |
| `type` | `string` | No |  |
| `details` | `OpenAI.Error[]` | No |  |
| `additionalInfo` | `object` | No |  |
| `debugInfo` | `object` | No |  |

### 5XX — Server error

Content-Type: `application/json`

Error response for API failures.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `error` | `OpenAI.Error` | Yes |  |

#### `error` — `OpenAI.Error`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `code` | `string \| null` | Yes |  |
| `message` | `string` | Yes |  |
| `param` | `string \| null` | No |  |
| `type` | `string` | No |  |
| `details` | `OpenAI.Error[]` | No |  |
| `additionalInfo` | `object` | No |  |
| `debugInfo` | `object` | No |  |
