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>",
"role": "assistant",
"id": "<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>"
}
}
],
"function_call": {
"arguments": "<string>",
"name": "<string>"
},
"audio": {
"id": "<string>",
"expires_at": 123,
"data": "<string>",
"transcript": "<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>",
"role": "assistant",
"id": "<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>"
}
}
],
"function_call": {
"arguments": "<string>",
"name": "<string>"
},
"audio": {
"id": "<string>",
"expires_at": 123,
"data": "<string>",
"transcript": "<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.
The type of this object. It is always set to "list".
list An array of chat completion message objects.
Show child attributes
The identifier of the first chat message in the data array.
The identifier of the last chat message in the data array.
Indicates whether there are more chat messages available.
Was this page helpful?