OpenAI Chatkit API

The Chatkit API from OpenAI — 5 operation(s) for chatkit.

Operations 6

POST /chatkit/sessions/{session_id}/cancel Cancel an active ChatKit session and return its most recent metadata. Cancelling prevents new requests from using the issued client secret. #
POST /chatkit/sessions Create a ChatKit session. #
GET /chatkit/threads/{thread_id}/items List items that belong to a ChatKit thread. #
GET /chatkit/threads/{thread_id} Retrieve a ChatKit thread by its identifier. #
DELETE /chatkit/threads/{thread_id} Delete a ChatKit thread along with its items and stored attachments. #
GET /chatkit/threads List ChatKit threads with optional pagination and user filters. #

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-chatkit-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-chatkit-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: OpenAI Chatkit 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: Chatkit
paths:
  /chatkit/sessions/{session_id}/cancel:
    post:
      summary: 'Cancel an active ChatKit session and return its most recent metadata.


        Cancelling prevents new requests from using the issued client secret.'
      operationId: CancelChatSessionMethod
      parameters:
      - name: session_id
        in: path
        description: Unique identifier for the ChatKit session to cancel.
        required: true
        schema:
          example: cksess_123
          type: string
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatSessionResource'
      x-oaiMeta:
        name: Cancel chat session
        group: chatkit
        beta: true
        path: cancel-session new requests from using the issued client secret.
        examples:
          request:
            curl: "curl -X POST \\\n  https://api.openai.com/v1/chatkit/sessions/cksess_123/cancel \\\n  -H \"OpenAI-Beta: chatkit_beta=v1\" \\\n  -H \"Authorization: Bearer $OPENAI_API_KEY\"\n"
            javascript: 'import OpenAI from ''openai'';


              const client = new OpenAI();


              const chatSession = await client.beta.chatkit.sessions.cancel(''cksess_123'');


              console.log(chatSession.id);

              '
            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)\nchat_session = client.beta.chatkit.sessions.cancel(\n    \"cksess_123\",\n)\nprint(chat_session.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\tchatSession, err := client.Beta.ChatKit.Sessions.Cancel(context.TODO(), \"cksess_123\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", chatSession.ID)\n}\n"
            ruby: 'require "openai"


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


              chat_session = openai.beta.chatkit.sessions.cancel("cksess_123")


              puts(chat_session)'
            java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.beta.chatkit.sessions.SessionCancelParams;\nimport com.openai.models.beta.chatkit.threads.ChatSession;\n\npublic final class Main {\n    private Main() {}\n\n    public static void main(String[] args) {\n        OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n        ChatSession chatSession = client.beta().chatkit().sessions().cancel(\"cksess_123\");\n    }\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 chatSession = await client.beta.chatkit.sessions.cancel('cksess_123');\n\nconsole.log(chatSession.id);"
          response: "{\n  \"id\": \"cksess_123\",\n  \"object\": \"chatkit.session\",\n  \"workflow\": {\n    \"id\": \"workflow_alpha\",\n    \"version\": \"1\"\n  },\n  \"scope\": {\n    \"customer_id\": \"cust_456\"\n  },\n  \"max_requests_per_1_minute\": 30,\n  \"ttl_seconds\": 900,\n  \"status\": \"cancelled\",\n  \"cancelled_at\": 1712345678\n}\n"
      tags:
      - Chatkit
  /chatkit/sessions:
    post:
      summary: Create a ChatKit session.
      operationId: CreateChatSessionMethod
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateChatSessionBody'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatSessionResource'
      x-oaiMeta:
        name: Create ChatKit session
        group: chatkit
        beta: true
        path: sessions/create object.
        examples:
          request:
            curl: "curl https://api.openai.com/v1/chatkit/sessions \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n  -H \"OpenAI-Beta: chatkit_beta=v1\" \\\n  -d '{\n    \"workflow\": {\n      \"id\": \"workflow_alpha\",\n      \"version\": \"2024-10-01\"\n    },\n    \"scope\": {\n      \"project\": \"alpha\",\n      \"environment\": \"staging\"\n    },\n    \"expires_after\": 1800,\n    \"max_requests_per_1_minute\": 60,\n    \"max_requests_per_session\": 500\n  }'\n"
            javascript: 'import OpenAI from ''openai'';


              const client = new OpenAI();


              const chatSession = await client.beta.chatkit.sessions.create({ user: ''user'', workflow: { id: ''id'' } });


              console.log(chatSession.id);

              '
            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)\nchat_session = client.beta.chatkit.sessions.create(\n    user=\"x\",\n    workflow={\n        \"id\": \"id\"\n    },\n)\nprint(chat_session.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\tchatSession, err := client.Beta.ChatKit.Sessions.New(context.TODO(), openai.BetaChatKitSessionNewParams{\n\t\tUser: \"x\",\n\t\tWorkflow: openai.ChatSessionWorkflowParam{\n\t\t\tID: \"id\",\n\t\t},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", chatSession.ID)\n}\n"
            ruby: 'require "openai"


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


              chat_session = openai.beta.chatkit.sessions.create(user: "x", workflow: {id: "id"})


              puts(chat_session)'
            java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.beta.chatkit.sessions.SessionCreateParams;\nimport com.openai.models.beta.chatkit.threads.ChatSession;\nimport com.openai.models.beta.chatkit.threads.ChatSessionWorkflowParam;\n\npublic final class Main {\n    private Main() {}\n\n    public static void main(String[] args) {\n        OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n        SessionCreateParams params = SessionCreateParams.builder()\n            .user(\"x\")\n            .workflow(ChatSessionWorkflowParam.builder()\n                .id(\"id\")\n                .build())\n            .build();\n        ChatSession chatSession = client.beta().chatkit().sessions().create(params);\n    }\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 chatSession = await client.beta.chatkit.sessions.create({\n  user: 'x',\n  workflow: { id: 'id' },\n});\n\nconsole.log(chatSession.id);"
          response: "{\n  \"client_secret\": \"chatkit_token_123\",\n  \"expires_at\": 1735689600,\n  \"workflow\": {\n    \"id\": \"workflow_alpha\",\n    \"version\": \"2024-10-01\"\n  },\n  \"scope\": {\n    \"project\": \"alpha\",\n    \"environment\": \"staging\"\n  },\n  \"max_requests_per_1_minute\": 60,\n  \"max_requests_per_session\": 500,\n  \"status\": \"active\"\n}\n"
      tags:
      - Chatkit
  /chatkit/threads/{thread_id}/items:
    get:
      summary: List items that belong to a ChatKit thread.
      operationId: ListThreadItemsMethod
      parameters:
      - name: thread_id
        in: path
        description: Identifier of the ChatKit thread whose items are requested.
        required: true
        schema:
          example: cthr_123
          type: string
      - name: limit
        in: query
        description: Maximum number of thread items to return. Defaults to 20.
        required: false
        schema:
          type: integer
          minimum: 0
          maximum: 100
      - name: order
        in: query
        description: Sort order for results by creation time. Defaults to `desc`.
        required: false
        schema:
          $ref: '#/components/schemas/OrderEnum'
      - name: after
        in: query
        description: List items created after this thread item ID. Defaults to null for the first page.
        required: false
        schema:
          description: List items created after this thread item ID. Defaults to null for the first page.
          type: string
      - name: before
        in: query
        description: List items created before this thread item ID. Defaults to null for the newest results.
        required: false
        schema:
          description: List items created before this thread item ID. Defaults to null for the newest results.
          type: string
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ThreadItemListResource'
      x-oaiMeta:
        name: List ChatKit thread items
        group: chatkit
        beta: true
        path: threads/list-items for the specified thread.
        examples:
          request:
            curl: "curl \"https://api.openai.com/v1/chatkit/threads/cthr_abc123/items?limit=3\" \\\n  -H \"OpenAI-Beta: chatkit_beta=v1\" \\\n  -H \"Authorization: Bearer $OPENAI_API_KEY\"\n"
            javascript: "import OpenAI from 'openai';\n\nconst client = new OpenAI();\n\n// Automatically fetches more pages as needed.\nfor await (const thread of client.beta.chatkit.threads.listItems('cthr_123')) {\n  console.log(thread);\n}\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)\npage = client.beta.chatkit.threads.list_items(\n    thread_id=\"cthr_123\",\n)\npage = page.data[0]\nprint(page)"
            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\tpage, err := client.Beta.ChatKit.Threads.ListItems(\n\t\tcontext.TODO(),\n\t\t\"cthr_123\",\n\t\topenai.BetaChatKitThreadListItemsParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n"
            ruby: 'require "openai"


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


              page = openai.beta.chatkit.threads.list_items("cthr_123")


              puts(page)'
            java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.beta.chatkit.threads.ThreadListItemsPage;\nimport com.openai.models.beta.chatkit.threads.ThreadListItemsParams;\n\npublic final class Main {\n    private Main() {}\n\n    public static void main(String[] args) {\n        OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n        ThreadListItemsPage page = client.beta().chatkit().threads().listItems(\"cthr_123\");\n    }\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 thread of client.beta.chatkit.threads.listItems('cthr_123')) {\n  console.log(thread);\n}"
          response: "{\n  \"data\": [\n    {\n      \"id\": \"cthi_user_001\",\n      \"object\": \"chatkit.thread_item\",\n      \"type\": \"user_message\",\n      \"content\": [\n        {\n          \"type\": \"input_text\",\n          \"text\": \"I need help debugging an onboarding issue.\"\n        }\n      ],\n      \"attachments\": []\n    },\n    {\n      \"id\": \"cthi_assistant_002\",\n      \"object\": \"chatkit.thread_item\",\n      \"type\": \"assistant_message\",\n      \"content\": [\n        {\n          \"type\": \"output_text\",\n          \"text\": \"Let's start by confirming the workflow version you deployed.\"\n        }\n      ]\n    }\n  ],\n  \"has_more\": false,\n  \"object\": \"list\"\n}\n"
      tags:
      - Chatkit
  /chatkit/threads/{thread_id}:
    get:
      summary: Retrieve a ChatKit thread by its identifier.
      operationId: GetThreadMethod
      parameters:
      - name: thread_id
        in: path
        description: Identifier of the ChatKit thread to retrieve.
        required: true
        schema:
          example: cthr_123
          type: string
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ThreadResource'
      x-oaiMeta:
        name: Retrieve ChatKit thread
        group: chatkit
        beta: true
        path: threads/retrieve
        examples:
          request:
            curl: "curl https://api.openai.com/v1/chatkit/threads/cthr_abc123 \\\n  -H \"OpenAI-Beta: chatkit_beta=v1\" \\\n  -H \"Authorization: Bearer $OPENAI_API_KEY\"\n"
            javascript: 'import OpenAI from ''openai'';


              const client = new OpenAI();


              const chatkitThread = await client.beta.chatkit.threads.retrieve(''cthr_123'');


              console.log(chatkitThread.id);

              '
            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)\nchatkit_thread = client.beta.chatkit.threads.retrieve(\n    \"cthr_123\",\n)\nprint(chatkit_thread.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\tchatkitThread, err := client.Beta.ChatKit.Threads.Get(context.TODO(), \"cthr_123\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", chatkitThread.ID)\n}\n"
            ruby: 'require "openai"


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


              chatkit_thread = openai.beta.chatkit.threads.retrieve("cthr_123")


              puts(chatkit_thread)'
            java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.beta.chatkit.threads.ChatKitThread;\nimport com.openai.models.beta.chatkit.threads.ThreadRetrieveParams;\n\npublic final class Main {\n    private Main() {}\n\n    public static void main(String[] args) {\n        OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n        ChatKitThread chatkitThread = client.beta().chatkit().threads().retrieve(\"cthr_123\");\n    }\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 chatkitThread = await client.beta.chatkit.threads.retrieve('cthr_123');\n\nconsole.log(chatkitThread.id);"
          response: "{\n  \"id\": \"cthr_abc123\",\n  \"object\": \"chatkit.thread\",\n  \"title\": \"Customer escalation\",\n  \"items\": {\n    \"data\": [\n      {\n        \"id\": \"cthi_user_001\",\n        \"object\": \"chatkit.thread_item\",\n        \"type\": \"user_message\",\n        \"content\": [\n          {\n            \"type\": \"input_text\",\n            \"text\": \"I need help debugging an onboarding issue.\"\n          }\n        ],\n        \"attachments\": []\n      },\n      {\n        \"id\": \"cthi_assistant_002\",\n        \"object\": \"chatkit.thread_item\",\n        \"type\": \"assistant_message\",\n        \"content\": [\n          {\n            \"type\": \"output_text\",\n            \"text\": \"Let's start by confirming the workflow version you deployed.\"\n          }\n        ]\n      }\n    ],\n    \"has_more\": false\n  }\n}\n"
      tags:
      - Chatkit
    delete:
      summary: Delete a ChatKit thread along with its items and stored attachments.
      operationId: DeleteThreadMethod
      parameters:
      - name: thread_id
        in: path
        description: Identifier of the ChatKit thread to delete.
        required: true
        schema:
          example: cthr_123
          type: string
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeletedThreadResource'
      x-oaiMeta:
        beta: true
        examples:
          response: ''
          request:
            javascript: 'import OpenAI from ''openai'';


              const client = new OpenAI();


              const thread = await client.beta.chat_kit.threads.delete(''cthr_123'');


              console.log(thread.id);

              '
            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)\nthread = client.beta.chatkit.threads.delete(\n    \"cthr_123\",\n)\nprint(thread.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\tthread, err := client.Beta.ChatKit.Threads.Delete(context.TODO(), \"cthr_123\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", thread.ID)\n}\n"
            ruby: 'require "openai"


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


              thread = openai.beta.chatkit.threads.delete("cthr_123")


              puts(thread)'
            java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.beta.chatkit.threads.ThreadDeleteParams;\nimport com.openai.models.beta.chatkit.threads.ThreadDeleteResponse;\n\npublic final class Main {\n    private Main() {}\n\n    public static void main(String[] args) {\n        OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n        ThreadDeleteResponse thread = client.beta().chatkit().threads().delete(\"cthr_123\");\n    }\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 thread = await client.beta.chatkit.threads.delete('cthr_123');\n\nconsole.log(thread.id);"
        name: Delete ChatKit thread
        group: chatkit
        path: threads/delete
      tags:
      - Chatkit
  /chatkit/threads:
    get:
      summary: List ChatKit threads with optional pagination and user filters.
      operationId: ListThreadsMethod
      parameters:
      - name: limit
        in: query
        description: Maximum number of thread items to return. Defaults to 20.
        required: false
        schema:
          type: integer
          minimum: 0
          maximum: 100
      - name: order
        in: query
        description: Sort order for results by creation time. Defaults to `desc`.
        required: false
        schema:
          $ref: '#/components/schemas/OrderEnum'
      - name: after
        in: query
        description: List items created after this thread item ID. Defaults to null for the first page.
        required: false
        schema:
          description: List items created after this thread item ID. Defaults to null for the first page.
          type: string
      - name: before
        in: query
        description: List items created before this thread item ID. Defaults to null for the newest results.
        required: false
        schema:
          description: List items created before this thread item ID. Defaults to null for the newest results.
          type: string
      - name: user
        in: query
        description: Filter threads that belong to this user identifier. Defaults to null to return all users.
        required: false
        schema:
          description: Filter threads that belong to this user identifier. Defaults to null to return all users.
          type: string
          minLength: 1
          maxLength: 512
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ThreadListResource'
      x-oaiMeta:
        name: List ChatKit threads
        group: chatkit
        beta: true
        path: list-threads scope.
        examples:
          request:
            curl: "curl \"https://api.openai.com/v1/chatkit/threads?limit=2&order=desc\" \\\n  -H \"OpenAI-Beta: chatkit_beta=v1\" \\\n  -H \"Authorization: Bearer $OPENAI_API_KEY\"\n"
            javascript: "import OpenAI from 'openai';\n\nconst client = new OpenAI();\n\n// Automatically fetches more pages as needed.\nfor await (const chatkitThread of client.beta.chatkit.threads.list()) {\n  console.log(chatkitThread.id);\n}\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)\npage = client.beta.chatkit.threads.list()\npage = page.data[0]\nprint(page.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\tpage, err := client.Beta.ChatKit.Threads.List(context.TODO(), openai.BetaChatKitThreadListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n"
            ruby: 'require "openai"


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


              page = openai.beta.chatkit.threads.list


              puts(page)'
            java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.beta.chatkit.threads.ThreadListPage;\nimport com.openai.models.beta.chatkit.threads.ThreadListParams;\n\npublic final class Main {\n    private Main() {}\n\n    public static void main(String[] args) {\n        OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n        ThreadListPage page = client.beta().chatkit().threads().list();\n    }\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 chatkitThread of client.beta.chatkit.threads.list()) {\n  console.log(chatkitThread.id);\n}"
          response: "{\n  \"data\": [\n    {\n      \"id\": \"cthr_abc123\",\n      \"object\": \"chatkit.thread\",\n      \"title\": \"Customer escalation\"\n    },\n    {\n      \"id\": \"cthr_def456\",\n      \"object\": \"chatkit.thread\",\n      \"title\": \"Demo feedback\"\n    }\n  ],\n  \"has_more\": false,\n  \"object\": \"list\"\n}\n"
      tags:
      - Chatkit
components:
  schemas:
    AutomaticThreadTitlingParam:
      properties:
        enabled:
          type: boolean
          description: Enable automatic thread title generation. Defaults to true.
      type: object
      required: []
      title: Automatic thread titling configuration
      description: Controls whether ChatKit automatically generates thread titles.
    ChatSessionStatus:
      type: string
      enum:
      - active
      - expired
      - cancelled
    ClientToolCallStatus:
      type: string
      enum:
      - in_progress
      - completed
    UserMessageItem:
      properties:
        id:
          type: string
          description: Identifier of the thread item.
        object:
          type: string
          enum:
          - chatkit.thread_item
          description: Type discriminator that is always `chatkit.thread_item`.
          default: chatkit.thread_item
          x-stainless-const: true
        created_at:
          type: integer
          format: unixtime
          description: Unix timestamp (in seconds) for when the item was created.
        thread_id:
          type: string
          description: Identifier of the parent thread.
        type:
          type: string
          enum:
          - chatkit.user_message
          default: chatkit.user_message
          x-stainless-const: true
        content:
          items:
            oneOf:
            - $ref: '#/components/schemas/UserMessageInputText'
            - $ref: '#/components/schemas/UserMessageQuotedText'
            description: Content blocks that comprise a user message.
            discriminator:
              propertyName: type
          type: array
          description: Ordered content elements supplied by the user.
        attachments:
          items:
            $ref: '#/components/schemas/Attachment'
          type: array
          description: Attachments associated with the user message. Defaults to an empty list.
        inference_options:
          anyOf:
          - $ref: '#/components/schemas/InferenceOptions'
            description: Inference overrides applied to the message. Defaults to null when unset.
          - type: 'null'
      type: object
      required:
      - id
      - object
      - created_at
      - thread_id
      - type
      - content
      - attachments
      - inference_options
      title: User Message Item
      description: User-authored messages within a thread.
    AssistantMessageItem:
      properties:
        id:
          type: string
          description: Identifier of the thread item.
        object:
          type: string
          enum:
          - chatkit.thread_item
          description: Type discriminator that is always `chatkit.thread_item`.
          default: chatkit.thread_item
          x-stainless-const: true
        created_at:
          type: integer
          format: unixtime
          description: Unix timestamp (in seconds) for when the item was created.
        thread_id:
          type: string
          description: Identifier of the parent thread.
        type:
          type: string
          enum:
          - chatkit.assistant_message
          description: Type discriminator that is always `chatkit.assistant_message`.
          default: chatkit.assistant_message
          x-stainless-const: true
        content:
          items:
            $ref: '#/components/schemas/ResponseOutputText'
          type: array
          description: Ordered assistant response segments.
      type: object
      required:
      - id
      - object
      - created_at
      - thread_id
      - type
      - content
      title: Assistant message
      description: Assistant-authored message within a thread.
    CreateChatSessionBody:
      properties:
        workflow:
          $ref: '#/components/schemas/WorkflowParam'
          description: Workflow that powers the session.
        user:
          type: string
          minLength: 1
          description: A free-form string that identifies your end user; ensures this Session can access other objects that have the same `user` scope.
        expires_after:
          $ref: '#/components/schemas/ExpiresAfterParam'
          description: Optional override for session expiration timing in seconds from creation. Defaults to 10 minutes.
        rate_limits:
          $ref: '#/components/schemas/RateLimitsParam'
          description: Optional override for per-minute request limits. When omitted, defaults to 10.
        chatkit_configuration:
          $ref: '#/components/schemas/ChatkitConfigurationParam'
          description: Optional overrides for ChatKit runtime configuration features
      type: object
      required:
      - workflow
      - user
      title: Create chat session request
      description: Parameters for provisioning a new ChatKit session.
    TaskGroupTask:
      properties:
        type:
          $ref: '#/components/schemas/TaskType'
          description: Subtype for the grouped task.
        heading:
          anyOf:
          - type: string
            description: Optional heading for the grouped task. Defaults to null when not provided.
          - type: 'null'
        summary:
          anyOf:
          - type: string
            description: Optional summary that describes the grouped task. Defaults to null when omitted.
          - type: 'null'
      type: object
      required:
      - type
      - heading
      - summary
      title: Task group task
      description: Task entry that appears within a TaskGroup.
    ResponseOutputText:
      properties:
        type:
          type: string
          enum:
          - output_text
          description: Type discriminator that is always `output_text`.
          default: output_text
          x-stainless-const: true
        text:
          type: string
          description: Assistant generated text.
        annotations:
          items:
            oneOf:
            - $ref: '#/components/schemas/FileAnnotation'
            - $ref: '#/components/schemas/UrlAnnotation'
            description: Annotation object describing a cited source.
            discriminator:
              propertyName: type
          type: array
          description: Ordered list of annotations attached to the response text.
      type: object
      required:
      - type
      - text
      - annotations
      title: Assistant message content
      description: Assistant response text accompanied by optional annotations.
    ChatSessionHistory:
      properties:
        enabled:
          type: boolean
          description: Indicates if chat history is persisted for the session.
        recent_threads:
          anyOf:
          - type: integer
            description: Number of prior threads surfaced in history views. Defaults to null when all history is retained.
          - type: 'null'
      type: object
      required:
      - enabled
      - recent_threads
      title: History settings
      description: History retention preferences returned for the session.
    ExpiresAfterParam:
      properties:
        anchor:
          type: string
          enum:
          - created_at
          description: Base timestamp used to calculate expiration. Currently fixed to `created_at`.
          default: created_at
          x-stainless-const: true
        seconds:
          type: integer
          maximum: 600
          minimum: 1
          format: int64
          description: Number of seconds after the anchor when the session expires.
      type: object
      required:
      - anchor
      - seconds
      title: Expiration overrides
      description: Controls when the session expires relative to an anchor timestamp.
    ClientToolCallItem:
      properties:
        id:
          type: string
          description: Identifier of the thread item.
        object:
          type: string
          enum:
          - chatkit.thread_item
          description: Type discriminator that is always `chatkit.thread_item`.
          default: chatkit.thread_item
          x-stainless-const: true
        created_at:
          type: integer
          format: unixtime
          description: Unix timestamp (in seconds) for when the item was created.
        thread_id:
          type: string
          description: Identifier of the parent thread.
        type:
          type: string
          enum:
          - chatkit.client_tool_call
          description: Type discriminator that is always `chatkit.client_tool_call`.
          default: chatkit.client_tool_call
          x-stainless-const: true
        status:
          $ref: '#/components/schemas/ClientToolCallStatus'
          description: Execution status for the tool call.
        call_id:
          type: string
 

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