> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tunimobile.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Log in

> Log the user in and set the BEARER and refresh_token cookies.

Public endpoint. On success, the response sets the `BEARER` and `refresh_token` cookies (see [Authentication](https://docs.tunimobile.com/basics/authentication.md)). The tokens are not in the body.

> [!NOTE]
>
> This response is **not** wrapped in the standard envelope.

## Body

**username** `string` *required*

Account username.

**password** `string` *required*

Account password.

## Response

**status** `integer`

`1` on success.

**id** `integer`

User id.

**user** `string`

Display name.

**username** `string`

Account username.

**role** `string`

Main role, depends on the account type. Integrations use `ROLE_SHOP` accounts.

**roles** `string[]`

All roles of the account.

**isVerified** `boolean`

`true` once the account documents are approved.

**hasAttachments** `boolean`

`true` if the account has uploaded its documents.

**isPhoneVerified** `boolean`

Phone verification state of the account.

**phoneVerificationRequired** `boolean`

`true` if the user must verify their phone.

## Errors

| HTTP | Body | Meaning |
| - | - | - |
| `401` | `{"code": 401, "message": "Invalid credentials."}` | Wrong username or password |
| `401` | `{"code": 401, "message": "Your user account no longer active."}` | Account disabled |
| `403` | `{"code": 403, "message": "User is not active"}` | Account disabled |

```bash cURL theme={null}
curl -c cookies.txt \
  -H "Content-Type: application/json" \
  -d '{"username":"myshop","password":"secret"}' \
  https://apitest.tunimobile.com/v1/login_check
```

```json 200 theme={null}
{
  "status": 1,
  "id": 123,
  "user": "My Shop",
  "username": "myshop",
  "role": "ROLE_SHOP",
  "roles": ["ROLE_SHOP", "ROLE_USER", "ROLE_ADD_CREDIT_REQUEST"],
  "code": "SH-0123",
  "avatar": "/images/avatars/123.webp",
  "themeConfig": null,
  "isVerified": true,
  "hasAttachments": true,
  "isPhoneVerified": true,
  "phoneVerificationRequired": false
}
```

```json 401 theme={null}
{ "code": 401, "message": "Invalid credentials." }
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.