GET/threads/{thread_id}/messages

List messages in a thread

Lists messages belonging to a thread. Use run_id to filter by the run that generated the messages and order to control their creation-time order. Use after or before cursors to navigate the results.

6 parameters
thread_idstringrequired
The ID of the thread whose messages to list.
limitintegeroptional
Maximum number of messages to return, from 1 to 100. Defaults to 20 when omitted.
Default:20
orderstringoptional
Sort order by creation time: `asc` or `desc`. Defaults to `desc` when omitted.
Allowed:ascdescDefault:desc
afterstringoptional
Message ID cursor after which to return results.
beforestringoptional
Message ID cursor before which to return results.
run_idstringoptional
Filter messages to those generated by the specified run.

2 status codes
200Returns a page of message objects with the first and last message IDs and a `has_more` flag.
objectstringrequired
dataarray<TheMessageObject>required
first_idstringrequired
last_idstringrequired
has_morebooleanrequired
429Returned when the request is rejected because a rate limit was exceeded.
errorobjectrequired

Error handling

A 429 is returned when the request exceeds a rate limit. The limit query parameter must be between 1 and 100, and order must be asc or desc.