# 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 %}


---

# 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://foyer.gitbook.io/docs/api/authorization.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.
