Skip to content
Primary navigation

Add project group

admin.organization.projects.groups.create(strproject_id, GroupCreateParams**kwargs) -> ProjectGroup
POST/organization/projects/{project_id}/groups

Grants a group access to a project.

ParametersExpand Collapse
project_id: str
group_id: str

Identifier of the group to add to the project.

role: str

Identifier of the project role to grant to the group.

ReturnsExpand Collapse
class ProjectGroup: …

Details about a group’s membership in a project.

created_at: int

Unix timestamp (in seconds) when the group was granted project access.

formatunixtime
group_id: str

Identifier of the group that has access to the project.

group_name: str

Display name of the group.

group_type: str

The type of the group.

object: Literal["project.group"]

Always project.group.

project_id: str

Identifier of the project.

Add project group

import os
from openai import OpenAI

client = OpenAI(
    admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"),  # This is the default and can be omitted
)
project_group = client.admin.organization.projects.groups.create(
    project_id="project_id",
    group_id="group_id",
    role="role",
)
print(project_group.group_id)
{
    "object": "project.group",
    "project_id": "proj_abc123",
    "group_id": "group_01J1F8ABCDXYZ",
    "group_name": "Support Team",
    "created_at": 1711471533
}
Returns Examples
{
    "object": "project.group",
    "project_id": "proj_abc123",
    "group_id": "group_01J1F8ABCDXYZ",
    "group_name": "Support Team",
    "created_at": 1711471533
}