Claude Platform Docs

Benutzer aktualisieren

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

Aktualisiert die Organisationsrolle eines Mitglieds.

Parameters
userID string⁠Path parameter

ID of the User.

body OrganizationUserUpdateParams

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; changing a User's role to managed requires the write:rbac_groups scope in addition to write:members.

const OrganizationUserUpdateParamsRoleBilling OrganizationUserUpdateParamsRole = "billing"
const OrganizationUserUpdateParamsRoleClaudeCodeUser OrganizationUserUpdateParamsRole = "claude_code_user"
const OrganizationUserUpdateParamsRoleDeveloper OrganizationUserUpdateParamsRole = "developer"
const OrganizationUserUpdateParamsRoleManaged OrganizationUserUpdateParamsRole = "managed"
const OrganizationUserUpdateParamsRoleUser OrganizationUserUpdateParamsRole = "user"
Returns
type OrganizationUser struct { Type: "user"; ID; AddedAt; /* 3 more */ }
Errors

Any method can also return the general HTTP errors.

ErrorCodeSandboxEgressRestrictedHTTP status 403error code sandbox_egress_restricted

The request came from a Claude sandbox with restricted network access, which is not allowed to make this request. Send it from outside the sandbox, or from a sandbox with unrestricted network access.

Benutzer aktualisieren
package main

import (
	"context"
	"fmt"

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

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