openapi: 3.0.0 info: title: OpenAI Assistants Group users API description: The Assistants API allows you to build AI assistants within your own applications. An Assistant has instructions and can leverage models, tools, and knowledge to respond to user queries. The Assistants API currently supports three types of tools - Code Interpreter, Retrieval, and Function calling. In the future, we plan to release more OpenAI-built tools, and allow you to provide your own tools on our platform. version: 2.0.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: Group users paths: /organization/groups/{group_id}/users: get: security: - AdminApiKeyAuth: [] summary: Lists the users assigned to a group. operationId: list-group-users tags: - Group users parameters: - name: group_id in: path description: The ID of the group to inspect. required: true schema: type: string - name: limit in: query description: 'A limit on the number of users to be returned. Limit can range between 0 and 1000, and the default is 100. ' required: false schema: type: integer minimum: 0 maximum: 1000 default: 100 - name: after in: query description: 'A cursor for use in pagination. Provide the ID of the last user from the previous list response to retrieve the next page. ' required: false schema: type: string - name: order in: query description: Specifies the sort order of users in the list. required: false schema: type: string enum: - asc - desc default: desc responses: '200': description: Group users listed successfully. content: application/json: schema: $ref: '#/components/schemas/UserListResource' x-oaiMeta: name: List group users group: administration examples: request: curl: "curl https://api.openai.com/v1/organization/groups/group_01J1F8ABCDXYZ/users?limit=20 \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\"\n" node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted\n});\n\n// Automatically fetches more pages as needed.\nfor await (const organizationGroupUser of client.admin.organization.groups.users.list('group_id')) {\n console.log(organizationGroupUser.id);\n}" python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n admin_api_key=os.environ.get(\"OPENAI_ADMIN_KEY\"), # This is the default and can be omitted\n)\npage = client.admin.organization.groups.users.list(\n group_id=\"group_id\",\n)\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.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tpage, err := client.Admin.Organization.Groups.Users.List(\n\t\tcontext.TODO(),\n\t\t\"group_id\",\n\t\topenai.AdminOrganizationGroupUserListParams{},\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.admin.organization.groups.users.UserListPage;\nimport com.openai.models.admin.organization.groups.users.UserListParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n UserListPage page = client.admin().organization().groups().users().list(\"group_id\");\n }\n}" ruby: 'require "openai" openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") page = openai.admin.organization.groups.users.list("group_id") puts(page)' response: "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"user_abc123\",\n \"name\": \"Ada Lovelace\",\n \"email\": \"ada@example.com\"\n }\n ],\n \"has_more\": false,\n \"next\": null\n}\n" post: security: - AdminApiKeyAuth: [] summary: Adds a user to a group. operationId: add-group-user tags: - Group users parameters: - name: group_id in: path description: The ID of the group to update. required: true schema: type: string requestBody: description: Identifies the user that should be added to the group. required: true content: application/json: schema: $ref: '#/components/schemas/CreateGroupUserBody' responses: '200': description: User added to the group successfully. content: application/json: schema: $ref: '#/components/schemas/GroupUserAssignment' x-oaiMeta: name: Add group user group: administration examples: request: curl: "curl -X POST https://api.openai.com/v1/organization/groups/group_01J1F8ABCDXYZ/users \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"user_id\": \"user_abc123\"\n }'\n" node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted\n});\n\nconst user = await client.admin.organization.groups.users.create('group_id', {\n user_id: 'user_id',\n});\n\nconsole.log(user.group_id);" python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n admin_api_key=os.environ.get(\"OPENAI_ADMIN_KEY\"), # This is the default and can be omitted\n)\nuser = client.admin.organization.groups.users.create(\n group_id=\"group_id\",\n user_id=\"user_id\",\n)\nprint(user.group_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.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tuser, err := client.Admin.Organization.Groups.Users.New(\n\t\tcontext.TODO(),\n\t\t\"group_id\",\n\t\topenai.AdminOrganizationGroupUserNewParams{\n\t\t\tUserID: \"user_id\",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", user.GroupID)\n}\n" java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.admin.organization.groups.users.UserCreateParams;\nimport com.openai.models.admin.organization.groups.users.UserCreateResponse;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n UserCreateParams params = UserCreateParams.builder()\n .groupId(\"group_id\")\n .userId(\"user_id\")\n .build();\n UserCreateResponse user = client.admin().organization().groups().users().create(params);\n }\n}" ruby: 'require "openai" openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") user = openai.admin.organization.groups.users.create("group_id", user_id: "user_id") puts(user)' response: "{\n \"object\": \"group.user\",\n \"user_id\": \"user_abc123\",\n \"group_id\": \"group_01J1F8ABCDXYZ\"\n}\n" /organization/groups/{group_id}/users/{user_id}: delete: security: - AdminApiKeyAuth: [] summary: Removes a user from a group. operationId: remove-group-user tags: - Group users parameters: - name: group_id in: path description: The ID of the group to update. required: true schema: type: string - name: user_id in: path description: The ID of the user to remove from the group. required: true schema: type: string responses: '200': description: User removed from the group successfully. content: application/json: schema: $ref: '#/components/schemas/GroupUserDeletedResource' x-oaiMeta: name: Remove group user group: administration examples: request: curl: "curl -X DELETE https://api.openai.com/v1/organization/groups/group_01J1F8ABCDXYZ/users/user_abc123 \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\"\n" node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted\n});\n\nconst user = await client.admin.organization.groups.users.delete('user_id', {\n group_id: 'group_id',\n});\n\nconsole.log(user.deleted);" python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n admin_api_key=os.environ.get(\"OPENAI_ADMIN_KEY\"), # This is the default and can be omitted\n)\nuser = client.admin.organization.groups.users.delete(\n user_id=\"user_id\",\n group_id=\"group_id\",\n)\nprint(user.deleted)" 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.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tuser, err := client.Admin.Organization.Groups.Users.Delete(\n\t\tcontext.TODO(),\n\t\t\"group_id\",\n\t\t\"user_id\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", user.Deleted)\n}\n" java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.admin.organization.groups.users.UserDeleteParams;\nimport com.openai.models.admin.organization.groups.users.UserDeleteResponse;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n UserDeleteParams params = UserDeleteParams.builder()\n .groupId(\"group_id\")\n .userId(\"user_id\")\n .build();\n UserDeleteResponse user = client.admin().organization().groups().users().delete(params);\n }\n}" ruby: 'require "openai" openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") user = openai.admin.organization.groups.users.delete("user_id", group_id: "group_id") puts(user)' response: "{\n \"object\": \"group.user.deleted\",\n \"deleted\": true\n}\n" components: schemas: CreateGroupUserBody: type: object description: Request payload for adding a user to a group. properties: user_id: type: string description: Identifier of the user to add to the group. required: - user_id x-oaiMeta: example: "{\n \"user_id\": \"user_abc123\"\n}\n" GroupUserAssignment: type: object description: Confirmation payload returned after adding a user to a group. properties: object: type: string enum: - group.user description: Always `group.user`. x-stainless-const: true user_id: type: string description: Identifier of the user that was added. group_id: type: string description: Identifier of the group the user was added to. required: - object - user_id - group_id x-oaiMeta: name: The group user object example: "{\n \"object\": \"group.user\",\n \"user_id\": \"user_abc123\",\n \"group_id\": \"group_01J1F8ABCDXYZ\"\n}\n" GroupUser: type: object description: Represents an individual user returned when inspecting group membership. properties: id: type: string description: The identifier, which can be referenced in API endpoints name: type: string description: The name of the user. email: anyOf: - type: string - type: 'null' description: The email address of the user. required: - id - name - email GroupUserDeletedResource: type: object description: Confirmation payload returned after removing a user from a group. properties: object: type: string enum: - group.user.deleted description: Always `group.user.deleted`. x-stainless-const: true deleted: type: boolean description: Whether the group membership was removed. required: - object - deleted x-oaiMeta: name: Group user deletion confirmation example: "{\n \"object\": \"group.user.deleted\",\n \"deleted\": true\n}\n" UserListResource: type: object description: Paginated list of user objects returned when inspecting group membership. properties: object: type: string enum: - list description: Always `list`. x-stainless-const: true data: type: array description: Users in the current page. items: $ref: '#/components/schemas/GroupUser' has_more: type: boolean description: Whether more users are available when paginating. next: description: Cursor to fetch the next page of results, or `null` when no further users are available. anyOf: - type: string - type: 'null' required: - object - data - has_more - next x-oaiMeta: name: Group user list example: "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"user_abc123\",\n \"name\": \"Ada Lovelace\",\n \"email\": \"ada@example.com\"\n }\n ],\n \"has_more\": false,\n \"next\": null\n}\n" securitySchemes: ApiKeyAuth: type: http scheme: bearer x-oaiMeta: groups: - id: audio title: Audio description: 'Learn how to turn audio into text or text into audio. Related guide: [Speech to text](/docs/guides/speech-to-text) ' sections: - type: endpoint key: createSpeech path: createSpeech - type: endpoint key: createTranscription path: createTranscription - type: endpoint key: createTranslation path: createTranslation - id: chat title: Chat description: 'Given a list of messages comprising a conversation, the model will return a response. Related guide: [Chat Completions](/docs/guides/text-generation) ' sections: - type: endpoint key: createChatCompletion path: create - type: object key: CreateChatCompletionResponse path: object - type: object key: CreateChatCompletionStreamResponse path: streaming - id: embeddings title: Embeddings description: 'Get a vector representation of a given input that can be easily consumed by machine learning models and algorithms. Related guide: [Embeddings](/docs/guides/embeddings) ' sections: - type: endpoint key: createEmbedding path: create - type: object key: Embedding path: object - id: fine-tuning title: Fine-tuning description: 'Manage fine-tuning jobs to tailor a model to your specific training data. Related guide: [Fine-tune models](/docs/guides/fine-tuning) ' sections: - type: endpoint key: createFineTuningJob path: create - type: endpoint key: listPaginatedFineTuningJobs path: list - type: endpoint key: listFineTuningEvents path: list-events - type: endpoint key: retrieveFineTuningJob path: retrieve - type: endpoint key: cancelFineTuningJob path: cancel - type: object key: FineTuningJob path: object - type: object key: FineTuningJobEvent path: event-object - id: files title: Files description: 'Files are used to upload documents that can be used with features like [Assistants](/docs/api-reference/assistants) and [Fine-tuning](/docs/api-reference/fine-tuning). ' sections: - type: endpoint key: createFile path: create - type: endpoint key: listFiles path: list - type: endpoint key: retrieveFile path: retrieve - type: endpoint key: deleteFile path: delete - type: endpoint key: downloadFile path: retrieve-contents - type: object key: OpenAIFile path: object - id: images title: Images description: 'Given a prompt and/or an input image, the model will generate a new image. Related guide: [Image generation](/docs/guides/images) ' sections: - type: endpoint key: createImage path: create - type: endpoint key: createImageEdit path: createEdit - type: endpoint key: createImageVariation path: createVariation - type: object key: Image path: object - id: models title: Models description: 'List and describe the various models available in the API. You can refer to the [Models](/docs/models) documentation to understand what models are available and the differences between them. ' sections: - type: endpoint key: listModels path: list - type: endpoint key: retrieveModel path: retrieve - type: endpoint key: deleteModel path: delete - type: object key: Model path: object - id: moderations title: Moderations description: 'Given a input text, outputs if the model classifies it as violating OpenAI''s content policy. Related guide: [Moderations](/docs/guides/moderation) ' sections: - type: endpoint key: createModeration path: create - type: object key: CreateModerationResponse path: object - id: assistants title: Assistants beta: true description: 'Build assistants that can call models and use tools to perform tasks. [Get started with the Assistants API](/docs/assistants) ' sections: - type: endpoint key: createAssistant path: createAssistant - type: endpoint key: createAssistantFile path: createAssistantFile - type: endpoint key: listAssistants path: listAssistants - type: endpoint key: listAssistantFiles path: listAssistantFiles - type: endpoint key: getAssistant path: getAssistant - type: endpoint key: getAssistantFile path: getAssistantFile - type: endpoint key: modifyAssistant path: modifyAssistant - type: endpoint key: deleteAssistant path: deleteAssistant - type: endpoint key: deleteAssistantFile path: deleteAssistantFile - type: object key: AssistantObject path: object - type: object key: AssistantFileObject path: file-object - id: threads title: Threads beta: true description: 'Create threads that assistants can interact with. Related guide: [Assistants](/docs/assistants/overview) ' sections: - type: endpoint key: createThread path: createThread - type: endpoint key: getThread path: getThread - type: endpoint key: modifyThread path: modifyThread - type: endpoint key: deleteThread path: deleteThread - type: object key: ThreadObject path: object - id: messages title: Messages beta: true description: 'Create messages within threads Related guide: [Assistants](/docs/assistants/overview) ' sections: - type: endpoint key: createMessage path: createMessage - type: endpoint key: listMessages path: listMessages - type: endpoint key: listMessageFiles path: listMessageFiles - type: endpoint key: getMessage path: getMessage - type: endpoint key: getMessageFile path: getMessageFile - type: endpoint key: modifyMessage path: modifyMessage - type: object key: MessageObject path: object - type: object key: MessageFileObject path: file-object - id: runs title: Runs beta: true description: 'Represents an execution run on a thread. Related guide: [Assistants](/docs/assistants/overview) ' sections: - type: endpoint key: createRun path: createRun - type: endpoint key: createThreadAndRun path: createThreadAndRun - type: endpoint key: listRuns path: listRuns - type: endpoint key: listRunSteps path: listRunSteps - type: endpoint key: getRun path: getRun - type: endpoint key: getRunStep path: getRunStep - type: endpoint key: modifyRun path: modifyRun - type: endpoint key: submitToolOuputsToRun path: submitToolOutputs - type: endpoint key: cancelRun path: cancelRun - type: object key: RunObject path: object - type: object key: RunStepObject path: step-object - id: completions title: Completions legacy: true description: 'Given a prompt, the model will return one or more predicted completions along with the probabilities of alternative tokens at each position. Most developer should use our [Chat Completions API](/docs/guides/text-generation/text-generation-models) to leverage our best and newest models. Most models that support the legacy Completions endpoint [will be shut off on January 4th, 2024](/docs/deprecations/2023-07-06-gpt-and-embeddings). ' sections: - type: endpoint key: createCompletion path: create - type: object key: CreateCompletionResponse path: object