GET
/
chat
/
completions
/
{completion_id}
/
messages
curl --request GET \
  --url https://api.openai.com/v1/chat/completions/{completion_id}/messages \
  --header 'Authorization: Bearer <token>'
{
  "object": "list",
  "data": [
    {
      "content": "<string>",
      "refusal": "<string>",
      "tool_calls": [
        {
          "id": "<string>",
          "type": "function",
          "function": {
            "name": "<string>",
            "arguments": "<string>"
          }
        }
      ],
      "annotations": [
        {
          "type": "url_citation",
          "url_citation": {
            "end_index": 123,
            "start_index": 123,
            "url": "<string>",
            "title": "<string>"
          }
        }
      ],
      "role": "assistant",
      "function_call": {
        "arguments": "<string>",
        "name": "<string>"
      },
      "audio": {
        "id": "<string>",
        "expires_at": 123,
        "data": "<string>",
        "transcript": "<string>"
      },
      "id": "<string>"
    }
  ],
  "first_id": "<string>",
  "last_id": "<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

completion_id
string
required

The ID of the chat completion to retrieve messages from.

Query Parameters

after
string

Identifier for the last message from the previous pagination request.

limit
integer
default:20

Number of messages to retrieve.

order
enum<string>
default:asc

Sort order for messages by timestamp. Use asc for ascending order or desc for descending order. Defaults to asc.

Available options:
asc,
desc

Response

200 - application/json

A list of messages

An object representing a list of chat completion messages.