Conversations API

Early access
Copy Page as Markdown

Use the Conversations API to create, inspect, retag, and delete stored conversations — and the items inside them. How long that history stays is covered in Data retention. These are storage operations — no inference runs. Continue a conversation directly from /v1/responses with the conversation field, or without a stored resource at all via previous_response_id.

Endpoints

MethodPathDescription
POST/v1/conversationsCreate a conversation
GET/v1/conversations/{conversation_id}Retrieve a conversation
POST/v1/conversations/{conversation_id}Update a conversation's metadata
DELETE/v1/conversations/{conversation_id}Delete a conversation
POST/v1/conversations/{conversation_id}/itemsAdd items to a conversation
GET/v1/conversations/{conversation_id}/itemsList a conversation's items
GET/v1/conversations/{conversation_id}/items/{item_id}Retrieve an item
DELETE/v1/conversations/{conversation_id}/items/{item_id}Delete an item

The conversation object

Every endpoint except delete returns a conversation object:

{
  "id": "conv_abc123",
  "object": "conversation",
  "created_at": 1751484000,
  "metadata": { "department": "cardiology", "acuity": "unconfirmed" }
}
FieldTypeDescription
idstringConversation ID (conv_...).
objectstringAlways "conversation".
created_atintegerUnix timestamp (seconds) of creation. Unchanged on update.
metadataobjectString-to-string tags. Always an object ({} if untagged, never null). Up to 16 keys; keys up to 64 characters, values up to 512.

Create a conversation

POST /v1/conversations

All fields are optional. An empty body creates an untagged conversation.

cURLTypeScriptPython

Seed it with prior history by passing items — up to 20 user messages, text only (see Items to add more later):

{
  "metadata": { "department": "cardiology" },
  "items": [
    { "role": "user", "content": "Patient reports chest pain since this morning." }
  ]
}

Orgs configured for zero data retention cannot create conversations (403 zero_data_retention). Send the full input on each /v1/responses request instead.

Retrieve a conversation

GET /v1/conversations/{conversation_id}
cURLTypeScriptPython

Returns the conversation object. An unknown id, or one that belongs to another organization, returns 404 conversation_not_found.

Update a conversation

POST /v1/conversations/{conversation_id}

metadata is required and replaces the stored tags. Resend every key you want to keep; send {} to clear them.

cURLTypeScriptPython

Delete a conversation

DELETE /v1/conversations/{conversation_id}

Deletes the conversation and every item and response in it. Irreversible.

cURLTypeScriptPython
{
  "id": "conv_abc123",
  "object": "conversation.deleted",
  "deleted": true
}

Items

List, add, retrieve, or delete the individual messages, function calls, and web searches inside a conversation.

MethodPathDescription
POST/v1/conversations/{conversation_id}/itemsAdd items
GET/v1/conversations/{conversation_id}/itemsList items
GET/v1/conversations/{conversation_id}/items/{item_id}Retrieve an item
DELETE/v1/conversations/{conversation_id}/items/{item_id}Delete an item

Add items the same way you seed a conversation — role: "user", text only:

{
  "items": [
    { "role": "user", "content": "Follow-up: any allergies on file?" }
  ]
}

Reasoning and function-call outputs aren't individually addressable — they stay attached to their parent message. List paginates with limit (1–100, default 20), order, and an after cursor, same as Files. Delete returns the parent conversation object, not a deletion envelope.

Errors

{
  "error": {
    "message": "Conversation 'conv_abc123' not found.",
    "type": "invalid_request_error",
    "code": "conversation_not_found"
  }
}
HTTPcodeMeaning
401invalid_api_keyMissing or invalid Bearer token
404conversation_not_foundId doesn't exist or belongs to another organization
404item_not_foundItem doesn't exist in the conversation, or isn't individually addressable
403zero_data_retentionOrg cannot store conversations
403access_deniedAPI key does not belong to an organization
503authorization_failedKey lookup temporarily unavailable; retry
  • Responses API — continue a stored conversation directly with the conversation field, or chain turns with previous_response_id; every response includes a conversation field either way.
  • Authentication — API keys and request headers.