Skip to main content

items

Creates, updates, deletes, gets or lists an items resource.

Overview

Nameitems
TypeResource
Idopenai.conversations.items

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringThe unique ID of the message.
namestringThe name of the function to run.
approval_request_idstringThe ID of the approval request being answered.
call_idstringThe unique ID of the function tool call generated by the model.
container_idstringThe ID of the container used to run the code.
acknowledged_safety_checksarrayThe safety checks reported by the API that have been acknowledged by the developer.
actionobjectAn object describing the specific action taken in this web search call. Includes details on how the model used the web (search, open_page, find_in_page). (title: Search action)
actionsarrayFlattened batched actions for computer_use. Each action includes an type discriminator and action-specific fields. (title: Computer Action List)
approvebooleanWhether the request was approved.
argumentsstringA JSON string of the arguments to pass to the function.
codestringThe code to run, or null if not available.
contentarrayThe content of the message
created_bystringThe identifier of the actor that created the item.
encrypted_contentstringThe encrypted content of the reasoning item - populated when a response is generated with reasoning.encrypted_content in the include parameter.
environmentstring (json)
errorstringError message if the server could not list tools.
executionstringWhether tool search was executed by the server or by the client. (server, client)
inputstringThe input for the custom tool call generated by the model.
max_output_lengthintegerThe maximum length of the shell command output. This is generated by the model and should be passed back with the raw output.
namespacestringThe namespace of the function to run.
operationobjectOne of the create_file, delete_file, or update_file operations applied via apply_patch. (title: Apply patch operation)
outputstringThe output from the function call generated by your code. Can be a string or an list of output content. (title: string output)
outputsarrayThe outputs generated by the code interpreter, such as logs or images. Can be null if no outputs are available.
pending_safety_checksarrayThe pending safety checks for the computer call.
phasestring (commentary, final_answer)
queriesarrayThe queries used to search for files.
reasonstringOptional reason for the decision.
resultstringThe generated image encoded in base64.
resultsarrayThe results of the file search tool call.
rolestringThe role of the message. One of unknown, user, assistant, system, critic, discriminator, developer, or tool. (unknown, user, assistant, system, critic, discriminator, developer, tool)
server_labelstringThe label of the MCP server.
statusstringThe status of item. One of in_progress, completed, or incomplete. Populated when items are returned via API. (in_progress, completed, incomplete)
summaryarrayReasoning summary content.
toolsarrayThe loaded tool definitions returned by tool search.
typestringThe type of the message. Always set to message. (message) (default: message)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectconversation_id, item_idinclude, openai-organization, openai-project
listselectconversation_idlimit, order, after, include, openai-organization, openai-project
createinsertconversation_id, itemsinclude, openai-organization, openai-project
deletedeleteconversation_id, item_idopenai-organization, openai-project

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
conversation_idstringThe ID of the conversation that contains the item.
item_idstringThe ID of the item to delete.
afterstringAn item ID to list items after, used in pagination.
includearrayAdditional fields to include in the response. See the include parameter for listing Conversation items above for more information.
limitintegerA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. Automatically applied from a SQL LIMIT clause - SELECT ... LIMIT 10 sends limit=10 on the wire. Setting it explicitly in a WHERE clause is not required.
openai-organizationstringOptionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as openai_organization.
openai-projectstringOptionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as openai_project.
orderstringThe order to return the input items in. Default is desc. - asc: Return the input items in ascending order. - desc: Return the input items in descending order.

SELECT examples

OK

SELECT
id,
name,
approval_request_id,
call_id,
container_id,
acknowledged_safety_checks,
action,
actions,
approve,
arguments,
code,
content,
created_by,
encrypted_content,
environment,
error,
execution,
input,
max_output_length,
namespace,
operation,
output,
outputs,
pending_safety_checks,
phase,
queries,
reason,
result,
results,
role,
server_label,
status,
summary,
tools,
type
FROM openai.conversations.items
WHERE conversation_id = '{{ conversation_id }}' -- required
AND item_id = '{{ item_id }}' -- required
AND include = '{{ include }}'
AND "openai-organization" = '{{ openai-organization }}'
AND "openai-project" = '{{ openai-project }}'
;

INSERT examples

No description available.

INSERT INTO openai.conversations.items (
items,
conversation_id,
include,
"openai-organization",
"openai-project"
)
SELECT
'{{ items }}' /* required */,
'{{ conversation_id }}',
'{{ include }}',
'{{ openai-organization }}',
'{{ openai-project }}'
RETURNING
first_id,
last_id,
data,
has_more,
object
;

DELETE examples

No description available.

DELETE FROM openai.conversations.items
WHERE conversation_id = '{{ conversation_id }}' --required
AND item_id = '{{ item_id }}' --required
AND "openai-organization" = '{{ openai-organization }}'
AND "openai-project" = '{{ openai-project }}'
;