Skip to main content
Conversations

List items

List message items in a conversation.

GET
/conversations/{conversation_id}/items
Python
import os
from openai import OpenAI

client = OpenAI(
  api_key=os.getenv("DASHSCOPE_API_KEY"),
  base_url="https://dashscope-intl.aliyuncs.com/api/v2/apps/protocols/compatible-mode/v1",
)

items = client.conversations.items.list("conv_xxx")
print(items.data)
{
  "data": [
    {
      "content": [
        {
          "text": "Alice, a gentle and resilient woman, was born in Singapore. She is 20 years old, and her hobbies are music and chess.",
          "type": "input_text"
        }
      ],
      "id": "msg_7639f8f6-484b-454a-8125-96a3f40eb9e8",
      "role": "user",
      "status": "completed",
      "type": "message"
    },
    {
      "content": [
        {
          "text": "Alice's best friend is Bob",
          "type": "input_text"
        }
      ],
      "id": "msg_288594f6-6ef1-4519-94d4-a545ca311828",
      "role": "user",
      "status": "completed",
      "type": "message"
    }
  ],
  "first_id": "msg_7639f8f6-484b-454a-8125-96a3f40eb9e8",
  "has_more": false,
  "last_id": "msg_288594f6-6ef1-4519-94d4-a545ca311828",
  "object": "list"
}

Authorizations

string
header
required

Qwen Cloud API Key. Create one in the console.

Path Parameters

string
required

The conversation ID.

conv_xxx

Query Parameters

string

Pagination cursor. Returns items created after the specified message ID.

enum<string>
default"desc"

Sort order: asc (ascending) or desc (descending). Default: desc.

asc,desc
integer
default20

Number of items to return (1-100). Default: 20.

1 <= x <= 100

Response

200-application/json
object[]

Message items.

string

ID of the first message item.

boolean

Whether more data is available.

string

ID of the last message item.

enum<string>

Always list.

list