> For the complete documentation index, see [llms.txt](https://foyer.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://foyer.gitbook.io/docs/api/authorization.md).

# Authorization

## Login

<mark style="color:green;">`POST`</mark> `https://api.foyer.ai/User/login`

Login and receive an authorization token for use with all future requests.

#### Request Body

| Name     | Type   | Description                                    |
| -------- | ------ | ---------------------------------------------- |
| email    | string | The email address associated with the account. |
| password | string | The password associated with the account.      |

{% tabs %}
{% tab title="200 Successfully logged in." %}

```
<Response body empty>
```

{% endtab %}

{% tab title="401 Could not log in." %}

```
<Response body empty>
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
Be sure to save the authorization token in the response header and include it when making API requests.
{% endhint %}

## Change Password

<mark style="color:green;">`POST`</mark> `https://api.foyer.ai/User/changePassword`

Change password for existing account.

#### Headers

| Name          | Type   | Description          |
| ------------- | ------ | -------------------- |
| Authorization | string | Authorization token. |

#### Request Body

| Name               | Type   | Description            |
| ------------------ | ------ | ---------------------- |
| currentPassword    | string | Current password.      |
| newPassword        | string | New password.          |
| confirmNewPassword | string | New password repeated. |

{% tabs %}
{% tab title="200 Successfully changed password." %}

```
<Response body empty>
```

{% endtab %}

{% tab title="401 Could not change password." %}

```
<Response body empty>
```

{% endtab %}
{% endtabs %}
