Skip to content
For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to the page URL.
Primary navigation

List input items

beta.responses.input_items.list(response_id, **kwargs) -> CursorPage<BetaResponseItem>
GET/responses/{response_id}/input_items

Returns a list of input items for a given response.

ParametersExpand Collapse
response_id: String
after: String

An item ID to list items after, used in pagination.

include: Array[BetaResponseIncludable]

Additional fields to include in the response. See the include parameter for Response creation above for more information.

limit: Integer

A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.

order: :asc | :desc

The order to return the input items in. Default is desc.

  • asc: Return the input items in ascending order.
  • desc: Return the input items in descending order.
betas: Array[:"responses_multi_agent=v1"]
ReturnsExpand Collapse
BetaResponseItem = BetaResponseInputMessageItem { id, content, role, 3 more } | BetaResponseOutputMessage { id, content, role, 4 more } | BetaResponseFileSearchToolCall { id, queries, status, 3 more } | 29 more

Content item used to generate a response.

One of the following:
class BetaResponseInputMessageItem { id, content, role, 3 more }
class BetaResponseOutputMessage { id, content, role, 4 more }

An output message from the model.

class BetaResponseFileSearchToolCall { id, queries, status, 3 more }

The results of a file search tool call. See the file search guide for more information.

class BetaResponseComputerToolCall { id, call_id, pending_safety_checks, 5 more }

A tool call to a computer use tool. See the computer use guide for more information.

class BetaResponseComputerToolCallOutputItem { id, call_id, output, 5 more }
class BetaResponseFunctionToolCallItem { id, status, created_by }

A tool call to run a function. See the function calling guide for more information.

class BetaResponseFunctionToolCallOutputItem { id, call_id, output, 7 more }
class AgentMessage { id, author, content, 3 more }
class MultiAgentCall { id, action, arguments, 3 more }
class MultiAgentCallOutput { id, action, call_id, 3 more }
class BetaResponseToolSearchCall { id, arguments, call_id, 5 more }
class BetaResponseToolSearchOutputItem { id, call_id, execution, 5 more }
class AdditionalTools { id, role, tools, 2 more }
class BetaResponseReasoningItem { id, summary, type, 4 more }

A description of the chain of thought used by a reasoning model while generating a response. Be sure to include these items in your input to the Responses API for subsequent turns of a conversation if you are manually managing context.

class Program { id, call_id, code, 3 more }
class ProgramOutput { id, call_id, result, 3 more }
class BetaResponseCompactionItem { id, encrypted_content, type, 2 more }

A compaction item generated by the v1/responses/compact API.

class ImageGenerationCall { id, result, status, 2 more }

An image generation request made by the model.

class BetaResponseCodeInterpreterToolCall { id, code, container_id, 4 more }

A tool call to run code.

class LocalShellCall { id, action, call_id, 3 more }

A tool call to run a command on the local shell.

class LocalShellCallOutput { id, output, type, 2 more }

The output of a local shell tool call.

class BetaResponseFunctionShellToolCall { id, action, call_id, 6 more }

A tool call that executes one or more shell commands in a managed environment.

class BetaResponseFunctionShellToolCallOutput { id, call_id, max_output_length, 6 more }

The output of a shell tool call that was emitted.

class BetaResponseApplyPatchToolCall { id, call_id, operation, 5 more }

A tool call that applies file diffs by creating, deleting, or updating files.

class BetaResponseApplyPatchToolCallOutput { id, call_id, status, 5 more }

The output emitted by an apply patch tool call.

class McpListTools { id, server_label, tools, 3 more }

A list of tools available on an MCP server.

class McpApprovalRequest { id, arguments, name, 3 more }

A request for human approval of a tool invocation.

class McpApprovalResponse { id, approval_request_id, approve, 3 more }

A response to an MCP approval request.

class McpCall { id, arguments, name, 7 more }

An invocation of a tool on an MCP server.

class BetaResponseCustomToolCallItem { id, status, created_by }

A call to a custom tool created by the model.

class BetaResponseCustomToolCallOutputItem { id, status, created_by }

The output of a custom tool call from your code, being sent back to the model.

List input items

require "openai"

openai = OpenAI::Client.new(api_key: "My API Key")

page = openai.beta.responses.input_items.list("response_id")

puts(page)
{
  "object": "list",
  "data": [
    {
      "id": "msg_abc123",
      "type": "message",
      "role": "user",
      "content": [
        {
          "type": "input_text",
          "text": "Tell me a three sentence bedtime story about a unicorn."
        }
      ]
    }
  ],
  "first_id": "msg_abc123",
  "last_id": "msg_abc123",
  "has_more": false
}
Returns Examples
{
  "object": "list",
  "data": [
    {
      "id": "msg_abc123",
      "type": "message",
      "role": "user",
      "content": [
        {
          "type": "input_text",
          "text": "Tell me a three sentence bedtime story about a unicorn."
        }
      ]
    }
  ],
  "first_id": "msg_abc123",
  "last_id": "msg_abc123",
  "has_more": false
}