Retrieve message

GEThttps:/api.openai.com/v1/threads/{thread_id}/messages/{message_id}

Retrieve a message.

Path parameters

  • thread_id
    string
    Required

    The ID of the thread to which this message belongs.

  • message_id
    string
    Required
    The ID of the message to retrieve.

Response

The message object matching the specified ID.

Example request
1
curl https://api.openai.com/v1/threads/thread_abc123/messages/msg_abc123 \
2
-H "Content-Type: application/json" \
3
-H "Authorization: Bearer $OPENAI_API_KEY" \
4
-H "OpenAI-Beta: assistants=v2"
Example response
1
{
2
"id": "msg_abc123",
3
"object": "thread.message",
4
"created_at": 1699017614,
5
"assistant_id": null,
6
"thread_id": "thread_abc123",
7
"run_id": null,
8
"role": "user",
9
"content": [
10
{
11
"type": "text",
12
"text": {
13
"value": "How does AI work? Explain it in simple terms.",
14
"annotations": []
15
}
16
}
17
],
18
"attachments": [],
19
"metadata": {}
20
}
Built with