# Account Login

The **`login`** endpoint enables partners to authenticate customers using their email and password. This endpoint is crucial for ensuring secure access to the loyalty program's features, allowing partners to interact with the CRM on behalf of the customer after successful authentication.

### Request

<mark style="color:orange;">**POST**</mark>

```url
https://interface.experience-hotel.com/api/xp-guest-account/login
```

```postman_json
{
    "email": "test@test.com",
    "password": "123456"
}
```

To use this endpoint, partners must send a JSON payload in the body of the request containing:

* **email**: The email address of the customer attempting to log in.
* **password**: The password associated with the customer's account.

### Response

Upon processing the request, the API will respond based on the authentication status:

<mark style="color:green;">**`200 OK`**</mark>\
If the provided email and password match an existing account, the response will include a token that the partner can use for subsequent requests related to that customer.

**Partners must store this token securely, as it is specific to that customer and will be valid for one month.**

```json
{
    "token": "eyJpdIsInZhbHVlIjoiMKak1TNM4NDJmODMwMyIsInRiJ9"
}
```

<mark style="color:orange;">**`401 Unauthorized`**</mark>\
If the password entered does not match the one associated with the given email, this status code will be returned to indicate that authentication has failed.

```json
{
    "message": "The password provided for the customer is incorrect."
}
```

<mark style="color:orange;">**`404 Not Found`**</mark>

If the provided email does not correspond to any customer in the CRM, the API will return this status, indicating that the account does not exist.

<br>

This endpoint is essential for safeguarding customer data and ensuring that only authorized partners can access customer-specific information and perform operations on their behalf.<br>


---

# 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://experience-crm.gitbook.io/experience-crm-api/guests/guests-personal-space/account-login.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.
