Modify run
POSThttps:/api.openai.com/v1/threads/{thread_id}/runs/{run_id}
Modifies a run.
Path parameters
thread_id
string
Required
The ID of the thread that was run.
run_id
string
Required
The ID of the run to modify.
Request body
metadata
object or null
Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.
Response
The modified run object matching the specified ID.
Example request
1 curl https://api.openai.com/v1/threads/thread_abc123/runs/run_abc123 \2 -H "Authorization: Bearer $OPENAI_API_KEY" \3 -H "Content-Type: application/json" \4 -H "OpenAI-Beta: assistants=v2" \5 -d '{6 "metadata": {7 "user_id": "user_abc123"8 }9 }'
Example response
1 {2 "id": "run_abc123",3 "object": "thread.run",4 "created_at": 1699075072,5 "assistant_id": "asst_abc123",6 "thread_id": "thread_abc123",7 "status": "completed",8 "started_at": 1699075072,9 "expires_at": null,10 "cancelled_at": null,11 "failed_at": null,12 "completed_at": 1699075073,13 "last_error": null,14 "model": "gpt-4o",15 "instructions": null,16 "incomplete_details": null,17 "tools": [18 {19 "type": "code_interpreter"20 }21 ],22 "tool_resources": {23 "code_interpreter": {24 "file_ids": [25 "file-abc123",26 "file-abc456"27 ]28 }29 },30 "metadata": {31 "user_id": "user_abc123"32 },33 "usage": {34 "prompt_tokens": 123,35 "completion_tokens": 456,36 "total_tokens": 57937 },38 "temperature": 1.0,39 "top_p": 1.0,40 "max_prompt_tokens": 1000,41 "max_completion_tokens": 1000,42 "truncation_strategy": {43 "type": "auto",44 "last_messages": null45 },46 "response_format": "auto",47 "tool_choice": "auto",48 "parallel_tool_calls": true49 }
Built with