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

# List input items

> List the input items of a stored response

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:** `GET https://api.inworld.ai/v1/responses/{response_id}/input_items`

### 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`).

### Query parameters

- `limit` (integer; default: 20) — Number of items to return, 1 to 100.
- `order` (enum<string>; default: "desc"; options: "asc", "desc") — Sort order.
- `after` (string) — An item id: list the items after it, for pagination.
- `include` (string[]) — Additional fields to include, as in OpenAI's API. Repeatable (`include` or `include[]`).

### Response

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

- `object` (string)
- `data` (object[]) — Input items, as in OpenAI's API.
- `first_id` (string)
- `last_id` (string)
- `has_more` (boolean)

### Response examples

#### 200: default_response

```json
{
  "object": "list",
  "data": [
    {
      "id": "msg_68af2c1d",
      "type": "message",
      "role": "user",
      "status": "completed",
      "content": [
        {
          "type": "input_text",
          "text": "Pick a number between 1 and 10."
        }
      ]
    }
  ],
  "first_id": "msg_68af2c1d",
  "last_id": "msg_68af2c1d",
  "has_more": false
}
```

#### 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 GET 'https://api.inworld.ai/v1/responses/resp_68af2c1e9f5c8190a0b6d1a0c4e5f6a7/input_items?limit=10&order=asc' \
  -H "Authorization: Basic $INWORLD_API_KEY"
```

#### Python

```python
import requests

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

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

print(response.text)
```

#### JavaScript

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

fetch('https://api.inworld.ai/v1/responses/%7Bresponse_id%7D/input_items', 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}"},
)

items = client.responses.input_items.list("resp_68af2c1e9f5c8190a0b6d1a0c4e5f6a7", limit=10)
for item in items.data:
    print(item.type)
```
