## Update User Claims

`client.Admin.Users.UpdateClaims(ctx, userID, body) (*UserClaims, error)`

**patch** `/api/v1/admin/users/{user_id}/claims`

Additively update a user's custom claims.

Claims in `set_claims` are added or overwritten; claims named in `remove_claims` are reset to their system default. Claims not referenced by either field are left unchanged, so a single claim can be changed without resending the full set. Returns the user's resolved claims after the update.

Returns 404 if the user does not exist.

Global admin only.

### Parameters

- `userID string`

- `body AdminUserUpdateClaimsParams`

  - `RemoveClaims param.Field[[]string]`

    Names of claims to reset to their system default.

    - `const AdminUserUpdateClaimsParamsRemoveClaimAllowOrgDeletion AdminUserUpdateClaimsParamsRemoveClaim = "allow_org_deletion"`

    - `const AdminUserUpdateClaimsParamsRemoveClaimAllowedOrgCreation AdminUserUpdateClaimsParamsRemoveClaim = "allowed_org_creation"`

    - `const AdminUserUpdateClaimsParamsRemoveClaimAPIDatasourceAccess AdminUserUpdateClaimsParamsRemoveClaim = "api_datasource_access"`

    - `const AdminUserUpdateClaimsParamsRemoveClaimMaximumOrgCreation AdminUserUpdateClaimsParamsRemoveClaim = "maximum_org_creation"`

  - `SetClaims param.Field[AdminUserUpdateClaimsParamsSetClaims]`

    A partial set of custom claims for additive updates.

    Every field is optional. Only the claims explicitly provided in a request
    are added or overwritten; claims left unset are not touched, so callers can
    change a single claim without resending the full claim set.

    - `AllowOrgDeletion bool`

      Whether the user is allowed to delete organizations.

    - `AllowedOrgCreation bool`

      Whether the user is allowed to create organizations.

    - `APIDatasourceAccess bool`

      Whether the user is allowed to access API data sources.

    - `MaximumOrgCreation int64`

      Cap on how many organizations this user may create. None means unlimited. Only enforced when allowed_org_creation is True.

### Returns

- `type UserClaims struct{…}`

  A user's fully resolved custom claims after applying system defaults.

  - `Claims CustomClaims`

    The user's resolved custom claims.

    - `AllowOrgDeletion bool`

      Whether the user is allowed to delete organizations.

    - `AllowedOrgCreation bool`

      Whether the user is allowed to create organizations.

    - `APIDatasourceAccess bool`

      Whether the user is allowed to access API data sources.

    - `MaximumOrgCreation int64`

      Cap on how many organizations this user may create. None means unlimited. Only enforced when allowed_org_creation is True.

  - `UserID string`

    The user ID the claims belong to.

### Example

```go
package main

import (
  "context"
  "fmt"

  "github.com/run-llama/llamacloud-admin-go"
  "github.com/run-llama/llamacloud-admin-go/option"
)

func main() {
  client := llamacloudadmin.NewClient(
    option.WithAPIKey("My API Key"),
  )
  userClaims, err := client.Admin.Users.UpdateClaims(
    context.TODO(),
    "user_id",
    llamacloudadmin.AdminUserUpdateClaimsParams{

    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", userClaims.UserID)
}
```

#### Response

```json
{
  "claims": {
    "allow_org_deletion": true,
    "allowed_org_creation": true,
    "api_datasource_access": true,
    "maximum_org_creation": 0
  },
  "user_id": "user_id"
}
```
