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

client.Conversations.Items.Get(ctx, conversationID, itemID, query) (*ConversationItemUnion, error)
GET/conversations/{conversation_id}/items/{item_id}

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

ParametersExpand Collapse
conversationID string
itemID string
query ItemGetParams
ReturnsExpand Collapse
type ConversationItemUnion interface{…}

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

One of the following:
type Message struct{…}

A message to or from the model.

type ResponseFunctionToolCallItem struct{…}

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

type ResponseFunctionToolCallOutputItem struct{…}
type ResponseFileSearchToolCall struct{…}

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

type ConversationItemImageGenerationCall struct{…}

An image generation request made by the model.

type ResponseComputerToolCall struct{…}

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

type ResponseComputerToolCallOutputItem struct{…}
type ResponseToolSearchCall struct{…}
type ResponseToolSearchOutputItem struct{…}
type ConversationItemAdditionalTools struct{…}
type ResponseReasoningItem struct{…}

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.

type ConversationItemProgram struct{…}
type ConversationItemProgramOutput struct{…}
type ResponseCompactionItem struct{…}

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

type ResponseCodeInterpreterToolCall struct{…}

A tool call to run code.

type ConversationItemLocalShellCall struct{…}

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

type ConversationItemLocalShellCallOutput struct{…}

The output of a local shell tool call.

type ResponseFunctionShellToolCall struct{…}

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

type ResponseFunctionShellToolCallOutput struct{…}

The output of a shell tool call that was emitted.

type ResponseApplyPatchToolCall struct{…}

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

type ResponseApplyPatchToolCallOutput struct{…}

The output emitted by an apply patch tool call.

type ConversationItemMcpListTools struct{…}

A list of tools available on an MCP server.

type ConversationItemMcpApprovalRequest struct{…}

A request for human approval of a tool invocation.

type ConversationItemMcpApprovalResponse struct{…}

A response to an MCP approval request.

type ConversationItemMcpCall struct{…}

An invocation of a tool on an MCP server.

type ResponseCustomToolCall struct{…}

A call to a custom tool created by the model.

type ResponseCustomToolCallOutput struct{…}

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

Retrieve an item

package main

import (
  "context"
  "fmt"

  "github.com/openai/openai-go"
  "github.com/openai/openai-go/conversations"
  "github.com/openai/openai-go/option"
)

func main() {
  client := openai.NewClient(
    option.WithAPIKey("My API Key"),
  )
  conversationItem, err := client.Conversations.Items.Get(
    context.TODO(),
    "conv_123",
    "msg_abc",
    conversations.ItemGetParams{

    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", conversationItem)
}
{
  "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!"}
  ]
}