Skip to content
Primary navigation

Update organization role

client.Admin.Organization.Roles.Update(ctx, roleID, body) (*Role, error)
POST/organization/roles/{role_id}

Updates an existing organization role.

ParametersExpand Collapse
roleID string
body AdminOrganizationRoleUpdateParams
Description param.Field[string]Optional

New description for the role.

Permissions param.Field[[]string]Optional

Updated set of permissions for the role.

RoleName param.Field[string]Optional

New name for the role.

ReturnsExpand Collapse
type Role struct{…}

Details about a role that can be assigned through the public Roles API.

ID string

Identifier for the role.

Description string

Optional description of the role.

Name string

Unique name for the role.

Object Role

Always role.

Permissions []string

Permissions granted by the role.

PredefinedRole bool

Whether the role is predefined and managed by OpenAI.

ResourceType string

Resource type the role is bound to (for example api.organization or api.project).

Update organization role

package main

import (
  "context"
  "fmt"

  "github.com/openai/openai-go"
  "github.com/openai/openai-go/option"
)

func main() {
  client := openai.NewClient(
    option.WithAdminAPIKey("My Admin API Key"),
  )
  role, err := client.Admin.Organization.Roles.Update(
    context.TODO(),
    "role_id",
    openai.AdminOrganizationRoleUpdateParams{

    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", role.ID)
}
{
    "object": "role",
    "id": "role_01J1F8ROLE01",
    "name": "API Group Manager",
    "description": "Allows managing organization groups",
    "permissions": [
        "api.groups.read",
        "api.groups.write"
    ],
    "resource_type": "api.organization",
    "predefined_role": false
}
Returns Examples
{
    "object": "role",
    "id": "role_01J1F8ROLE01",
    "name": "API Group Manager",
    "description": "Allows managing organization groups",
    "permissions": [
        "api.groups.read",
        "api.groups.write"
    ],
    "resource_type": "api.organization",
    "predefined_role": false
}