# Update user claims (/docs/apis/management/users/PatchClaims)

`PATCH /users/{user_id}/claims`

Applies a partial update to the claim values associated with the specified user. Only the claims provided in the request are modified. Claims can be removed by sending a `null` value for the corresponding key.

Base URL: `https://{tenant}.{region}.monocloud.com/api`, where `{tenant}`, `{region}` (one of us, eu, in) come from your tenant. Authentication: send your Management API key in the `X-API-KEY` header.

## Parameters

- `user_id` (path) (string, required) The unique identifier of the user.

## Request body

JSON, required. The request payload used to update user claims.

- `name` (string) Full name of the user.
- `given_name` (string) Given (first) name of the user.
- `middle_name` (string) Middle name or initial of the user.
- `family_name` (string) Family (last) name of the user.
- `nickname` (string) Preferred nickname for the user.
- `picture` (string, uri) URL of the user's profile image.
- `preferred_username` (string) Preferred username for the user which may be display purposes.
- `profile` (string, uri) URL of the user's profile page.
- `birthdate` (string) User's birth date in ISO 8601 format (YYYY-MM-DD).
- `website` (string, uri) URL of the user's personal or professional website.
- `gender` (string) User's gender.
- `zoneinfo` (string) Time zone associated with the user's location expressed using a IANA time zone name.
- `locale` (string) Preferred locale of the user expressed using a BCP 47 language tag.
- `address` (HttpUserAddressRequest) Physical or residential address associated with the user.
  - `formatted` (string) Single string combining various components of the address, such as street address, locality, region, postal code, and country.
  - `street_address` (string) The street part of the address, typically including house/building number and street name.
  - `locality` (string) The city or town of the address.
  - `region` (string) The state, province, or administrative region associated with the address.
  - `postal_code` (string) Postal code of the address.
  - `country` (string) The name of the country associated with the address.
- `skip_conformance_checks` (boolean, default false) Allows bypassing profile conformance checks enforced by sign-up policies.

## Response body

`200`, JSON. The user claims were updated successfully

Returns `User`.

- `user_id` (string, required) The unique identifier of the user.
- `disabled` (boolean, required) Indicates whether the account has been disabled.
- `claims` (Record<string, any>, required) Claims associated with the user.
- `public_data` (Record<string, any>, required) The public data associated with the user's account.
- `private_data` (Record<string, any>, required) The private data associated with the user's account.
- `emails` (UserEmail[], required) List of registered emails of the user.
  - `id` (string, required, uuid) Unique identifier of the user's email.
  - `primary` (boolean, required) Indicates whether this is the primary email address for the user.
  - `verified` (boolean, required) Indicates whether the email address has been verified.
  - `source` (string) Source from which the email address was originally collected.
  - `verification_source` (string) Identity provider or service that verified the email address.
  - `email` (string, required) The email address.
- `phone_numbers` (UserPhone[], required) List of registered phones of the user.
  - `id` (string, required, uuid) Unique identifier of the user's phone.
  - `primary` (boolean, required) Indicates whether this is the primary phone number for the user.
  - `verified` (boolean, required) Indicates whether the phone number has been verified.
  - `source` (string) Source from which the phone number was originally collected.
  - `verification_source` (string) Identity provider or service that verified the phone number.
  - `phone` (string, required) The phone number.
- `passkeys` (UserPasskey[], required) List of registered passkeys of the user.
  - `name` (string) Human-readable name assigned to the passkey.
  - `passkey_id` (string, required) Unique identifier of the passkey as provided by the authenticator.
  - `public_key` (string, required) Public key material associated with the passkey.
  - `aa_guid` (string, required, uuid) Authenticator Attestation GUID (AAGUID) identifying the authenticator model.
  - `backup_state` (boolean, required) Indicates whether the passkey is currently backed up by the authenticator.
  - `backup_eligibility` (boolean, required) Indicates whether the passkey is eligible for backup and multi-device use.
  - `user_present` (boolean, required) Indicates whether user presence was verified during passkey authentication.
  - `user_verified` (boolean, required) Indicates whether user verification (such as biometrics or PIN) was performed during authentication.
  - `user_agent` (string, required) User agent of the device used to register the passkey.
- `force_password_reset` (boolean, required) A flag indicating whether the user must change their password on next sign-in.
- `external_providers` (UserExternalProvider[], required) External provider profiles linked to this user.
  - `provider` (string, required) The provider associated with this connection.
  - `authenticator` (string, required) The authenticator used by the provider. One of: `google`, `apple`, `facebook`, `microsoft`, `github`, `gitlab`, `discord`, `twitter`, `linkedin`, `xero`, `custom_oidc`, `custom_enterprise`, `entra_oidc`.
  - `provider_user_id` (string, required) The user identifier assigned by the identity provider.
  - `claims` (Record<string, any>, required) Claims received from the identity provider and associated with this connection.
- `creation_time` (integer, required, date-time) Specifies the creation time of the user (in Epoch).
- `last_updated` (integer, required, date-time) Specifies the last update time of the user (in Epoch).
- `username` (UserUsername) Registered username for the user.
  - `id` (string, required, uuid) Unique identifier of the user's username.
  - `username` (string, required) The username used to identify the user.
  - `source` (string) Source from which the username was originally collected.
- `has_password` (boolean, required) Indicates whether the user has a password set.
- `password_updated_at` (integer, date-time) Specifies the time of the last password update (in Epoch).
- `block_until` (integer, int64) Specifies the time at which the user will be unblocked (in Epoch).
- `failure_count` (integer, required, int32) Consecutive sign-in failures since the last successful sign-in.
- `sign_in_attempts_count` (integer, required, int32) Total sign-in attempts recorded for the user.
- `last_sign_in_attempt` (integer, date-time) Specifies the time of the last sign-in attempt (in Epoch).
- `last_sign_in_attempt_ip` (string) IP address of the last sign-in attempt.
- `sign_in_success_count` (integer, required, int32) Total successful sign-ins recorded for the user.
- `last_sign_in_success` (integer, date-time) Specifies the time of the last successful sign-in (in Epoch).
- `last_sign_in_success_ip` (string) IP address of the last successful sign-in.
- `last_activity` (integer, date-time) Specifies the time of the last recorded user activity (in Epoch).
- `last_known_city` (string) Last recorded city for the user.
- `last_known_country` (string) Last recorded country for the user.
- `last_known_region` (string) Last recorded region for the user.

## Errors

- `400` Bad Request
  - `type` (string, required) A URI reference that identifies the error type. When accessed, it may provide human-readable documentation.
  - `title` (string, required) A short, human-readable summary of the error.
  - `status` (integer, required, int32) The HTTP status code associated with this error response.
  - `trace_id` (string, required) A unique identifier for the request, used for tracing and diagnostics.
  - `detail` (string) A human-readable explanation specific to this occurrence of the error.
  - `instance` (string) A URI reference that identifies the specific occurrence of the error.
- `401` Unauthorized
- `403` Forbidden
- `404` Not Found
  Same body as `400`.
- `422` Unprocessable Entity
  - `KeyValidationProblemDetails`
    - `type` (string, required) A URI reference that identifies the error type. When accessed, it may provide human-readable documentation.
    - `title` (string, required) A short, human-readable summary of the error.
    - `status` (integer, required, int32) The HTTP status code associated with this error response.
    - `trace_id` (string, required) A unique identifier for the request, used for tracing and diagnostics.
    - `detail` (string) A human-readable explanation specific to this occurrence of the error.
    - `instance` (string) A URI reference that identifies the specific occurrence of the error.
    - `errors` (Record<string, string[]>, required) A key-value map of validation errors, where each key represents a request field and the value contains one or more messages describing why the request could not be processed.
  - `IdentityValidationProblemDetails`
    - `type` (string, required) A URI reference that identifies the error type. When accessed, it may provide human-readable documentation.
    - `title` (string, required) A short, human-readable summary of the error.
    - `status` (integer, required, int32) The HTTP status code associated with this error response.
    - `trace_id` (string, required) A unique identifier for the request, used for tracing and diagnostics.
    - `detail` (string) A human-readable explanation specific to this occurrence of the error.
    - `instance` (string) A URI reference that identifies the specific occurrence of the error.
    - `errors` (IdentityError[], required) List of identity validation errors describing why the request could not be processed.

## Example (MonoCloud .NET SDK)

```csharp
using MonoCloud.Management;
using MonoCloud.Management.Models;
using MonoCloud.Management.Core.Base;

var apiClient = new MonoCloudManagementClient(new MonoCloudConfig("<your-domain>", "[[API-Key]]"));


var userId = "WUgDGqaqzqkRmsgd3PFAT";

var requestBody = new UpdateClaimsRequest
  {
    Name = "John Doe",
    GivenName = "John",
    MiddleName = "S",
    FamilyName = "Smith",
    Nickname = "Joey",
    Picture = "https://example.com/image.png",
    PreferredUsername = "john_smith",
    Profile = "https://example.com/john-smith",
    Birthdate = "1980-01-02",
    Website = "https://www.johnsmith.com",
    Gender = "male",
    Zoneinfo = "America/Los_Angeles",
    Locale = "en-US",
    Address = new HttpUserAddressRequest
    {
      Formatted = "123 Main St, Anytown, USA",
      StreetAddress = "123 Main St",
      Locality = "Anytown",
      Region = "CA",
      PostalCode = "12345-6789",
      Country = "United States",
    },
    SkipConformanceChecks = false,
  };


var result = await apiClient.Users.PatchClaimsAsync(userId, requestBody);
```

## Example (MonoCloud Javascript SDK)

```javascript
import { MonoCloudManagementClient } from '@monocloud/management';

const apiClient = MonoCloudManagementClient.init({ domain: '<your-domain>', apiKey: '[[API-Key]]' });

const userId = 'WUgDGqaqzqkRmsgd3PFAT';

const requestBody = {
  name: 'John Doe',
  given_name: 'John',
  middle_name: 'S',
  family_name: 'Smith',
  nickname: 'Joey',
  picture: 'https://example.com/image.png',
  preferred_username: 'john_smith',
  profile: 'https://example.com/john-smith',
  birthdate: '1980-01-02',
  website: 'https://www.johnsmith.com',
  gender: 'male',
  zoneinfo: 'America/Los_Angeles',
  locale: 'en-US',
  address: {
    formatted: '123 Main St, Anytown, USA',
    street_address: '123 Main St',
    locality: 'Anytown',
    region: 'CA',
    postal_code: '12345-6789',
    country: 'United States'
  },
  skip_conformance_checks: false
};

const result = apiClient.users.patchClaims(userId, requestBody);
```