# updateProfile()

Canonical URL: https://developers.iagenify.com/sdk/ref/auth/update-profile/
Language: en

`api.auth.updateProfile(updates) → Promise<{ ok, user }>`

Changes the account's writable profile fields. Only the fields you send are touched.

Status: PUT /api/auth/profile · free · partial update

## Parameters {#parameters}

| Name | Type | Requirement | Description |
| --- | --- | --- | --- |
| `nom` | string |  | Family name. |
| `prenom` | string |  | Given name. |
| `genre` | string |  | As the account declares it. |
| `tel` | string |  | Phone number. |
| `adresse` | string |  | Street address. |
| `ville` | string |  | City. |

Six fields, and nothing else is writable here. The email, password, and balance are not public SDK operations.

## It is a partial update {#partial}

Send one field and one field changes. There is no need to read the profile first, and no risk of writing back a stale copy of the rest.

```javascript
await api.auth.updateProfile({ ville: "Tunis" });
// everything else is exactly as it was
```

## Empty values are dropped, not applied {#empty}

A field that arrives empty is removed from the update before it is applied. So sending `""` does not clear a field — it changes nothing, and the call still answers `ok`. There is no way to blank a profile field through this method.

```javascript
await api.auth.updateProfile({ ville: "" });
// { ok: true, … } — and "ville" is unchanged

await api.auth.updateProfile({ tel: null });
// the same: nothing is cleared
```

> **A form that submits blanks will not do what the form says**
>
> An untouched input posts an empty string, and an empty string is ignored here. Send only the fields the user actually edited, or the page will report a change that did not happen.

```javascript
// Build the patch from what changed, not from the whole form
const patch = {};
for (const [field, value] of Object.entries(form)) {
  if (value !== "" && value !== original[field]) patch[field] = value;
}

if (Object.keys(patch).length) await api.auth.updateProfile(patch);
```

## Password changes stay in account settings {#password}

An API key can update profile metadata, so it must never be able to replace the account credential. Passing `password` is rejected locally by the SDK and by the API with `password_change_private`. Use the signed-in account settings instead.

## Returns {#returns}

The account as the server now holds it, with the password stripped. This is the full record, wider than the four fields [getUser()](/sdk/ref/iagenify/get-user) narrows it to — read it to confirm a change landed, not as a contract to depend on.

```javascript
const { ok, user } = await api.auth.updateProfile({ ville: "Tunis" });

ok;            // true
user.ville;    // "Tunis" — confirmation
// Everything else on `user` is the account record. Treat it as informational.
```

## Errors {#errors}

| Code | Status | When |
| --- | --- | --- |
| unauthorized | 401 | No valid session or key on the call. |
| password_change_private | 403 | The request attempted to change a password through the public SDK. |
| user_not_found | 404 | The session points at an account that no longer exists. |

## One thing worth thinking about first {#privacy}

These are personal details, and they are the account holder's. A program that writes them should be doing it because someone asked it to, with a value they gave — not copying them across from somewhere else because it happened to have them.

- [getUser()](/sdk/ref/iagenify/get-user): The four fields a program usually wants.
- [api.keys](/sdk/ref/keys): Audit and revoke program credentials independently of account settings.

```python
api.auth.update_profile({"ville": "Tunis"})
# everything else is exactly as it was
```

```python
api.auth.update_profile({"ville": ""})
# {"ok": True, ...} — and "ville" is unchanged

api.auth.update_profile({"tel": None})
# the same: nothing is cleared
```

```python
# Build the patch from what changed, not from the whole form
patch = {field: value for field, value in form.items()
         if value != "" and value != original.get(field)}

if patch:
    api.auth.update_profile(patch)
```

```python
answer = api.auth.update_profile({"ville": "Tunis"})

answer["ok"]              # True
answer["user"]["ville"]   # "Tunis" — confirmation
# Everything else on "user" is the account record. Treat it as informational.
```
