Skip to main content

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Download Microsoft Edge More info about Internet Explorer and Microsoft Edge
microsoft-foundry.rest.security.o-auth2-auth

Conversations

List conversation items

GET /openai/v1/conversations/{conversation_id}/items

Returns the items belonging to the specified conversation.

Path parameters

conversation_id string required

The id of the conversation on which the items needs to be listed.

Query parameters

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 enum

Sort order by the created_at timestamp of the objects. asc for ascending order anddesc for descending order.

ascdesc
after string

A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.

before string

A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.

item_type string | enum

Filter by item type. If provided, only items of the specified type will be returned.

Any of the following:
string
enum
messageoutput_messagefile_search_callcomputer_callcomputer_call_outputweb_search_callfunction_callfunction_call_outputtool_search_calltool_search_outputadditional_toolsconfiguration_updatereasoningcompactionimage_generation_callcode_interpreter_calllocal_shell_calllocal_shell_call_outputshell_callshell_call_outputapply_patch_callapply_patch_call_outputmcp_list_toolsmcp_approval_requestmcp_approval_responsemcp_callcustom_tool_call_outputcustom_tool_callstructured_outputsoauth_consent_requestmemory_search_callmemory_command_preview_callmemory_command_preview_call_outputworkflow_actiona2a_preview_calla2a_preview_call_outputbing_grounding_callbing_grounding_call_outputsharepoint_grounding_preview_callsharepoint_grounding_preview_call_outputazure_ai_search_callazure_ai_search_call_outputbing_custom_search_preview_callbing_custom_search_preview_call_outputopenapi_callopenapi_call_outputbrowser_automation_preview_callbrowser_automation_preview_call_outputfabric_dataagent_preview_callfabric_dataagent_preview_call_outputazure_function_callazure_function_call_output

Header parameters

x-ms-user-identity string

Opaque per-user identity string used to scope endpoint-scoped data to a specific end user. The caller must have the agents/endpoints/UserIdentityImpersonation/action RBAC permission.

Responses

The request has succeeded.

Body

Content-Type: application/json
data OpenAI.OutputItem[] required

The requested list of items.

first_id string

The first ID represented in this list.

last_id string

The last ID represented in this list.

has_more boolean required

A value indicating whether there are additional values available not captured in this list.

Client error

Body

Content-Type: application/json
error OpenAI.Error required
code string | null required
message string required
param string | null
type string
misalignment OpenAI.MisalignmentErrorDetailsResource
review_target string | null
error_type string | enum
Any of the following:
string
enum
potentially_unintended_data_transferpotentially_unintended_data_accesspotentially_unintended_destructive_activityother
detailed_explanation string

The public explanation for this block.

steer OpenAI._MisalignmentSteer
message string required

The public continuation instruction.

details OpenAI.Error[]
additionalInfo object
debugInfo object

Server error

Body

Content-Type: application/json
error OpenAI.Error required
code string | null required
message string required
param string | null
type string
misalignment OpenAI.MisalignmentErrorDetailsResource
review_target string | null
error_type string | enum
Any of the following:
string
enum
potentially_unintended_data_transferpotentially_unintended_data_accesspotentially_unintended_destructive_activityother
detailed_explanation string

The public explanation for this block.

steer OpenAI._MisalignmentSteer
message string required

The public continuation instruction.

details OpenAI.Error[]
additionalInfo object
debugInfo object

Request

curl "https://api.openai.com/v1/conversations/conv_123/items?limit=10" \
  -H "Authorization: Bearer $OPENAI_API_KEY"
import OpenAI from "openai";
const client = new OpenAI();

const items = await client.conversations.items.list("conv_123", { limit: 10 });
console.log(items.data);
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ.get("OPENAI_API_KEY"),  # This is the default and can be omitted
)
page = client.conversations.items.list(
    conversation_id="conv_123",
)
page = page.data[0]
print(page)
using System;
using OpenAI.Conversations;

OpenAIConversationClient client = new(
    apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY")
);

ConversationItemList items = client.ConversationItems.List(
    conversationId: "conv_123",
    new ListConversationItemsOptions { Limit = 10 }
);
Console.WriteLine(items.Data.Count);
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

// Automatically fetches more pages as needed.
for await (const conversationItem of client.conversations.items.list('conv_123')) {
  console.log(conversationItem);
}
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"),
    )
    page, err := client.Conversations.Items.List(
        context.TODO(),
        "conv_123",
        conversations.ItemListParams{},
    )
    if err != nil {
        panic(err.Error())
    }
    fmt.Printf("%+v
", page)
}
package com.openai.example;

import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.conversations.items.ItemListPage;
import com.openai.models.conversations.items.ItemListParams;

public final class Main {
    private Main() {}

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

        ItemListPage page = client.conversations().items().list("conv_123");
    }
}
require "openai"

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

page = openai.conversations.items.list("conv_123")

puts(page)

Response

{
  "object": "list",
  "data": [
    {
      "type": "message",
      "id": "msg_abc",
      "status": "completed",
      "role": "user",
      "content": [
        {"type": "input_text", "text": "Hello!"}
      ]
    }
  ],
  "first_id": "msg_abc",
  "last_id": "msg_abc",
  "has_more": false
}
en-us
Your Privacy Choices
  • AI Disclaimer
  • Previous Versions
  • Blog
  • Contribute
  • Privacy
  • Consumer Health Privacy
  • Terms of Use
  • Trademarks
  • © Microsoft 2026