List run steps

GEThttps:/api.openai.com/v1/threads/{thread_id}/runs/{run_id}/steps

Returns a list of run steps belonging to a run.

Path parameters

  • thread_id
    string
    Required
    The ID of the thread the run and run steps belong to.
  • run_id
    string
    Required
    The ID of the run the run steps belong to.

Query parameters

  • limit
    integer
    Defaults: 20
    A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
  • order
    string
    Defaults: desc

    Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order.

  • after
    string

    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
    string

    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.

  • include[]
    array

    A list of additional fields to include in the response. Currently the only supported value is step_details.tool_calls[*].file_search.results[*].content to fetch the file search result content.

    See the file search tool documentation for more information.

Response

A list of run step objects.

Example request
1
curl https://api.openai.com/v1/threads/thread_abc123/runs/run_abc123/steps \
2
-H "Authorization: Bearer $OPENAI_API_KEY" \
3
-H "Content-Type: application/json" \
4
-H "OpenAI-Beta: assistants=v2"
Example response
1
{
2
"object": "list",
3
"data": [
4
{
5
"id": "step_abc123",
6
"object": "thread.run.step",
7
"created_at": 1699063291,
8
"run_id": "run_abc123",
9
"assistant_id": "asst_abc123",
10
"thread_id": "thread_abc123",
11
"type": "message_creation",
12
"status": "completed",
13
"cancelled_at": null,
14
"completed_at": 1699063291,
15
"expired_at": null,
16
"failed_at": null,
17
"last_error": null,
18
"step_details": {
19
"type": "message_creation",
20
"message_creation": {
21
"message_id": "msg_abc123"
22
}
23
},
24
"usage": {
25
"prompt_tokens": 123,
26
"completion_tokens": 456,
27
"total_tokens": 579
28
}
29
}
30
],
31
"first_id": "step_abc123",
32
"last_id": "step_abc456",
33
"has_more": false
34
}
Built with