# Update User Profile

<mark style="color:orange;">`PUT`</mark> `/users/{user_id}`

### **Overview**

Updates the **profile information** of a specific user, such as their name, contact details, or metadata.

This endpoint is typically used to **keep user records current** or to reflect changes submitted by users.

**Typical use cases**

* Updating a user’s **name or email**
* Syncing **external user data** with Klaim

### **Header**

| Name                               | Value              |
| ---------------------------------- | ------------------ |
| Content-Type                       | `application/json` |
| Authorization <sup>(API Key)</sup> | `Bearer <API Key>` |

### Path

<table><thead><tr><th width="181.97265625">Name</th><th width="142.28515625">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>user_id</code></td><td>string</td><td>The current user_id value of the user to be updated</td></tr></tbody></table>

### Body

<table><thead><tr><th>Name</th><th width="176">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>name</code> <sub>(optinal)</sub></td><td>string</td><td>Name of the user</td></tr><tr><td><code>email</code> <sub>(optinal)</sub></td><td>string</td><td>Email of the user</td></tr><tr><td><code>user_id</code> <sub>(optinal)</sub></td><td>string</td><td>User identifier (user_id). <br>Optional on create — if not provided, a system-generated ID will be used<br><br><a href="user/user_id-and-klaim_id" class="button secondary">More description</a></td></tr><tr><td><code>metadata</code> <sub>(optinal)</sub></td><td>object</td><td><p>A set of <strong>custom key-value pairs</strong> to be stored in the user’s profile.</p><p><br><a href="user/metadata" class="button secondary">More description</a></p></td></tr></tbody></table>

### Response

{% tabs %}
{% tab title="200" %}

```json
{
    "message": "fetch resource successfully",
    "metadata": {
        "test": "field"
    },
    "user_id": "testUserId",
    "klaim_id": "1753306133860_A36dL"
    "created_at": 1753306133860,
    "acquisition_source": "api"
    "credit_balance": 0,
    "email": "test@email.com",
    "name": "tester",
}
```

{% endtab %}

{% tab title="404" %}
This HTTP status is returned when **no user profile entity is found** for the given userId.

```json
{
    "message": "Can not find user with the given user_id."
}
```

{% endtab %}

{% tab title="409" %}
A conflict error occurs when a user with the same email or user\_id already exists in the app.

{% code title="Email Already Exists" %}

```
{
    "message": "Email already exists"
}
```

{% endcode %}

{% code title="UserID Already Exists" %}

```
{
    "message": "User ID already exists"
}
```

{% endcode %}
{% endtab %}
{% endtabs %}
