Sample - OpenAI API
POST/conversations/{conversation_id}/items

Create conversation items

Creates one or more items in the specified conversation. Supply the items in the request body, with up to 20 conversation items added in a single request. Use include to request additional output data in the response.

  • RetriesRetries up to 2×, 500ms backoff, 30s timeout.

2 parameters · 1 body field
conversation_idstringrequired
The unique identifier of the conversation to which the items are added.
includearray<string>optional
Additional output data to include in the response, such as file-search results, web-search sources, code-interpreter outputs, input image URLs, or message log probabilities.

Conversation items to add, including input messages, contextual items, or a compaction trigger.

itemsarray<InputMessage>required
The items to add to the conversation. You may add up to 20 items at a time.

2 status codes
200Returns a list object containing the added conversation items, boundary identifiers, and a `has_more` flag.
objectstringrequired
The type of object returned, must be `list`.
Allowed:list
dataarray<ConversationItem>required
A list of conversation items.
has_morebooleanrequired
Whether there are more items available.
first_idstringrequired
The ID of the first item in the list.
last_idstringrequired
The ID of the last item in the list.
429Returned when the request was rejected because a rate limit was exceeded.
errorobjectrequired

Error handling

A 429 is returned when the request rate exceeds the allowed limit. The items array is required and can contain at most 20 items; each input message must include its required role and content fields.