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

> ## Agent Instructions
> Orq.ai is the control plane for model and MCP traffic: one key reaches the workspace's enabled models, MCP servers, and resources. The setup depends on where the agent runs.
> Hosted assistant (ChatGPT, claude.ai, a hosted sandbox): install nothing. Tell the human to add https://my.orq.ai/v2/mcp as a remote MCP connector and finish the Orq.ai sign-in. With OAuth, send no Authorization header; otherwise send an API key as a bearer token.
> Local coding agent (Claude Code, Codex, Cursor, OpenCode): run `curl -fsSL https://cli.orq.ai/install.sh | sh`. It installs the CLI and runs `orq setup`, which signs in, writes a project-scoped key to `~/.orq/env`, and wires the detected agents through the AI Gateway. It can also add the Orq MCP server and Orq Skills, the workflows for agents, evaluations, and traces: https://docs.orq.ai/ai-studio/integrations/code-assistants/orq-skills.md. Verify with `orq status`.
> Headless or CI: read `ORQ_API_KEY` from the environment; a human creates the key at https://docs.orq.ai/ai-studio/organization/api-keys.md.
> Send model traffic to https://my.orq.ai/v3/router with `Authorization: Bearer $ORQ_API_KEY`; the Anthropic SDK uses https://my.orq.ai/v3/anthropic. New integrations go on `/v3/router`: `/v2/router` stays published for backward compatibility, and `orq.prompt` works only on `/v2/router/chat/completions`.
> Enable a model for the workspace and use its exact `provider/model` id. `POST /v2/workspace-models` enables a model, and a call fails while the workspace has neither credits nor a provider key.
> On `/chat/completions`, a reasoning model rejects `tools` with a `reasoning_effort` other than `none`; `/responses` keeps reasoning.
> On a failure, branch on `error.code` and follow `error.doc_url`; a budget rejection answers 429.

# List response input items

> Lists the input items stored for a response, paginated with `after`, `limit` and `order`. Returns the input stored for this response: the full chain for `previous_response_id`, only the new turn for `conversation`, and the compaction item for compacted history. Background responses without stored input return an empty list.

> [!NOTE]
>
> **Related guide**: Responses API guide. See the [Responses API guide](https://docs.orq.ai/ai-gateway/features/responses-api.md) for a walkthrough with examples.

Lists the input items stored for a response. The response must have been created with `store: true` (the default); responses created with `store: false` return `404`, as do responses that were deleted or are out of the API key's project scope.

```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl "https://my.orq.ai/v3/router/responses/resp_01KP6GDNJY5B0TT0R35KS23PYV/input_items?limit=20&order=desc" \
  -H "Authorization: Bearer $ORQ_API_KEY"
```

```typescript TypeScript theme={"theme":{"light":"github-light","dark":"github-dark"}}
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.ORQ_API_KEY,
  baseURL: "https://my.orq.ai/v3/router",
});

for await (const item of client.responses.inputItems.list(
  "resp_01KP6GDNJY5B0TT0R35KS23PYV",
)) {
  console.log(item.id, item.type);
}
```

```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
from openai import OpenAI
import os

client = OpenAI(
    api_key=os.environ.get("ORQ_API_KEY"),
    base_url="https://my.orq.ai/v3/router",
)

for item in client.responses.input_items.list("resp_01KP6GDNJY5B0TT0R35KS23PYV"):
    print(item.id, item.type)
```

```json Response theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "object": "list",
  "data": [
    {
      "type": "message",
      "id": "msg_01KP6GDNK0TXBVMD3N5BWZ285J",
      "role": "user",
      "content": [
        { "type": "input_text", "text": "What time is it?" }
      ]
    }
  ],
  "first_id": "msg_01KP6GDNK0TXBVMD3N5BWZ285J",
  "last_id": "msg_01KP6GDNK0TXBVMD3N5BWZ285J",
  "has_more": false
}
```

## What is listed

The list contains the input stored for the response, which depends on how the response was created:

* **`previous_response_id`**: the full chain, including the items carried over from earlier responses.
* **`conversation`**: only the new turn sent with this response. Earlier turns are listed by `GET /v3/conversations/{id}/messages`, which requires the conversation list permission.
* **Compacted history**: the dropped history appears as one compaction item.

Items of an earlier background response that was deleted no longer appear in the lists of later responses.

Background responses that have not completed have no stored input yet, so the list is empty. Check `status` with [Retrieve Response](https://docs.orq.ai/reference/responses/retrieve-response.md).

A user message that uses `{{var}}` variables is listed as the template, not the rendered text. Redacted PII is restored in the listed text and file names; uploaded file contents keep their redaction placeholders. Media URLs expire after one hour.

## Pagination

The response is `{ "object": "list", "data", "first_id", "last_id", "has_more" }`. `first_id` and `last_id` are `null` on an empty page.

| Parameter | Description |
| - | - |
| `after` | Item ID to continue after. An unknown ID returns `400`. |
| `limit` | Number of items, 1 to 100. Defaults to `20`. |
| `order` | `asc` or `desc`. Defaults to `desc`. |

The OpenAI SDKs paginate automatically when iterating the result.

Item IDs are the IDs of the stored items. A function call inside a stored assistant message is listed as `fc_<message_id>_<n>`. Tool items run by the provider, such as web search, are listed under their stored ID, not the provider ID that the response output shows.

## include

Pass `include` to select extra fields. Repeat the parameter, use `include[]`, or separate values with commas. Unknown values return `400`.

Each of these fields is omitted unless its value is listed:

* `code_interpreter_call.outputs`
* `computer_call_output.output.image_url`
* `file_search_call.results`
* `message.input_image.image_url`
* `message.output_text.logprobs`
* `reasoning.encrypted_content`
* `web_search_call.action.sources`
* `web_search_call.results`

## Media

Stored files are returned as presigned URLs valid for one hour. Image URLs on input messages are returned only with `include=message.input_image.image_url`. A file or image the API key cannot access, or that cannot be signed, is returned without a URL. Download media promptly, or list the items again for fresh URLs. `file_id` values are not stored and are not returned.


## OpenAPI

````yaml get /v3/router/responses/{response_id}/input_items
openapi: 3.1.0
info:
  title: orq.ai API
  version: '2.0'
  description: orq.ai API documentation
servers:
  - url: https://my.orq.ai
security:
  - ApiKey: []
tags:
  - name: Chunking
    description: Split text into smaller chunks for retrieval and generation workflows.
  - name: File Systems
    description: >-
      Create and manage persistent file systems that agents and MCP clients read
      from and write to.
  - name: Knowledge Bases
    description: Create and manage knowledge bases used by agents and retrieval workflows.
  - name: Memory Stores
    description: Create and manage memory stores, memories, and memory documents.
  - name: Evals
    description: Run an evaluator against a conversation and its result
  - description: >-
      API keys authenticate programmatic access to the workspace. They expose
      opaque tokens, per-domain access grants, and budget and rate-limit
      constraints.
    name: API keys
  - name: Logs
    description: >-
      OpenTelemetry log query API. Search, filter, aggregate, and facet log
      records ingested via OTLP.
  - name: Reporting
    description: >-
      GenAI reporting API over canonical analytics rollups. Accepts a metric
      name, time range, grain, group-by, and filters; returns a typed time
      series and optional totals.
  - name: Telemetry
    description: >-
      Unified query envelope for traces, metrics, and logs. One request shape,
      one filter dialect, and one response shape per source, validated by a
      per-source registry.
  - name: Telemetry Destinations
    description: >-
      OpenTelemetry destinations that receive a copy of the workspace's traces
      over OTLP/HTTP.
  - name: Traces
    description: >-
      Query and inspect ingested trace data: search trace summaries, aggregate
      metrics, and read individual traces and their spans.
  - name: Views
    description: Saved filters and columns for workspace observability pages.
  - name: Datasets
    description: >-
      Datasets store test cases and expected outputs used for evaluation and
      optimization workflows.
  - name: Experiments
    description: >-
      Create and run experiments: dataset rows against task columns, evaluators,
      and annotations.
  - description: List models available through the AI Router.
    name: Models
  - name: Agents
    description: External A2A agents registered for invocation through the ORQ AI Gateway.
  - name: Alerts
    description: >-
      Alerts evaluate a telemetry metric on a fixed interval and fire
      notifications through notifiers when the value breaches a threshold. Each
      breach opens a trigger that tracks the incident until the value recovers.
  - name: Annotation Queues
    description: Annotation queues collect spans for human review.
  - name: Audit Log Destinations
    description: >-
      Signed webhook destinations that receive workspace audit log events, for
      SIEM and compliance pipelines.
  - name: Budgets
    description: >-
      Budgets govern spend, token usage, and request rate across workspace,
      project, identity, API key, provider, model, factory, and category-default
      scopes. Category defaults provide a separate allowance for each entity; an
      active individual budget replaces its category default. Every applicable
      budget is enforced, and the most restrictive limit applies per dimension.
  - name: Environments
    description: Reusable workspace- and project-scoped deployment environments.
  - name: Files
    description: File upload and retrieval operations.
  - name: Guardrail Rules
    description: >-
      Guardrail Rules conditionally enforce evaluators and plugins for AI
      Gateway traffic. Rules may be scoped to a project or the whole workspace.
  - name: Hub
    description: Hub items are reusable templates available to a workspace.
  - name: Identities
    description: >-
      Identities represent end users from your system for usage and engagement
      tracking.
  - name: Management keys
    description: >-
      Management keys are workspace-scoped credentials that authenticate
      programmatic access to workspace administration surfaces (API keys,
      budgets). Unlike project-scoped API keys, a management key always operates
      at the workspace level.
  - name: MCP Gateway
    description: >-
      Register upstream MCP servers, discover and sync their tools, and assemble
      gateways that expose a curated tool surface to MCP clients.
  - name: Model Catalog
    description: >-
      Browse the orq.ai model catalog: every model orq offers, across every
      provider, with pricing, capabilities and benchmark data. List endpoints
      only return models that are not deprecated. This API is public, requires
      no authentication, and is rate limited to 120 requests per minute per IP.
      Responses carry a 5-minute cache-control max-age.
  - name: Model Fusions
    description: >-
      Model Fusions combine independent model answers through a panel, judge,
      and optional synthesizer.
  - name: Monitors
    description: >-
      Monitors are custom observability dashboards for traces, runtime metrics,
      and logs. Each monitor holds widgets that chart one telemetry query. List
      the metrics, operations, and dimensions available to your workspace with
      `GET /v3/telemetry/capabilities`, or start from a preset with `GET
      /v2/monitors/presets`.
  - name: Notifiers
    description: Notifier destinations used to send delivery and workflow notifications.
  - name: Projects
    description: Projects organize resources within a workspace
  - name: Routing Rules
    description: >-
      Routing Rules conditionally select models and enforce request plugins for
      AI Gateway traffic. Rules are evaluated by ascending priority and may be
      scoped to a project or the whole workspace.
  - name: Threads
    description: Threads group related trace invocations and their aggregate usage
  - name: Skills
    description: >-
      Skills are modular instructions you can use to codify processes and
      conventions
  - name: Smart Routers
    description: >-
      Create and manage workspace Smart Routers. A Smart Router selects a model
      from an eligible pool for each request according to a quality, balanced,
      or cost profile.
  - name: Users
    description: >-
      Workspace user administration. Requires a Management Key with user
      permissions or an authenticated workspace admin session. Standard API keys
      are not supported.
  - name: Webhooks
    description: >-
      Create and manage webhooks that deliver workspace events to external HTTPS
      endpoints.
  - name: Workspaces
    description: >-
      A workspace is the tenant. Create is called from a user session during
      onboarding; Get, List, and Update are the public management surface.
  - name: Workspace Security
    description: >-
      Workspace-level domain verification and IP allowlist controls. These
      operations are restricted to workspace administrators.
  - name: Workspace Settings
    description: >-
      Workspace-level settings managed with a workspace credential. A workspace
      is the tenant, so these settings are a singleton — there is nothing to
      create or delete, only read and update.
  - description: Search Gateway with managed credits or BYOK.
    name: Web Search
  - name: Live Sessions
  - name: Responses
  - description: Run agents on a cron cadence. Minimum firing interval is 1 hour.
    name: Agent Schedules
  - name: Embeddings
  - description: Beta. Run typed classification questions against a classify model.
    name: Classify
  - description: Beta. Run classification decisions with the classify contract.
    name: Decisions
  - description: >-
      Run large offline workloads as JSONL batches and download
      OpenAI-compatible result files.
    name: Batches
externalDocs:
  url: https://docs.orq.ai
  description: orq.ai Documentation
paths:
  /v3/router/responses/{response_id}/input_items:
    get:
      tags:
        - Responses
      summary: List response input items
      description: >-
        Lists the input items stored for a response, paginated with `after`,
        `limit` and `order`. Returns the input stored for this response: the
        full chain for `previous_response_id`, only the new turn for
        `conversation`, and the compaction item for compacted history.
        Background responses without stored input return an empty list.
      operationId: list-response-input-items
      parameters:
        - description: The ID of the response to retrieve
          in: path
          name: response_id
          required: true
          schema:
            description: The ID of the response to retrieve
            type: string
        - description: 'Cursor: return items after this item id.'
          explode: false
          in: query
          name: after
          schema:
            description: 'Cursor: return items after this item id.'
            type: string
        - description: Maximum number of items to return, 1 to 100.
          explode: false
          in: query
          name: limit
          schema:
            default: 20
            description: Maximum number of items to return, 1 to 100.
            format: int64
            maximum: 100
            minimum: 1
            type: integer
        - description: Sort order by item position. Defaults to desc.
          explode: false
          in: query
          name: order
          schema:
            default: desc
            description: Sort order by item position. Defaults to desc.
            enum:
              - asc
              - desc
            type: string
        - description: >-
            Additional fields to include. Each listed field is omitted unless
            requested. Accepts the OpenAI includables:
            code_interpreter_call.outputs,
            computer_call_output.output.image_url, file_search_call.results,
            message.input_image.image_url, message.output_text.logprobs,
            reasoning.encrypted_content, web_search_call.action.sources and
            web_search_call.results.
          explode: false
          in: query
          name: include
          schema:
            description: >-
              Additional fields to include. Each listed field is omitted unless
              requested. Accepts the OpenAI includables:
              code_interpreter_call.outputs,
              computer_call_output.output.image_url, file_search_call.results,
              message.input_image.image_url, message.output_text.logprobs,
              reasoning.encrypted_content, web_search_call.action.sources and
              web_search_call.results.
            items:
              enum:
                - code_interpreter_call.outputs
                - computer_call_output.output.image_url
                - file_search_call.results
                - message.input_image.image_url
                - message.output_text.logprobs
                - reasoning.encrypted_content
                - web_search_call.action.sources
                - web_search_call.results
              type: string
            type:
              - array
              - 'null'
      responses:
        '200':
          content:
            application/json:
              schema:
                additionalProperties: false
                properties:
                  data:
                    description: Input items on the current page.
                    items: {}
                    type: array
                  first_id:
                    description: >-
                      ID of the first item on the page. Null when the page is
                      empty.
                    type:
                      - string
                      - 'null'
                  has_more:
                    type: boolean
                    description: Whether further items exist beyond this page.
                  last_id:
                    description: >-
                      ID of the last item on the page. Null when the page is
                      empty.
                    type:
                      - string
                      - 'null'
                  object:
                    description: Object type, always list.
                    type: string
                required:
                  - object
                  - data
                  - first_id
                  - last_id
                  - has_more
                type: object
          description: Input items retrieved successfully.
        '400':
          content:
            application/json:
              schema:
                type: object
                additionalProperties: false
                properties:
                  error:
                    $ref: '#/components/schemas/APIError'
                required:
                  - error
          description: Invalid limit, order, after or include value.
        '401':
          content:
            application/json:
              schema:
                type: object
                additionalProperties: false
                properties:
                  error:
                    $ref: '#/components/schemas/APIError'
                required:
                  - error
          description: Missing, invalid, expired or revoked API key.
        '403':
          content:
            application/json:
              schema:
                type: object
                additionalProperties: false
                properties:
                  error:
                    $ref: '#/components/schemas/APIError'
                required:
                  - error
          description: The API key lacks permission to view responses.
        '404':
          content:
            application/json:
              schema:
                type: object
                additionalProperties: false
                properties:
                  error:
                    $ref: '#/components/schemas/APIError'
                required:
                  - error
          description: Response not found.
      x-code-samples:
        - label: Node.js
          lang: typescript
          source: |-
            const items = await orq.responses.listInputItems({
              responseId: "resp_01ARZ3NDEKTSV4RRFFQ69G5FAV",
              limit: 20,
              order: "asc",
            });
        - label: Python
          lang: python
          source: |-
            items = orq.responses.list_input_items(
                response_id="resp_01ARZ3NDEKTSV4RRFFQ69G5FAV",
                limit=20,
                order="asc",
            )
components:
  schemas:
    APIError:
      additionalProperties: false
      properties:
        code:
          type:
            - string
            - 'null'
        failures: {}
        message:
          type: string
        param:
          type:
            - string
            - 'null'
        type:
          type: string
      required:
        - message
        - type
        - param
        - code
      type: object
  securitySchemes:
    ApiKey:
      type: http
      scheme: bearer
      bearerFormat: JWT

````

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