openapi: 3.0.0
info:
title: OpenAI Assistants Project groups 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: Project groups
paths:
/organization/projects/{project_id}/groups:
get:
security:
- AdminApiKeyAuth: []
summary: Lists the groups that have access to a project.
operationId: list-project-groups
tags:
- Project groups
parameters:
- name: project_id
in: path
description: The ID of the project to inspect.
required: true
schema:
type: string
- name: limit
in: query
description: A limit on the number of project groups to return. Defaults to 20.
required: false
schema:
type: integer
minimum: 0
maximum: 100
default: 20
- name: after
in: query
description: Cursor for pagination. Provide the ID of the last group from the previous response to fetch the next page.
required: false
schema:
type: string
- name: order
in: query
description: Sort order for the returned groups.
required: false
schema:
type: string
enum:
- asc
- desc
default: asc
responses:
'200':
description: Project groups listed successfully.
content:
application/json:
schema:
$ref: '#/components/schemas/ProjectGroupListResource'
x-oaiMeta:
name: List project groups
group: administration
examples:
request:
curl: "curl https://api.openai.com/v1/organization/projects/proj_abc123/groups?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 projectGroup of client.admin.organization.projects.groups.list('project_id')) {\n console.log(projectGroup.group_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.projects.groups.list(\n project_id=\"project_id\",\n)\npage = page.data[0]\nprint(page.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\tpage, err := client.Admin.Organization.Projects.Groups.List(\n\t\tcontext.TODO(),\n\t\t\"project_id\",\n\t\topenai.AdminOrganizationProjectGroupListParams{},\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.projects.groups.GroupListPage;\nimport com.openai.models.admin.organization.projects.groups.GroupListParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n GroupListPage page = client.admin().organization().projects().groups().list(\"project_id\");\n }\n}"
ruby: 'require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
page = openai.admin.organization.projects.groups.list("project_id")
puts(page)'
response: "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": \"project.group\",\n \"project_id\": \"proj_abc123\",\n \"group_id\": \"group_01J1F8ABCDXYZ\",\n \"group_name\": \"Support Team\",\n \"created_at\": 1711471533\n }\n ],\n \"has_more\": false,\n \"next\": null\n}\n"
post:
security:
- AdminApiKeyAuth: []
summary: Grants a group access to a project.
operationId: add-project-group
tags:
- Project groups
parameters:
- name: project_id
in: path
description: The ID of the project to update.
required: true
schema:
type: string
requestBody:
description: Identifies the group and role to assign to the project.
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/InviteProjectGroupBody'
responses:
'200':
description: Group granted access to the project successfully.
content:
application/json:
schema:
$ref: '#/components/schemas/ProjectGroup'
x-oaiMeta:
name: Add project group
group: administration
examples:
request:
curl: "curl -X POST https://api.openai.com/v1/organization/projects/proj_abc123/groups \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"group_id\": \"group_01J1F8ABCDXYZ\",\n \"role\": \"role_01J1F8PROJ\"\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 projectGroup = await client.admin.organization.projects.groups.create('project_id', {\n group_id: 'group_id',\n role: 'role',\n});\n\nconsole.log(projectGroup.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)\nproject_group = client.admin.organization.projects.groups.create(\n project_id=\"project_id\",\n group_id=\"group_id\",\n role=\"role\",\n)\nprint(project_group.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\tprojectGroup, err := client.Admin.Organization.Projects.Groups.New(\n\t\tcontext.TODO(),\n\t\t\"project_id\",\n\t\topenai.AdminOrganizationProjectGroupNewParams{\n\t\t\tGroupID: \"group_id\",\n\t\t\tRole: \"role\",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", projectGroup.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.projects.groups.GroupCreateParams;\nimport com.openai.models.admin.organization.projects.groups.ProjectGroup;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n GroupCreateParams params = GroupCreateParams.builder()\n .projectId(\"project_id\")\n .groupId(\"group_id\")\n .role(\"role\")\n .build();\n ProjectGroup projectGroup = client.admin().organization().projects().groups().create(params);\n }\n}"
ruby: 'require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
project_group = openai.admin.organization.projects.groups.create("project_id", group_id: "group_id", role: "role")
puts(project_group)'
response: "{\n \"object\": \"project.group\",\n \"project_id\": \"proj_abc123\",\n \"group_id\": \"group_01J1F8ABCDXYZ\",\n \"group_name\": \"Support Team\",\n \"created_at\": 1711471533\n}\n"
/organization/projects/{project_id}/groups/{group_id}:
delete:
security:
- AdminApiKeyAuth: []
summary: Revokes a group's access to a project.
operationId: remove-project-group
tags:
- Project groups
parameters:
- name: project_id
in: path
description: The ID of the project to update.
required: true
schema:
type: string
- name: group_id
in: path
description: The ID of the group to remove from the project.
required: true
schema:
type: string
responses:
'200':
description: Group removed from the project successfully.
content:
application/json:
schema:
$ref: '#/components/schemas/ProjectGroupDeletedResource'
x-oaiMeta:
name: Remove project group
group: administration
examples:
request:
curl: "curl -X DELETE https://api.openai.com/v1/organization/projects/proj_abc123/groups/group_01J1F8ABCDXYZ \\\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 group = await client.admin.organization.projects.groups.delete('group_id', {\n project_id: 'project_id',\n});\n\nconsole.log(group.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)\ngroup = client.admin.organization.projects.groups.delete(\n group_id=\"group_id\",\n project_id=\"project_id\",\n)\nprint(group.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\tgroup, err := client.Admin.Organization.Projects.Groups.Delete(\n\t\tcontext.TODO(),\n\t\t\"project_id\",\n\t\t\"group_id\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", group.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.projects.groups.GroupDeleteParams;\nimport com.openai.models.admin.organization.projects.groups.GroupDeleteResponse;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n GroupDeleteParams params = GroupDeleteParams.builder()\n .projectId(\"project_id\")\n .groupId(\"group_id\")\n .build();\n GroupDeleteResponse group = client.admin().organization().projects().groups().delete(params);\n }\n}"
ruby: 'require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
group = openai.admin.organization.projects.groups.delete("group_id", project_id: "project_id")
puts(group)'
response: "{\n \"object\": \"project.group.deleted\",\n \"deleted\": true\n}\n"
components:
schemas:
ProjectGroupDeletedResource:
type: object
description: Confirmation payload returned after removing a group from a project.
properties:
object:
type: string
enum:
- project.group.deleted
description: Always `project.group.deleted`.
x-stainless-const: true
deleted:
type: boolean
description: Whether the group membership in the project was removed.
required:
- object
- deleted
x-oaiMeta:
name: Project group deletion confirmation
example: "{\n \"object\": \"project.group.deleted\",\n \"deleted\": true\n}\n"
InviteProjectGroupBody:
type: object
description: Request payload for granting a group access to a project.
properties:
group_id:
type: string
description: Identifier of the group to add to the project.
role:
type: string
description: Identifier of the project role to grant to the group.
required:
- group_id
- role
x-oaiMeta:
example: "{\n \"group_id\": \"group_01J1F8ABCDXYZ\",\n \"role\": \"role_01J1F8PROJ\"\n}\n"
ProjectGroup:
type: object
description: Details about a group's membership in a project.
properties:
object:
type: string
enum:
- project.group
description: Always `project.group`.
x-stainless-const: true
project_id:
type: string
description: Identifier of the project.
group_id:
type: string
description: Identifier of the group that has access to the project.
group_name:
type: string
description: Display name of the group.
group_type:
type: string
description: The type of the group.
created_at:
type: integer
format: unixtime
description: Unix timestamp (in seconds) when the group was granted project access.
required:
- object
- project_id
- group_id
- group_name
- group_type
- created_at
x-oaiMeta:
name: The project group object
example: "{\n \"object\": \"project.group\",\n \"project_id\": \"proj_abc123\",\n \"group_id\": \"group_01J1F8ABCDXYZ\",\n \"group_name\": \"Support Team\",\n \"group_type\": \"group\",\n \"created_at\": 1711471533\n}\n"
ProjectGroupListResource:
type: object
description: Paginated list of groups that have access to a project.
properties:
object:
type: string
enum:
- list
description: Always `list`.
x-stainless-const: true
data:
type: array
description: Project group memberships returned in the current page.
items:
$ref: '#/components/schemas/ProjectGroup'
has_more:
type: boolean
description: Whether additional project group memberships are available.
next:
description: Cursor to fetch the next page of results, or `null` when there are no more results.
anyOf:
- type: string
- type: 'null'
required:
- object
- data
- has_more
- next
x-oaiMeta:
name: Project group list
example: "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": \"project.group\",\n \"project_id\": \"proj_abc123\",\n \"group_id\": \"group_01J1F8ABCDXYZ\",\n \"group_name\": \"Support Team\",\n \"created_at\": 1711471533\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