# User - Change Password

## user/change\_password

<mark style="color:green;">`POST`</mark> `https://public-api.timesafe.io/user/change_password`

Questo servizio permette di modificare la password, fornendo la precedente password e la nuova.

#### Headers

| Name  | Type   | Description                             |
| ----- | ------ | --------------------------------------- |
| token | string | Token JWT ottenuto da endpoint di login |

#### Request Body

| Name | Type   | Description      |
| ---- | ------ | ---------------- |
| new  | string | Nuova password   |
| old  | string | Vecchia password |

{% tabs %}
{% tab title="200 Password modificata con successo" %}

```
{
    "status": "OK",
    "data": []
}
```

{% endtab %}

{% tab title="501 La password corrente fornita non è valida, o mancano dei  parametri" %}

```
// UNCORRECT OLD PASSWORD 
{
    "error": {
        "code": "5_topi_invalidi",
        "details": "Wrong password."
    }
}

// MISSING PARAMETER
{
    "error": {
        "code": "3_asini_tristi",
        "details": [
            "This parameter is missing: ",
            "old"
        ]
    }
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.public-api.timesafe.io/api/user/change-password.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
