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

# Delete response

> Delete a response stored by an OpenAI model

Use this endpoint for responses stored by OpenAI models with `store: true` or `background: true`. The request must come from the workspace that created the response. See [stored responses](https://docs.inworld.ai/router/responses.md#stored-responses-and-continuation).

## API reference

**Endpoint:** `DELETE https://api.inworld.ai/v1/responses/{response_id}`

### Authorization

- `Authorization` (string; required) — Your [authentication](../../../api-reference/introduction) credentials. For Basic authentication, please populate `Basic $INWORLD_API_KEY`.
  
  Please make sure your API Key has [write permissions for the Router API](https://docs.inworld.ai/api-reference/introduction.md#getting-an-api-key) in order to create, update, and delete routers. You can create a key in one command with the [Inworld CLI](../../../developer-tools/inworld-cli): `inworld workspace add-key`.

### Path parameters

- `response_id` (string; required) — The id of a response stored by an OpenAI model (`store: true` or `background: true`).

### Response

Status: `200`. Content type: `application/json`.

- `id` (string)
- `object` (string)
- `deleted` (boolean)

### Response examples

#### 200: default_response

```json
{
  "id": "resp_68af2c1e9f5c8190a0b6d1a0c4e5f6a7",
  "object": "response",
  "deleted": true
}
```

#### 400: default_response

```json
{
  "error": {
    "message": "'model' field is required",
    "type": "invalid_request_error",
    "code": "string",
    "param": "string"
  }
}
```

#### 401: default_response

```json
{
  "error": {
    "message": "'model' field is required",
    "type": "invalid_request_error",
    "code": "string",
    "param": "string"
  }
}
```

#### 404: default_response

```json
{
  "error": {
    "message": "'model' field is required",
    "type": "invalid_request_error",
    "code": "string",
    "param": "string"
  }
}
```

#### 503: default_response

```json
{
  "error": {
    "message": "'model' field is required",
    "type": "invalid_request_error",
    "code": "string",
    "param": "string"
  }
}
```

### Code examples

#### cURL

```bash
curl -X DELETE 'https://api.inworld.ai/v1/responses/resp_68af2c1e9f5c8190a0b6d1a0c4e5f6a7' \
  -H "Authorization: Basic $INWORLD_API_KEY"
```

#### Python

```python
import requests

url = "https://api.inworld.ai/v1/responses/%7Bresponse_id%7D"
headers = {
  "Authorization": "<api_key>"
}

response = requests.request("DELETE", url, headers=headers)

print(response.text)
```

#### JavaScript

```javascript
const options = {method: 'DELETE', headers: {"Authorization":"<api_key>"}};

fetch('https://api.inworld.ai/v1/responses/%7Bresponse_id%7D', options)
  .then(response => response.json())
  .then(response => console.log(response))
  .catch(err => console.error(err));
```

#### Python (OpenAI SDK)

```python
import os
from openai import OpenAI

api_key = os.environ["INWORLD_API_KEY"]
client = OpenAI(
    base_url="https://api.inworld.ai/v1",
    api_key=api_key,
    default_headers={"Authorization": f"Basic {api_key}"},
)

client.responses.delete("resp_68af2c1e9f5c8190a0b6d1a0c4e5f6a7")
```
