Skip to content
Primary navigation

Modify user

client.Admin.Organization.Users.Update(ctx, userID, body) (*OrganizationUser, error)
POST/organization/users/{user_id}

Modifies a user’s role in the organization.

ParametersExpand Collapse
userID string
body AdminOrganizationUserUpdateParams
DeveloperPersona param.Field[string]Optional

Developer persona metadata.

Role param.Field[string]Optional

owner or reader

RoleID param.Field[string]Optional

Role ID to assign to the user.

TechnicalLevel param.Field[string]Optional

Technical level metadata.

ReturnsExpand Collapse
type OrganizationUser struct{…}

Represents an individual user within an organization.

ID string

The identifier, which can be referenced in API endpoints

AddedAt int64

The Unix timestamp (in seconds) of when the user was added.

formatunixtime
Object OrganizationUser

The object type, which is always organization.user

APIKeyLastUsedAt int64Optional

The Unix timestamp (in seconds) of the user’s last API key usage.

formatunixtime
Created int64Optional

The Unix timestamp (in seconds) of when the user was created.

formatunixtime
DeveloperPersona stringOptional

The developer persona metadata for the user.

Email stringOptional

The email address of the user

IsDefault boolOptional

Whether this is the organization’s default user.

IsScaleTierAuthorizedPurchaser boolOptional

Whether the user is an authorized purchaser for Scale Tier.

IsScimManaged boolOptional

Whether the user is managed through SCIM.

IsServiceAccount boolOptional

Whether the user is a service account.

Name stringOptional

The name of the user

Projects OrganizationUserProjectsOptional

Projects associated with the user, if included.

Data []OrganizationUserProjectsData
ID stringOptional
Name stringOptional
Role stringOptional
Object List
Role stringOptional

owner or reader

TechnicalLevel stringOptional

The technical level metadata for the user.

User OrganizationUserUserOptional

Nested user details.

ID string
Object User
Banned boolOptional
BannedAt int64Optional
formatunixtime
Email stringOptional
Enabled boolOptional
Name stringOptional
Picture stringOptional

Modify user

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"),
  )
  organizationUser, err := client.Admin.Organization.Users.Update(
    context.TODO(),
    "user_id",
    openai.AdminOrganizationUserUpdateParams{

    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", organizationUser.ID)
}
{
    "object": "organization.user",
    "id": "user_abc",
    "name": "First Last",
    "email": "user@example.com",
    "role": "owner",
    "added_at": 1711471533
}
Returns Examples
{
    "object": "organization.user",
    "id": "user_abc",
    "name": "First Last",
    "email": "user@example.com",
    "role": "owner",
    "added_at": 1711471533
}