Lompati ke konten utama

Browser ini sudah tidak didukung.

Tingkatkan ke Microsoft Edge untuk memanfaatkan fitur, pembaruan keamanan, dan dukungan teknis terkini.

Unduh Microsoft Edge Informasi selengkapnya tentang Internet Explorer dan 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.

Parameter jalur

conversation_id string diperlukan

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

Parameter kueri

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.

Salah satu dari yang berikut:
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

Parameter header

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.

Respons

The request has succeeded.

Isi

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

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 diperlukan

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

Client error

Isi

Content-Type: application/json
error OpenAI.Error diperlukan
code string | null diperlukan
message string diperlukan
param string | null
type string
misalignment OpenAI.MisalignmentErrorDetailsResource
review_target string | null
error_type string | enum
Salah satu dari yang berikut:
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 diperlukan

The public continuation instruction.

details OpenAI.Error[]
additionalInfo object
debugInfo object

Server error

Isi

Content-Type: application/json
error OpenAI.Error diperlukan
code string | null diperlukan
message string diperlukan
param string | null
type string
misalignment OpenAI.MisalignmentErrorDetailsResource
review_target string | null
error_type string | enum
Salah satu dari yang berikut:
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 diperlukan

The public continuation instruction.

details OpenAI.Error[]
additionalInfo object
debugInfo object

Minta

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)

Tanggapan

{
  "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
}
id-id
Pilihan Privasi Anda
  • Pengelakan AI
  • Versi Sebelumnya
  • Blog
  • Berikan kontribusi
  • Privasi
  • Privasi Kesehatan Konsumen
  • Persyaratan Penggunaan
  • Merek Dagang
  • © Microsoft 2026