Conversations API
Early accessUse 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
| Method | Path | Description |
|---|---|---|
POST | /v1/conversations | Create 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}/items | Add items to a conversation |
GET | /v1/conversations/{conversation_id}/items | List 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" }
}| Field | Type | Description |
|---|---|---|
id | string | Conversation ID (conv_...). |
object | string | Always "conversation". |
created_at | integer | Unix timestamp (seconds) of creation. Unchanged on update. |
metadata | object | String-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/conversationsAll fields are optional. An empty body creates an untagged conversation.
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}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.
Delete a conversation
DELETE /v1/conversations/{conversation_id}Deletes the conversation and every item and response in it. Irreversible.
{
"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.
| Method | Path | Description |
|---|---|---|
POST | /v1/conversations/{conversation_id}/items | Add items |
GET | /v1/conversations/{conversation_id}/items | List 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"
}
}| HTTP | code | Meaning |
|---|---|---|
| 401 | invalid_api_key | Missing or invalid Bearer token |
| 404 | conversation_not_found | Id doesn't exist or belongs to another organization |
| 404 | item_not_found | Item doesn't exist in the conversation, or isn't individually addressable |
| 403 | zero_data_retention | Org cannot store conversations |
| 403 | access_denied | API key does not belong to an organization |
| 503 | authorization_failed | Key lookup temporarily unavailable; retry |
Related
- Responses API — continue a stored conversation directly with the
conversationfield, or chain turns withprevious_response_id; every response includes aconversationfield either way. - Authentication — API keys and request headers.