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

Retrieve an item

ConversationItem conversations().items().retrieve(ItemRetrieveParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
GET/conversations/{conversation_id}/items/{item_id}

Get a single item from a conversation with the given IDs.

ParametersExpand Collapse
ItemRetrieveParams params
String conversationId
Optional<String> itemId
Optional<List<ResponseIncludable>> include

Additional fields to include in the response. See the include parameter for listing Conversation items above for more information.

ReturnsExpand Collapse
class ConversationItem: A class that can be one of several variants.union

A single item within a conversation. The set of possible types are the same as the output type of a Response object.

class Message:

A message to or from the model.

class ResponseFunctionToolCallItem:

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

class ResponseFunctionToolCallOutputItem:
class ResponseFileSearchToolCall:

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

ImageGenerationCall
class ResponseComputerToolCall:

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

class ResponseComputerToolCallOutputItem:
class ResponseToolSearchCall:
class ResponseToolSearchOutputItem:
AdditionalTools
class ResponseReasoningItem:

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.

ProgramOutput
class ResponseCompactionItem:

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

class ResponseCodeInterpreterToolCall:

A tool call to run code.

LocalShellCall
LocalShellCallOutput
class ResponseFunctionShellToolCall:

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

class ResponseFunctionShellToolCallOutput:

The output of a shell tool call that was emitted.

class ResponseApplyPatchToolCall:

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

class ResponseApplyPatchToolCallOutput:

The output emitted by an apply patch tool call.

McpApprovalRequest
McpApprovalResponse
class ResponseCustomToolCall:

A call to a custom tool created by the model.

class ResponseCustomToolCallOutput:

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

Retrieve an item

package com.openai.example;

import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.conversations.items.ConversationItem;
import com.openai.models.conversations.items.ItemRetrieveParams;

public final class Main {
    private Main() {}

    public static void main(String[] args) {
        OpenAIClient client = OpenAIOkHttpClient.fromEnv();

        ItemRetrieveParams params = ItemRetrieveParams.builder()
            .conversationId("conv_123")
            .itemId("msg_abc")
            .build();
        ConversationItem conversationItem = client.conversations().items().retrieve(params);
    }
}
{
  "type": "message",
  "id": "msg_abc",
  "status": "completed",
  "role": "user",
  "content": [
    {"type": "input_text", "text": "Hello!"}
  ]
}
Returns Examples
{
  "type": "message",
  "id": "msg_abc",
  "status": "completed",
  "role": "user",
  "content": [
    {"type": "input_text", "text": "Hello!"}
  ]
}