Claude Platform Docs

Update User

client.Beta.Organization.Users.Update(ctx, userID, body) (*BetaOrganizationUser, error)
POST/v1/organizations/users/{user_id}

Update a member's organization role.

Parameters
userID string

ID of the User.

body BetaOrganizationUserUpdateParams

New role for the User.

The accepted values depend on the organization type. Console and API organizations accept user, developer, billing, and claude_code_user; admin cannot be assigned through the API. Claude Enterprise organizations accept user and managed.

const BetaOrganizationUserUpdateParamsRoleBilling BetaOrganizationUserUpdateParamsRole = "billing"
const BetaOrganizationUserUpdateParamsRoleClaudeCodeUser BetaOrganizationUserUpdateParamsRole = "claude_code_user"
const BetaOrganizationUserUpdateParamsRoleDeveloper BetaOrganizationUserUpdateParamsRole = "developer"
const BetaOrganizationUserUpdateParamsRoleManaged BetaOrganizationUserUpdateParamsRole = "managed"
const BetaOrganizationUserUpdateParamsRoleUser BetaOrganizationUserUpdateParamsRole = "user"
Returns
type BetaOrganizationUser struct{…}

Update User

package main

import (
	"context"
	"fmt"

	"github.com/anthropics/anthropic-sdk-go"
	"github.com/anthropics/anthropic-sdk-go/option"
)

func main() {
	client := anthropic.NewClient(
		option.WithAPIKey("my-anthropic-api-key"),
	)
	betaOrganizationUser, err := client.Beta.Organization.Users.Update(
		context.TODO(),
		"user_id",
		anthropic.BetaOrganizationUserUpdateParams{
			Role: anthropic.BetaOrganizationUserUpdateParamsRoleUser,
		},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", betaOrganizationUser.ID)
}
{
  "id": "user_01WCz1FkmYMm4gnmykNKUu3Q",
  "added_at": "2024-10-30T23:58:27.427722Z",
  "email": "user@emaildomain.com",
  "name": "Jane Doe",
  "role": "admin",
  "type": "user"
}
Returns Examples
{
  "id": "user_01WCz1FkmYMm4gnmykNKUu3Q",
  "added_at": "2024-10-30T23:58:27.427722Z",
  "email": "user@emaildomain.com",
  "name": "Jane Doe",
  "role": "admin",
  "type": "user"
}