# Login

Used to collect a Token for a registered User.

**URL** : `/api.php/login/`

**Method** : `POST`

**Auth required** : NO

**Data constraints**

```json
{
    "login": "[valid email address]",
    "pwd": "[encrypted password]"
}
```

**Data example**

```json
{
    "username": "email@example.com",
    "password": "$2y$12$K7wi3XvwEZuODOGmwOgeKO1oBFhIjjuZJpmzYjMpDQ5BB9YIBAJ/6"
}
```

## Success Response

**Code** : `200 OK`

**Content example**

```json
{
    "jwt_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2MDYwNjA5MzMsImV4cCI6MTYwNjA2NDUzMywiaXNzIjoibG9jYWxob3N0IiwiZGF0YSI6eyJpZCI6IjMiLCJmaXJzdG5hbWUiOiJ0ZXN0IiwibGFzdG5hbWUiOiJ0ZXN0IiwiZW1haWwiOiJlbWFpbHRlc3RAdGVzdC5jb20ifX0.pj5SnrOUA45Fleb19D7MFz9Xc2Isx6km-Ov2gG2U_d0"
}
```

## Error Response

### Missing field

**Condition** : Missing field pwd or login.

**Code** : `422`

**Content** : `login and pwd fields are mandatory`


### Wrong password or login

**Condition** : Wrong combination login/password.

**Code** : `422`

**Content** : `wrong credentials`