Skip to content
Product Docs

Update User Claims

UserClaims admin().users().updateClaims(UserUpdateClaimsParamsparams = UserUpdateClaimsParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
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
UserUpdateClaimsParams params
Optional<String> userId
Optional<List<RemoveClaim>> removeClaims

Names of claims to reset to their system default.

ALLOW_ORG_DELETION("allow_org_deletion")
ALLOWED_ORG_CREATION("allowed_org_creation")
API_DATASOURCE_ACCESS("api_datasource_access")
MAXIMUM_ORG_CREATION("maximum_org_creation")
Optional<SetClaims> setClaims

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.

Optional<Boolean> allowOrgDeletion

Whether the user is allowed to delete organizations.

Optional<Boolean> allowedOrgCreation

Whether the user is allowed to create organizations.

Optional<Boolean> apiDatasourceAccess

Whether the user is allowed to access API data sources.

Optional<Long> maximumOrgCreation

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

ReturnsExpand Collapse
class UserClaims:

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

The user’s resolved custom claims.

Optional<Boolean> allowOrgDeletion

Whether the user is allowed to delete organizations.

Optional<Boolean> allowedOrgCreation

Whether the user is allowed to create organizations.

Optional<Boolean> apiDatasourceAccess

Whether the user is allowed to access API data sources.

Optional<Long> maximumOrgCreation

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

String userId

The user ID the claims belong to.

Update User Claims

package ai.llamaindex.llamacloudadmin.example;

import ai.llamaindex.llamacloudadmin.client.LlamaCloudAdminClient;
import ai.llamaindex.llamacloudadmin.client.okhttp.LlamaCloudAdminOkHttpClient;
import ai.llamaindex.llamacloudadmin.models.admin.users.UserClaims;
import ai.llamaindex.llamacloudadmin.models.admin.users.UserUpdateClaimsParams;

public final class Main {
    private Main() {}

    public static void main(String[] args) {
        LlamaCloudAdminClient client = LlamaCloudAdminOkHttpClient.fromEnv();

        UserClaims userClaims = client.admin().users().updateClaims("user_id");
    }
}
{
  "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"
}