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
}
Get the messages in a stored chat completion. Only Chat Completions that
have been created with the store
parameter set to true
will be
returned.
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
}
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
The ID of the chat completion to retrieve messages from.
Identifier for the last message from the previous pagination request.
Number of messages to retrieve.
Sort order for messages by timestamp. Use asc
for ascending order or desc
for descending order. Defaults to asc
.
asc
, desc
A list of messages
An object representing a list of chat completion messages.
Was this page helpful?