# Mobile - Login

| **API URL**     | {{url}}/auth-service/session |
| --------------- | ---------------------------- |
| **Method**      | POST                         |
| **Description** | Login and get Access Token   |

#### **Input** <a href="#mobile-login-input" id="mobile-login-input"></a>

| **Field Name** | **Type** | **Mandatory** | **Example**         |
| -------------- | -------- | ------------- | ------------------- |
| username       | String   | Yes           | <superXXXn@XXX.mdt> |
| password       | String   | Yes           | Hashed Password     |
| client(Header) | String   |               | spice mobile        |

#### **Sample Input:** <a href="#mobile-login-sampleinput" id="mobile-login-sampleinput"></a>

#### No request - Will be handled based on App version from Headers and form value of user name and password. <a href="#mobile-login-norequest-willbehandledbasedonappversionfromheadersandformvalueofusernameandpassword." id="mobile-login-norequest-willbehandledbasedonappversionfromheadersandformvalueofusernameandpassword."></a>

#### **Output** <a href="#mobile-login-output" id="mobile-login-output"></a>

| **Field Name**       | **Type**                   | **Comments**                 |
| -------------------- | -------------------------- | ---------------------------- |
| `id`                 | Integer                    | User ID                      |
| `username`           | String                     | Login email ID               |
| `gender`             | String                     | User’s gender                |
| `roles`              | String                     | User role                    |
| `active`             | Boolean                    | Is active                    |
| `accountExpired`     | Boolean                    | Is account expired           |
| `accountLocked`      | Boolean                    | Is account locked            |
| `credentialsExpired` | Boolean                    | Is credentials expired       |
| `authorization`      | Boolean                    |                              |
| `currentDate`        | Timestamp without timezone | Date                         |
| `firstName`          | String                     | User first name              |
| `lastName`           | String                     | User last name               |
| `middleName`         | String                     | User middle name             |
| `phoneNumber`        | String                     | User Phone number            |
| `timezone`           | Timestamp                  | Time zone of user            |
| `organizations`      | Bigint                     | User’s organization          |
| `tenantId`           | Bigint                     |                              |
| `countryCode`        | String                     | User’s country code          |
| `isBlocked`          | Boolean                    |                              |
| `country`            | String                     | User’s country               |
| `deviceInfoId`       | Bigint                     | User’s device information ID |
| `isSuperUser`        | Boolean                    | Is super user                |
| `cultureId`          | Bigint                     | Culture ID of user           |

#### **Sample Output:** <a href="#mobile-login-sampleoutput" id="mobile-login-sampleoutput"></a>

```
{
  "id": 5,
  "username": "kavya_pro@spice.mdt",
  "gender": "Female",
  "roles": [
    {
      "id": 17,
      "name": "PROVIDER",
      "level": null,
      "authority": "PROVIDER",
      "createdBy": 0,
      "updatedBy": 0,
      "createdAt": null,
      "updatedAt": null,
      "active": true,
      "deleted": false
    }
  ],
  "active": true,
  "accountExpired": false,
  "accountLocked": false,
  "credentialsExpired": false,
  "authorization": null,
  "currentDate": 1685527129699,
  "firstName": "Kavya",
  "lastName": "Provider",
  "middleName": null,
  "subject": null,
  "phoneNumber": "887XXX7565",
  "timezone": {
    "id": 1,
    "offset": "+05:30",
    "description": "(UTC+05:30) Chennai, Kolkata, Mumbai, New Delhi"
  },
  "organizations": [
    {
      "id": 4,
      "name": "Medical Care"
    }
  ],
  "tenantId": 4,
  "countryCode": "254",
  "isBlocked": false,
  "country": {
    "id": 1,
    "name": "Kenya",
    "countryCode": "254",
    "unitMeasurement": "metric",
    "tenantId": 1
  },
  "deviceInfoId": null,
  "isSuperUser": false,
  "cultureId": 1
}
```


---

# 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://spice.docs.medtroniclabs.org/spice-docs/versions/spice-1.0/engineering/api-documentation/spice-services/mobile-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.
