Skip to main content
GET
/
conversations
/
{conversation_id}
/
messages
Python
from datagrid_ai import Datagrid

client = Datagrid(
    api_key="My API Key",
)
page = client.conversations.messages.list(
    conversation_id="conversation_id",
)
page = page.data[0]
print(page.id)
{
  "object": "list",
  "data": [
    {
      "object": "conversation.message",
      "id": "<string>",
      "agent_id": "<string>",
      "role": "user",
      "content": [
        {
          "type": "text",
          "text": "<string>"
        }
      ],
      "created_at": "2023-11-07T05:31:56Z",
      "conversation_id": "<string>",
      "credits": {
        "consumed": 123
      },
      "citations": [
        {
          "citation": "<string>",
          "knowledges": [
            {
              "type": "image",
              "knowledge_id": "<string>",
              "confirmations": [
                "<string>"
              ]
            }
          ]
        }
      ]
    }
  ],
  "has_more": true
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

conversation_id
string
required

The id of the conversation to list messages for.

Query Parameters

limit
integer
default:20

The limit on the number of objects to return, ranging between 1 and 100.

Required range: 1 <= x <= 100
after
string

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

before
string

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

Response

200 - application/json

List of messages

object
enum<string>
required
Available options:
list
data
object[]
required

An array containing the actual response elements, paginated by any request parameters.

has_more
boolean

Whether or not there are more elements available after this set. If false, this set comprises the end of the list.

I