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

# Authentication

## Auth

<mark style="color:green;">`POST`</mark> `{{base_url}}/accounts/auth/`

Provide username and password to exchange a valid token.

#### Headers

| Name            | Type   | Description      |
| --------------- | ------ | ---------------- |
| X-Forwarded-For | string | batch            |
| Content-Type    | string | application/json |

#### Request Body

| Name     | Type   | Description          |
| -------- | ------ | -------------------- |
| password | string | login password       |
| username | string | email of the account |

{% tabs %}
{% tab title="200 Login successful" %}

```yaml
{
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9",
    "user": {
        "sid":"xxx",
        "first_name":"xxx",
        "last_name":"xxx",
        "email":"xxx@labii.com"
    }
}
```

{% endtab %}

{% tab title="406 Wrong username or password" %}

```
["Unable to log in with provided credentials."]
```

{% endtab %}
{% endtabs %}

## Forget Password

<mark style="color:green;">`POST`</mark> `{{ base_url }}/accounts/forgetpassword/`

Receive a email to reset the password. \\

#### Request Body

| Name  | Type   | Description          |
| ----- | ------ | -------------------- |
| email | string | email of the account |

{% tabs %}
{% tab title="200 " %}

```yaml
{tag: xxxxx}
```

{% endtab %}
{% endtabs %}

## Reset Password

<mark style="color:green;">`POST`</mark> `{{ base_url }}/accounts/resetpassword/?tag={tag}`

Change user password.

#### Query Parameters

| Name | Type   | Description                                  |
| ---- | ------ | -------------------------------------------- |
| tag  | string | The tag returned from forget password method |

#### Request Body

| Name     | Type   | Description      |
| -------- | ------ | ---------------- |
| password | string | The new password |

{% tabs %}
{% tab title="200 " %}

```
{}
```

{% endtab %}

{% tab title="406 Wrong parameters" %}

```
Error: Missing Tag in GET! - Tag is missing in the url
Error: Wrong Tag! - Tag is not valid
Unknown request! - User not exists
The link has expired - Tag is valid for only 30 min
```

{% endtab %}
{% endtabs %}

## Logout

<mark style="color:blue;">`GET`</mark> `{{base_url}}/accounts/logout/`

Logout your account, invalid the token.

#### Headers

| Name  | Type   | Description |
| ----- | ------ | ----------- |
| token | string | user token  |

{% tabs %}
{% tab title="200 " %}

```
{}
```

{% endtab %}

{% tab title="401 Wrong token" %}

```
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.labii.com/api/methods/authentication.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
