OpenAI Conversations API

Manage conversations and conversation items.

Operations 8

POST /conversations/{conversation_id}/items Create items in a conversation with the given ID. #
GET /conversations/{conversation_id}/items List all items for a conversation with the given ID. #
GET /conversations/{conversation_id}/items/{item_id} Get a single item from a conversation with the given IDs. #
DELETE /conversations/{conversation_id}/items/{item_id} Delete an item from a conversation with the given IDs. #
POST /conversations Create a conversation. #
GET /conversations/{conversation_id} Get a conversation #
DELETE /conversations/{conversation_id} Delete a conversation. Items in the conversation will not be deleted. #
POST /conversations/{conversation_id} Update a conversation #

Documentation

📖
Documentation
https://platform.openai.com/docs/assistants/overview
📖
Documentation
https://platform.openai.com/docs/api-reference/assistants
📖
Documentation
https://platform.openai.com/docs/guides/text-to-speech
📖
Documentation
https://platform.openai.com/docs/api-reference/audio
📖
Documentation
https://platform.openai.com/docs/guides/speech-to-text
📖
Documentation
https://developers.openai.com/api/docs/guides/audio/
📖
Documentation
https://developers.openai.com/api/docs/guides/voice-agents/
📖
Documentation
https://platform.openai.com/docs/api-reference/chat
📖
Documentation
https://platform.openai.com/docs/guides/embeddings
📖
Documentation
https://platform.openai.com/docs/api-reference/embeddings
📖
Documentation
https://platform.openai.com/docs/api-reference/files
📖
Documentation
https://platform.openai.com/docs/guides/fine-tuning
📖
Documentation
https://platform.openai.com/docs/api-reference/fine-tuning
📖
Documentation
https://platform.openai.com/docs/guides/images
📖
Documentation
https://platform.openai.com/docs/api-reference/images
📖
Documentation
https://platform.openai.com/docs/guides/image-generation
📖
Documentation
https://platform.openai.com/docs/guides/images-vision
📖
Documentation
https://platform.openai.com/docs/models
📖
Documentation
https://platform.openai.com/docs/api-reference/models
📖
Documentation
https://platform.openai.com/docs/assistants/how-it-works/managing-threads-and-messages
📖
Documentation
https://platform.openai.com/docs/api-reference/threads
📖
Documentation
https://platform.openai.com/docs/api-reference/completions

Specifications

Schemas & Data

Other Resources

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/openai-conversations-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

openai-conversations-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: OpenAI Conversations API
  description: The OpenAI REST API. Please see https://platform.openai.com/docs/api-reference for more details.
  version: 2.3.0
  termsOfService: https://openai.com/policies/terms-of-use
  contact:
    name: OpenAI Support
    url: https://help.openai.com/
  license:
    name: MIT
    url: https://github.com/openai/openai-openapi/blob/master/LICENSE
servers:
- url: https://api.openai.com/v1
security:
- ApiKeyAuth: []
tags:
- name: Conversations
  description: Manage conversations and conversation items.
paths:
  /conversations/{conversation_id}/items:
    post:
      operationId: createConversationItems
      tags:
      - Conversations
      summary: Create items in a conversation with the given ID.
      parameters:
      - in: path
        name: conversation_id
        required: true
        schema:
          type: string
          example: conv_123
        description: The ID of the conversation to add the item to.
      - name: include
        in: query
        required: false
        schema:
          type: array
          items:
            $ref: '#/components/schemas/IncludeEnum'
        description: 'Additional fields to include in the response. See the `include`

          parameter for [listing Conversation items above](/docs/api-reference/conversations/list-items#conversations_list_items-include) for more information.

          '
      requestBody:
        required: true
        content:
          application/json:
            schema:
              properties:
                items:
                  type: array
                  description: 'The items to add to the conversation. You may add up to 20 items at a time.

                    '
                  items:
                    $ref: '#/components/schemas/InputItem'
                  maxItems: 20
              required:
              - items
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConversationItemList'
      x-oaiMeta:
        name: Create items
        group: conversations
        path: create-item
        examples:
          request:
            curl: "curl https://api.openai.com/v1/conversations/conv_123/items \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n  -d '{\n    \"items\": [\n      {\n        \"type\": \"message\",\n        \"role\": \"user\",\n        \"content\": [\n          {\"type\": \"input_text\", \"text\": \"Hello!\"}\n        ]\n      },\n      {\n        \"type\": \"message\",\n        \"role\": \"user\",\n        \"content\": [\n          {\"type\": \"input_text\", \"text\": \"How are you?\"}\n        ]\n      }\n    ]\n  }'\n"
            javascript: "import OpenAI from \"openai\";\nconst client = new OpenAI();\n\nconst items = await client.conversations.items.create(\n  \"conv_123\",\n  {\n    items: [\n      {\n        type: \"message\",\n        role: \"user\",\n        content: [{ type: \"input_text\", text: \"Hello!\" }],\n      },\n      {\n        type: \"message\",\n        role: \"user\",\n        content: [{ type: \"input_text\", text: \"How are you?\" }],\n      },\n    ],\n  }\n);\nconsole.log(items.data);\n"
            python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n    api_key=os.environ.get(\"OPENAI_API_KEY\"),  # This is the default and can be omitted\n)\nconversation_item_list = client.conversations.items.create(\n    conversation_id=\"conv_123\",\n    items=[{\n        \"content\": \"string\",\n        \"role\": \"user\",\n        \"type\": \"message\",\n    }],\n)\nprint(conversation_item_list.first_id)"
            csharp: "using System;\nusing System.Collections.Generic;\nusing OpenAI.Conversations;\n\nOpenAIConversationClient client = new(\n    apiKey: Environment.GetEnvironmentVariable(\"OPENAI_API_KEY\")\n);\n\nConversationItemList created = client.ConversationItems.Create(\n    conversationId: \"conv_123\",\n    new CreateConversationItemsOptions\n    {\n        Items = new List<ConversationItem>\n        {\n            new ConversationMessage\n            {\n                Role = \"user\",\n                Content =\n                {\n                    new ConversationInputText { Text = \"Hello!\" }\n                }\n            },\n            new ConversationMessage\n            {\n                Role = \"user\",\n                Content =\n                {\n                    new ConversationInputText { Text = \"How are you?\" }\n                }\n            }\n        }\n    }\n);\nConsole.WriteLine(created.Data.Count);\n"
            node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted\n});\n\nconst conversationItemList = await client.conversations.items.create('conv_123', {\n  items: [\n    {\n      content: 'string',\n      role: 'user',\n      type: 'message',\n    },\n  ],\n});\n\nconsole.log(conversationItemList.first_id);"
            go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/conversations\"\n\t\"github.com/openai/openai-go/option\"\n\t\"github.com/openai/openai-go/responses\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tconversationItemList, err := client.Conversations.Items.New(\n\t\tcontext.TODO(),\n\t\t\"conv_123\",\n\t\tconversations.ItemNewParams{\n\t\t\tItems: []responses.ResponseInputItemUnionParam{{\n\t\t\t\tOfMessage: &responses.EasyInputMessageParam{\n\t\t\t\t\tContent: responses.EasyInputMessageContentUnionParam{\n\t\t\t\t\t\tOfString: openai.String(\"string\"),\n\t\t\t\t\t},\n\t\t\t\t\tRole: responses.EasyInputMessageRoleUser,\n\t\t\t\t\tType: responses.EasyInputMessageTypeMessage,\n\t\t\t\t},\n\t\t\t}},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", conversationItemList.FirstID)\n}\n"
            java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.conversations.items.ConversationItemList;\nimport com.openai.models.conversations.items.ItemCreateParams;\nimport com.openai.models.responses.EasyInputMessage;\n\npublic final class Main {\n    private Main() {}\n\n    public static void main(String[] args) {\n        OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n        ItemCreateParams params = ItemCreateParams.builder()\n            .conversationId(\"conv_123\")\n            .addItem(EasyInputMessage.builder()\n                .content(\"string\")\n                .role(EasyInputMessage.Role.USER)\n                .type(EasyInputMessage.Type.MESSAGE)\n                .build())\n            .build();\n        ConversationItemList conversationItemList = client.conversations().items().create(params);\n    }\n}"
            ruby: 'require "openai"


              openai = OpenAI::Client.new(api_key: "My API Key")


              conversation_item_list = openai.conversations.items.create("conv_123", items: [{content: "string", role: :user, type: :message}])


              puts(conversation_item_list)'
          response: "{\n  \"object\": \"list\",\n  \"data\": [\n    {\n      \"type\": \"message\",\n      \"id\": \"msg_abc\",\n      \"status\": \"completed\",\n      \"role\": \"user\",\n      \"content\": [\n        {\"type\": \"input_text\", \"text\": \"Hello!\"}\n      ]\n    },\n    {\n      \"type\": \"message\",\n      \"id\": \"msg_def\",\n      \"status\": \"completed\",\n      \"role\": \"user\",\n      \"content\": [\n        {\"type\": \"input_text\", \"text\": \"How are you?\"}\n      ]\n    }\n  ],\n  \"first_id\": \"msg_abc\",\n  \"last_id\": \"msg_def\",\n  \"has_more\": false\n}\n"
    get:
      operationId: listConversationItems
      tags:
      - Conversations
      summary: List all items for a conversation with the given ID.
      parameters:
      - in: path
        name: conversation_id
        required: true
        schema:
          type: string
          example: conv_123
        description: The ID of the conversation to list items for.
      - name: limit
        in: query
        description: 'A limit on the number of objects to be returned. Limit can range between

          1 and 100, and the default is 20.

          '
        required: false
        schema:
          type: integer
          default: 20
      - in: query
        name: order
        schema:
          type: string
          enum:
          - asc
          - desc
        description: 'The 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.

          '
      - in: query
        name: after
        schema:
          type: string
        description: 'An item ID to list items after, used in pagination.

          '
      - name: include
        in: query
        required: false
        schema:
          type: array
          items:
            $ref: '#/components/schemas/IncludeEnum'
        description: 'Specify additional output data to include in the model response. Currently supported values are:

          - `web_search_call.action.sources`: Include the sources of the web search tool call.

          - `code_interpreter_call.outputs`: Includes the outputs of python code execution in code interpreter tool call items.

          - `computer_call_output.output.image_url`: Include image urls from the computer call output.

          - `file_search_call.results`: Include the search results of the file search tool call.

          - `message.input_image.image_url`: Include image urls from the input message.

          - `message.output_text.logprobs`: Include logprobs with assistant messages.

          - `reasoning.encrypted_content`: Includes an encrypted version of reasoning tokens in reasoning item outputs. This enables reasoning items to be used in multi-turn conversations when using the Responses API statelessly (like when the `store` parameter is set to `false`, or when an organization is enrolled in the zero data retention program).'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConversationItemList'
      x-oaiMeta:
        name: List items
        group: conversations
        path: list-items
        examples:
          request:
            curl: "curl \"https://api.openai.com/v1/conversations/conv_123/items?limit=10\" \\\n  -H \"Authorization: Bearer $OPENAI_API_KEY\"\n"
            javascript: 'import OpenAI from "openai";

              const client = new OpenAI();


              const items = await client.conversations.items.list("conv_123", { limit: 10 });

              console.log(items.data);

              '
            python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n    api_key=os.environ.get(\"OPENAI_API_KEY\"),  # This is the default and can be omitted\n)\npage = client.conversations.items.list(\n    conversation_id=\"conv_123\",\n)\npage = page.data[0]\nprint(page)"
            csharp: "using System;\nusing OpenAI.Conversations;\n\nOpenAIConversationClient client = new(\n    apiKey: Environment.GetEnvironmentVariable(\"OPENAI_API_KEY\")\n);\n\nConversationItemList items = client.ConversationItems.List(\n    conversationId: \"conv_123\",\n    new ListConversationItemsOptions { Limit = 10 }\n);\nConsole.WriteLine(items.Data.Count);\n"
            node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted\n});\n\n// Automatically fetches more pages as needed.\nfor await (const conversationItem of client.conversations.items.list('conv_123')) {\n  console.log(conversationItem);\n}"
            go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/conversations\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Conversations.Items.List(\n\t\tcontext.TODO(),\n\t\t\"conv_123\",\n\t\tconversations.ItemListParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n"
            java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.conversations.items.ItemListPage;\nimport com.openai.models.conversations.items.ItemListParams;\n\npublic final class Main {\n    private Main() {}\n\n    public static void main(String[] args) {\n        OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n        ItemListPage page = client.conversations().items().list(\"conv_123\");\n    }\n}"
            ruby: 'require "openai"


              openai = OpenAI::Client.new(api_key: "My API Key")


              page = openai.conversations.items.list("conv_123")


              puts(page)'
          response: "{\n  \"object\": \"list\",\n  \"data\": [\n    {\n      \"type\": \"message\",\n      \"id\": \"msg_abc\",\n      \"status\": \"completed\",\n      \"role\": \"user\",\n      \"content\": [\n        {\"type\": \"input_text\", \"text\": \"Hello!\"}\n      ]\n    }\n  ],\n  \"first_id\": \"msg_abc\",\n  \"last_id\": \"msg_abc\",\n  \"has_more\": false\n}\n"
  /conversations/{conversation_id}/items/{item_id}:
    get:
      operationId: getConversationItem
      tags:
      - Conversations
      summary: Get a single item from a conversation with the given IDs.
      parameters:
      - in: path
        name: conversation_id
        required: true
        schema:
          type: string
          example: conv_123
        description: The ID of the conversation that contains the item.
      - in: path
        name: item_id
        required: true
        schema:
          type: string
          example: msg_abc
        description: The ID of the item to retrieve.
      - name: include
        in: query
        required: false
        schema:
          type: array
          items:
            $ref: '#/components/schemas/IncludeEnum'
        description: 'Additional fields to include in the response. See the `include`

          parameter for [listing Conversation items above](/docs/api-reference/conversations/list-items#conversations_list_items-include) for more information.

          '
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConversationItem'
      x-oaiMeta:
        name: Retrieve an item
        group: conversations
        path: get-item
        examples:
          request:
            curl: "curl https://api.openai.com/v1/conversations/conv_123/items/msg_abc \\\n  -H \"Authorization: Bearer $OPENAI_API_KEY\"\n"
            javascript: "import OpenAI from \"openai\";\nconst client = new OpenAI();\n\nconst item = await client.conversations.items.retrieve(\n  \"conv_123\",\n  \"msg_abc\"\n);\nconsole.log(item);\n"
            python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n    api_key=os.environ.get(\"OPENAI_API_KEY\"),  # This is the default and can be omitted\n)\nconversation_item = client.conversations.items.retrieve(\n    item_id=\"msg_abc\",\n    conversation_id=\"conv_123\",\n)\nprint(conversation_item)"
            csharp: "using System;\nusing OpenAI.Conversations;\n\nOpenAIConversationClient client = new(\n    apiKey: Environment.GetEnvironmentVariable(\"OPENAI_API_KEY\")\n);\n\nConversationItem item = client.ConversationItems.Get(\n    conversationId: \"conv_123\",\n    itemId: \"msg_abc\"\n);\nConsole.WriteLine(item.Id);\n"
            node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted\n});\n\nconst conversationItem = await client.conversations.items.retrieve('msg_abc', {\n  conversation_id: 'conv_123',\n});\n\nconsole.log(conversationItem);"
            go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/conversations\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tconversationItem, err := client.Conversations.Items.Get(\n\t\tcontext.TODO(),\n\t\t\"conv_123\",\n\t\t\"msg_abc\",\n\t\tconversations.ItemGetParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", conversationItem)\n}\n"
            java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.conversations.items.ConversationItem;\nimport com.openai.models.conversations.items.ItemRetrieveParams;\n\npublic final class Main {\n    private Main() {}\n\n    public static void main(String[] args) {\n        OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n        ItemRetrieveParams params = ItemRetrieveParams.builder()\n            .conversationId(\"conv_123\")\n            .itemId(\"msg_abc\")\n            .build();\n        ConversationItem conversationItem = client.conversations().items().retrieve(params);\n    }\n}"
            ruby: 'require "openai"


              openai = OpenAI::Client.new(api_key: "My API Key")


              conversation_item = openai.conversations.items.retrieve("msg_abc", conversation_id: "conv_123")


              puts(conversation_item)'
          response: "{\n  \"type\": \"message\",\n  \"id\": \"msg_abc\",\n  \"status\": \"completed\",\n  \"role\": \"user\",\n  \"content\": [\n    {\"type\": \"input_text\", \"text\": \"Hello!\"}\n  ]\n}\n"
    delete:
      operationId: deleteConversationItem
      tags:
      - Conversations
      summary: Delete an item from a conversation with the given IDs.
      parameters:
      - in: path
        name: conversation_id
        required: true
        schema:
          type: string
          example: conv_123
        description: The ID of the conversation that contains the item.
      - in: path
        name: item_id
        required: true
        schema:
          type: string
          example: msg_abc
        description: The ID of the item to delete.
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConversationResource'
      x-oaiMeta:
        name: Delete an item
        group: conversations
        path: delete-item
        examples:
          request:
            curl: "curl -X DELETE https://api.openai.com/v1/conversations/conv_123/items/msg_abc \\\n  -H \"Authorization: Bearer $OPENAI_API_KEY\"\n"
            javascript: "import OpenAI from \"openai\";\nconst client = new OpenAI();\n\nconst conversation = await client.conversations.items.delete(\n  \"conv_123\",\n  \"msg_abc\"\n);\nconsole.log(conversation);\n"
            python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n    api_key=os.environ.get(\"OPENAI_API_KEY\"),  # This is the default and can be omitted\n)\nconversation = client.conversations.items.delete(\n    item_id=\"msg_abc\",\n    conversation_id=\"conv_123\",\n)\nprint(conversation.id)"
            csharp: "using System;\nusing OpenAI.Conversations;\n\nOpenAIConversationClient client = new(\n    apiKey: Environment.GetEnvironmentVariable(\"OPENAI_API_KEY\")\n);\n\nConversation conversation = client.ConversationItems.Delete(\n    conversationId: \"conv_123\",\n    itemId: \"msg_abc\"\n);\nConsole.WriteLine(conversation.Id);\n"
            node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted\n});\n\nconst conversation = await client.conversations.items.delete('msg_abc', {\n  conversation_id: 'conv_123',\n});\n\nconsole.log(conversation.id);"
            go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tconversation, err := client.Conversations.Items.Delete(\n\t\tcontext.TODO(),\n\t\t\"conv_123\",\n\t\t\"msg_abc\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", conversation.ID)\n}\n"
            java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.conversations.Conversation;\nimport com.openai.models.conversations.items.ItemDeleteParams;\n\npublic final class Main {\n    private Main() {}\n\n    public static void main(String[] args) {\n        OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n        ItemDeleteParams params = ItemDeleteParams.builder()\n            .conversationId(\"conv_123\")\n            .itemId(\"msg_abc\")\n            .build();\n        Conversation conversation = client.conversations().items().delete(params);\n    }\n}"
            ruby: 'require "openai"


              openai = OpenAI::Client.new(api_key: "My API Key")


              conversation = openai.conversations.items.delete("msg_abc", conversation_id: "conv_123")


              puts(conversation)'
          response: "{\n  \"id\": \"conv_123\",\n  \"object\": \"conversation\",\n  \"created_at\": 1741900000,\n  \"metadata\": {\"topic\": \"demo\"}\n}\n"
  /conversations:
    post:
      tags:
      - Conversations
      summary: Create a conversation.
      operationId: createConversation
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateConversationBody'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConversationResource'
      x-oaiMeta:
        name: Create a conversation
        group: conversations
        path: create
        examples:
          request:
            curl: "curl https://api.openai.com/v1/conversations \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n  -d '{\n    \"metadata\": {\"topic\": \"demo\"},\n    \"items\": [\n      {\n        \"type\": \"message\",\n        \"role\": \"user\",\n        \"content\": \"Hello!\"\n      }\n    ]\n  }'\n"
            javascript: "import OpenAI from \"openai\";\nconst client = new OpenAI();\n\nconst conversation = await client.conversations.create({\n  metadata: { topic: \"demo\" },\n  items: [\n    { type: \"message\", role: \"user\", content: \"Hello!\" }\n  ],\n});\nconsole.log(conversation);\n"
            python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n    api_key=os.environ.get(\"OPENAI_API_KEY\"),  # This is the default and can be omitted\n)\nconversation = client.conversations.create()\nprint(conversation.id)"
            csharp: "using System;\nusing System.Collections.Generic;\nusing OpenAI.Conversations;\n\nOpenAIConversationClient client = new(\n    apiKey: Environment.GetEnvironmentVariable(\"OPENAI_API_KEY\")\n);\n\nConversation conversation = client.CreateConversation(\n    new CreateConversationOptions\n    {\n        Metadata = new Dictionary<string, string>\n        {\n            { \"topic\", \"demo\" }\n        },\n        Items =\n        {\n            new ConversationMessageInput\n            {\n                Role = \"user\",\n                Content = \"Hello!\",\n            }\n        }\n    }\n);\nConsole.WriteLine(conversation.Id);\n"
            node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted\n});\n\nconst conversation = await client.conversations.create();\n\nconsole.log(conversation.id);"
            go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/conversations\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tconversation, err := client.Conversations.New(context.TODO(), conversations.ConversationNewParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", conversation.ID)\n}\n"
            java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.conversations.Conversation;\nimport com.openai.models.conversations.ConversationCreateParams;\n\npublic final class Main {\n    private Main() {}\n\n    public static void main(String[] args) {\n        OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n        Conversation conversation = client.conversations().create();\n    }\n}"
            ruby: 'require "openai"


              openai = OpenAI::Client.new(api_key: "My API Key")


              conversation = openai.conversations.create


              puts(conversation)'
          response: "{\n  \"id\": \"conv_123\",\n  \"object\": \"conversation\",\n  \"created_at\": 1741900000,\n  \"metadata\": {\"topic\": \"demo\"}\n}\n"
  /conversations/{conversation_id}:
    get:
      tags:
      - Conversations
      summary: Get a conversation
      operationId: getConversation
      parameters:
      - name: conversation_id
        in: path
        description: The ID of the conversation to retrieve.
        required: true
        schema:
          example: conv_123
          type: string
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConversationResource'
      x-oaiMeta:
        name: Retrieve a conversation
        group: conversations
        path: retrieve
        examples:
          request:
            curl: "curl https://api.openai.com/v1/conversations/conv_123 \\\n  -H \"Authorization: Bearer $OPENAI_API_KEY\"\n"
            javascript: 'import OpenAI from "openai";

              const client = new OpenAI();


              const conversation = await client.conversations.retrieve("conv_123");

              console.log(conversation);

              '
            python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n    api_key=os.environ.get(\"OPENAI_API_KEY\"),  # This is the default and can be omitted\n)\nconversation = client.conversations.retrieve(\n    \"conv_123\",\n)\nprint(conversation.id)"
            csharp: "using System;\nusing OpenAI.Conversations;\n\nOpenAIConversationClient client = new(\n    apiKey: Environment.GetEnvironmentVariable(\"OPENAI_API_KEY\")\n);\n\nConversation conversation = client.GetConversation(\"conv_123\");\nConsole.WriteLine(conversation.Id);\n"
            node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted\n});\n\nconst conversation = await client.conversations.retrieve('conv_123');\n\nconsole.log(conversation.id);"
            go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tconversation, err := client.Conversations.Get(context.TODO(), \"conv_123\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", conversation.ID)\n}\n"
            java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.conversations.Conversation;\nimport com.openai.models.conversations.ConversationRetrieveParams;\n\npublic final class Main {\n    private Main() {}\n\n    public static void main(String[] args) {\n        OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n        Conversation conversation = client.conversations().retrieve(\"conv_123\");\n    }\n}"
            ruby: 'require "openai"


              openai = OpenAI::Client.new(api_key: "My API Key")


              conversation = openai.conversations.retrieve("conv_123")


              puts(conversation)'
          response: "{\n  \"id\": \"conv_123\",\n  \"object\": \"conversation\",\n  \"created_at\": 1741900000,\n  \"metadata\": {\"topic\": \"demo\"}\n}\n"
    delete:
      tags:
      - Conversations
      summary: Delete a conversation. Items in the conversation will not be deleted.
      operationId: deleteConversation
      parameters:
      - name: conversation_id
        in: path
        description: The ID of the conversation to delete.
        required: true
        schema:
          example: conv_123
          type: string
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeletedConversationResource'
      x-oaiMeta:
        name: Delete a conversation
        group: conversations
        path: delete
        examples:
          request:
            curl: "curl -X DELETE https://api.openai.com/v1/conversations/conv_123 \\\n  -H \"Authorization: Bearer $OPENAI_API_KEY\"\n"
            javascript: 'import OpenAI from "openai";

              const client = new OpenAI();


              const deleted = await client.conversations.delete("conv_123");

              console.log(deleted);

              '
            python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n    api_key=os.environ.get(\"OPENAI_API_KEY\"),  # This is the default and can be omitted\n)\nconversation_deleted_resource = client.conversations.delete(\n    \"conv_123\",\n)\nprint(conversation_deleted_resource.id)"
            csharp: "using System;\nusing OpenAI.Conversations;\n\nOpenAIConversationClient client = new(\n    apiKey: Environment.GetEnvironmentVariable(\"OPENAI_API_KEY\")\n);\n\nDeletedConversation deleted = client.DeleteConversation(\"conv_123\");\nConsole.WriteLine(deleted.Id);\n"
            node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted\n});\n\nconst conversationDeletedResource = await client.conversations.delete('conv_123');\n\nconsole.log(conversationDeletedResource.id);"
            go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tconversationDeletedResource, err := client.Conversations.Delete(context.TODO(), \"conv_123\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", conversationDeletedResource.ID)\n}\n"
            java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.conversations.ConversationDeleteParams;\nimport com.openai.models.conversations.ConversationDeletedResource;\n\npublic final class Main {\n    private Main() {}\n\n    public static void main(String[] args) {\n        OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n        ConversationDeletedResource conversationDeletedResource = client.conversations().delete(\"conv_123\");\n    }\n}"
            ruby: 'require "openai"


              openai = OpenAI::Client.new(api_key: "My API Key")


              conversation_deleted_resource = openai.conversations.delete("conv_123")


              puts(conversation_deleted_resource)'
          response: "{\n  \"id\": \"conv_123\",\n  \"object\": \"conversation.deleted\",\n  \"deleted\": true\n}\n"
    post:
      tags:
      - Conversations
      summary: Update a conversation
      operationId: updateConversation
      parameters:
      - name: conversation_id
        in: path
        description: The ID of the conversation to update.
        required: true
        schema:
          example: conv_123
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateConversat

# --- truncated at 32 KB (201 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/openai/refs/heads/main/openapi/openai-conversations-api-openapi.yml