# Delete a hosted version

Source: https://docs.vlayers.ai/reference/hosting/delete-hosted-version

`DELETE /v1/agents/{id}/versions/{version}` · scope `workspace:write`

Deletes a version that carries an image. The version live calls run cannot be deleted: publish another first. When the last version that names an image is deleted, the image is removed from the registry and from the servers that cached it; the record that it existed stays.

Requires an API key with the `workspace:write` scope.

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `id` | path | string | yes | The agent id. Example: `"0192f5c2-6f7a-7b9c-8d1e-2f3a4b5c6d78"` |
| `version` | path | string | yes | The version number, as the agent numbers its versions (1, 2, 3, …). Example: `"3"` |

## Request

cURL:

```bash
curl -X DELETE "https://api.vlayers.ai/v1/agents/$AGENT_ID/versions/$VERSION" \
  -H "Authorization: Bearer $VOICELAYER_API_KEY"
```

TypeScript:

```ts
import { VoiceLayer } from '@voicelayer/api';

const voicelayer = new VoiceLayer();

const { imageDeleted } = await voicelayer.hosting.deleteHostedVersion('<agent-id>', '<version>');
console.log(imageDeleted);
```

Python:

```python
from voicelayer import VoiceLayer

vl = VoiceLayer()

result = vl.hosting.delete_hosted_version("<agent-id>", "<version>")
print(result.image_deleted)
```

## Response `200`

```json
{
  "deleted": true,
  "version": 2,
  "digest": "sha256:0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
  "imageDeleted": true
}
```
