Skip to content
Product Docs

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.

ParametersExpand Collapse
userID string
body AdminUserUpdateClaimsParams
RemoveClaims param.Field[[]string]Optional

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]Optional

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 boolOptional

Whether the user is allowed to delete organizations.

AllowedOrgCreation boolOptional

Whether the user is allowed to create organizations.

APIDatasourceAccess boolOptional

Whether the user is allowed to access API data sources.

MaximumOrgCreation int64Optional

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

ReturnsExpand Collapse
type UserClaims struct{…}

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

The user’s resolved custom claims.

AllowOrgDeletion boolOptional

Whether the user is allowed to delete organizations.

AllowedOrgCreation boolOptional

Whether the user is allowed to create organizations.

APIDatasourceAccess boolOptional

Whether the user is allowed to access API data sources.

MaximumOrgCreation int64Optional

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.

Update User Claims

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)
}
{
  "claims": {
    "allow_org_deletion": true,
    "allowed_org_creation": true,
    "api_datasource_access": true,
    "maximum_org_creation": 0
  },
  "user_id": "user_id"
}
Returns Examples
{
  "claims": {
    "allow_org_deletion": true,
    "allowed_org_creation": true,
    "api_datasource_access": true,
    "maximum_org_creation": 0
  },
  "user_id": "user_id"
}