GET
GET /threads/{thread_id}/messages — OpenAI API
OpenAI API key (required); https://api.openai.com/v1
OpenAI APIList messages
- Base URL
- https://api.openai.com/v1
- Auth
- Authorization: Bearer <OPENAI_API_KEY>
- Last verified
- 2026-10-20 · upstream hash matched
Actions Try in browser→
Agents: curl -H "Accept: text/markdown" this URL
→ 310 tokens · Vary: Accept
→ 310 tokens · Vary: Accept
Critical gotchas
The Responses API is the primary interface for new text and tool workflows; Chat Completions remains a separate compatibility API.
Audio transcription uploads use multipart form data rather than a JSON request body.
cURL
curl -X GET 'https://api.openai.com/v1/threads/thread-id/messages?limit=20&order=desc&after=example-after&before=example-before&run_id=run-id' \ -H "Authorization: Bearer $OPENAI_API_KEY"
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| thread_id | path | string | Yes | The ID of the [thread](https://developers.openai.com/api/docs/assistants/migration) the messages belong to. |
| limit | query | integer | No | A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. |
| order | query | string | No | Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order. |
| after | query | string | No | A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. |
| before | query | string | No | A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. |
| run_id | query | string | No | Filter messages by the run ID that generated them. |
Response 200 OK
{
"object": "list",
"data": [
{
"id": "string",
"object": "thread.message",
"created_at": 0,
"thread_id": "string",
"status": "in_progress",
"incomplete_details": {
"reason": "content_filter"
},
"completed_at": 0,
"incomplete_at": 0,
"role": "user",
"content": [
{
"type": "image_file",
"image_file": {
"file_id": "[recursive or deeply nested schema]",
"detail": "[recursive or deeply nested schema]"
}
}
],
"assistant_id": "string",
"run_id": "string",
"attachments": [
{
"file_id": "string",
"tools": [
"[recursive or deeply nested schema]"
]
}
],
"metadata": {}
}
],
"first_id": "msg_abc123",
"last_id": "msg_abc123",
"has_more": false
} Get a free OpenAI API key → sponsored Affiliate link - we may earn a commission, at no extra cost to you.