Modify message
POSThttps:/api.openai.com/v1/threads/{thread_id}/messages/{message_id}
Modifies 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 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 message object.
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" \5 -d '{6 "metadata": {7 "modified": "true",8 "user": "abc123"9 }10 }'
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 "file_ids": [],19 "metadata": {20 "modified": "true",21 "user": "abc123"22 }23 }
Built with