# Authentication

## Authenticate your user account to obtain a login token

<mark style="color:green;">`POST`</mark> `https://console.monogoto.io/Auth`

#### Request Body

| Name                                       | Type   | Description   |
| ------------------------------------------ | ------ | ------------- |
| UserName<mark style="color:red;">\*</mark> | String | Your username |
| Password<mark style="color:red;">\*</mark> | String | Your password |

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

```json
{
    "token": "eyJhb6IkpXVCJ9.eyJSb2xlIjoiVXN4lclByb2ZpbGVJZF9kZGM2MThhNC0wNTI1LTQ2MmUtYWN3NzhhMGQxYmbSI6Im4zgFkbWluIiwiQ3VzdG9tsbCwiVXNlcklkIjoiVklkXzg5Yj5Y2OGEyUtNDQThhLTEzZjA0MzJhZDE3YyINTAzgZmUtZGI51My00ZjRiLTktN2U5Yjc0ZWU1ZThlIiwiaWNzM3MjI5L2MDY3NTE2Mjl9.99aSLzP7kTgK6TZGW-xalrMu0GkW6viunt3XxbNng",
    "refreshToken": "eyJhb6IkpXVCJ9.eyJSb2xlIjoiVXN4lclByb2ZpbGVJZF9kZGM2MThhNC0wNTI1LTQ2MmUtYWN3NzhhMGQxYmbSI6Im4zgFkbWluIiwiQ3VzdG9tsbCwiVXN6lcklkjoiVklkXzg5Y2464OGEyUtND8ThhLTEzZjA0MzJhZDE3YyINTAgsretszgZmUtZGI51My00ZjRiLTktN2U5Yjc0ZWU1ZThlIiwiaWNzM3MjI5L2MD5786bzdhfdzhY3NTE2Mjl9.99aSLzP7kTgK6TZGW-xalrMu0GkW6viunt3XxbNng8vz567dfzgzfgEtT789D43dWEEW",
    "CustomerId": "cid_ecs1d3a5-f5e62a1-fe8af468wf",
    "UserId": "UserId_a76ty5a5-489a-4b87-9b9u-455f451d99fb",
    "UserName": "demo@monogoto.io",
    "Role": "UserProfileId_40e0998a-ef5c-4bbd-a18bc-2864y6100d1",
    "Realm": "customer",
    "OrganizationId": "OrganizationId_235348d7d-dd99-4111-ab2b-1ec612d9b11a",
    "AccountSettings": {
        "TwoFactorAuthentication": false
    },
    "ThingsGroupIds": [],
    "UserProfile": {
        "Permissions": {
            "API": ["view"],
            "AlertsTasksSettings": ["view", "edit", "delete"],
            "ApnAllowedToCustomer": ["view", "edit", "delete"],
            "AuditLogs": ["view"],
            "AuditLogsOwned": ["view"],
            "BillingReports": ["view"],
            "CurrencyCodes": ["view"],
            "Dashboard": ["view", "edit", "delete"],
            "ExternalHLR": ["view"],
            "GlobalSettings": ["view"],
            "IpPools": ["view", "edit", "delete"],
            "MobileSubscriber": ["view", "edit", "delete"],
            "NetwSecSettings": ["view", "edit", "delete"],
            "NetworkProvider": ["view"],
            "NetworkProviderDetails": ["view", "edit", "delete"],
            "PortalAlertsTasksSettings": ["view"],
            "PortalAuditLogs": ["view"],
            "PortalBillingReports": ["view"],
            "PortalDashboard": ["view"],
            "PortalIpPools": ["view"],
            "PortalLogin": ["view"],
            "PortalMobileIdentities": ["view"],
            "PortalNetwork": ["view"],
            "PortalPricePlanDetails": ["view"],
            "PortalRealtimeDashboard": ["view"],
            "PortalRoamingOwned": ["view"],
            "PortalSecurity": ["view"],
            "PortalSettings": ["view"],
            "PortalThings": ["view"],
            "PortalThingsGroups": ["view"],
            "PortalUsers": ["view"],
            "PricePlanDetails": ["view", "edit", "delete"],
            "RoamingOwned": ["view", "edit", "delete"],
            "Settings": ["view"],
            "Tags": ["view", "edit", "delete"],
            "TagsOwned": ["view", "edit", "delete"],
            "Things": ["view", "edit", "delete"],
            "ThingsGroup": ["view", "edit", "delete"],
            "ThingsGroupOwned": ["view", "edit", "delete"],
            "ThingsSensitiveData": ["view", "edit", "delete"],
            "UserProfile": ["view"],
            "Users": ["view", "edit", "delete"],
            "PortalReports": ["view"],
            "ReportTemplate": ["view", "edit", "delete"],
            "ReportHistory": ["view", "edit", "delete"],
            "DownloadReportInPdf": ["view", "edit", "delete"],
            "Scheduler": ["view", "edit", "delete"],
            "PortalScheduler": ["view"],
            "Search": ["view7", "edit", "delete"],
            "DownloadPCAPFile": ["view"],
            "DataLocationService": ["view"],
            "Bundle": ["view", "edit", "delete"]
        },
        "DateCreated": 1550396272390,
        "Name": "Customer Admin",
        "Realm": "customer",
        "Type": "USER_PROFILE",
        "UserProfileId": "UserProfileId_40e0998a-ef5c-4bbd-a18bc-2864y6100d1",
        "DateModified": 1606904198590,
        "cas": "160777788521644"
    }
}

```

{% endtab %}

{% tab title="404: Not Found Access denied" %}

```javascript
{
    Access denied
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
Add your **UserName** and **Password** in the POST request to successfully obtain your login token.

```json
{
  "UserName": "string",
  "Password": "string"
}
```

{% endhint %}

### Example using **cURL**:

```bash
curl -X POST \
     --url 'https://console.monogoto.io/Auth' \
     -H 'Content-Type: application/json' \
     -d '{
        "UserName": "string",
        "Password": "string"
        }'
```

Example response showing the **login token**, **CustomerID** etc:

```json
{
    "token": "eyJhb6IkpXVCJ9.eyJSb2xlIjoiVXN4lclByb2ZpbGVJZF9kZGM2MThhNC0wNTI1LTQ2MmUtYWN3NzhhMGQxYmbSI6Im4zgFkbWluIiwiQ3VzdG9tsbCwiVXNlcklkIjoiVklkXzg5Yj5Y2OGEyUtNDQThhLTEzZjA0MzJhZDE3YyINTAzgZmUtZGI51My00ZjRiLTktN2U5Yjc0ZWU1ZThlIiwiaWNzM3MjI5L2MDY3NTE2Mjl9.99aSLzP7kTgK6TZGW-xalrMu0GkW6viunt3XxbNng",
    "refreshToken": "eyJhb6IkpXVCJ9.eyJSb2xlIjoiVXN4lclByb2ZpbGVJZF9kZGM2MThhNC0wNTI1LTQ2MmUtYWN3NzhhMGQxYmbSI6Im4zgFkbWluIiwiQ3VzdG9tsbCwiVXN6lcklkjoiVklkXzg5Y2464OGEyUtND8ThhLTEzZjA0MzJhZDE3YyINTAgsretszgZmUtZGI51My00ZjRiLTktN2U5Yjc0ZWU1ZThlIiwiaWNzM3MjI5L2MD5786bzdhfdzhY3NTE2Mjl9.99aSLzP7kTgK6TZGW-xalrMu0GkW6viunt3XxbNng8vz567dfzgzfgEtT789D43dWEEW",
    "CustomerId": "cid_ecs1d3a5-f5e62a1-fe8af468wf",
    "UserId": "UserId_a76ty5a5-489a-4b87-9b9u-455f451d99fb",
    "UserName": "demo@monogoto.io",
    "Role": "UserProfileId_40e0998a-ef5c-4bbd-a18bc-2864y6100d1",
    "Realm": "customer",
    "OrganizationId": "OrganizationId_235348d7d-dd99-4111-ab2b-1ec612d9b11a",
    "AccountSettings": {
        "TwoFactorAuthentication": false
    },
    "ThingsGroupIds": [],
    "UserProfile": {
        "Permissions": {
            "API": ["view"],
            "AlertsTasksSettings": ["view", "edit", "delete"],
            "ApnAllowedToCustomer": ["view", "edit", "delete"],
            "AuditLogs": ["view"],
            "AuditLogsOwned": ["view"],
            "BillingReports": ["view"],
            "CurrencyCodes": ["view"],
            "Dashboard": ["view", "edit", "delete"],
            "ExternalHLR": ["view"],
            "GlobalSettings": ["view"],
            "IpPools": ["view", "edit", "delete"],
            "MobileSubscriber": ["view", "edit", "delete"],
            "NetwSecSettings": ["view", "edit", "delete"],
            "NetworkProvider": ["view"],
            "NetworkProviderDetails": ["view", "edit", "delete"],
            "PortalAlertsTasksSettings": ["view"],
            "PortalAuditLogs": ["view"],
            "PortalBillingReports": ["view"],
            "PortalDashboard": ["view"],
            "PortalIpPools": ["view"],
            "PortalLogin": ["view"],
            "PortalMobileIdentities": ["view"],
            "PortalNetwork": ["view"],
            "PortalPricePlanDetails": ["view"],
            "PortalRealtimeDashboard": ["view"],
            "PortalRoamingOwned": ["view"],
            "PortalSecurity": ["view"],
            "PortalSettings": ["view"],
            "PortalThings": ["view"],
            "PortalThingsGroups": ["view"],
            "PortalUsers": ["view"],
            "PricePlanDetails": ["view", "edit", "delete"],
            "RoamingOwned": ["view", "edit", "delete"],
            "Settings": ["view"],
            "Tags": ["view", "edit", "delete"],
            "TagsOwned": ["view", "edit", "delete"],
            "Things": ["view", "edit", "delete"],
            "ThingsGroup": ["view", "edit", "delete"],
            "ThingsGroupOwned": ["view", "edit", "delete"],
            "ThingsSensitiveData": ["view", "edit", "delete"],
            "UserProfile": ["view"],
            "Users": ["view", "edit", "delete"],
            "PortalReports": ["view"],
            "ReportTemplate": ["view", "edit", "delete"],
            "ReportHistory": ["view", "edit", "delete"],
            "DownloadReportInPdf": ["view", "edit", "delete"],
            "Scheduler": ["view", "edit", "delete"],
            "PortalScheduler": ["view"],
            "Search": ["view7", "edit", "delete"],
            "DownloadPCAPFile": ["view"],
            "DataLocationService": ["view"],
            "Bundle": ["view", "edit", "delete"]
        },
        "DateCreated": 1550396272390,
        "Name": "Customer Admin",
        "Realm": "customer",
        "Type": "USER_PROFILE",
        "UserProfileId": "UserProfileId_40e0998a-ef5c-4bbd-a18bc-2864y6100d1",
        "DateModified": 1606904198590,
        "cas": "160777788521644"
    }
}

```

## Authorization Header

{% hint style="info" %}
Once you obtained a token, make sure to add your login token to the the authorization header in all requests.
{% endhint %}

```bash
-H 'authorization: Bearer {YOUR_TOKEN}'
```

**Example**

```bash
curl --request GET \
     --url https://console.monogoto.io/thing/{YOUR_THING_ID}/state \
     -H 'Accept: application/json' \
     -H 'Authorization: Bearer {YOUR_TOKEN}'
```

{% openapi src="/files/lqgrtNg1pOcbxIdacwgh" path="/Auth" method="post" %}
[JPU\_CustomerAPIV\_Without\_Test it.yaml](https://3922449203-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0mPxGpottOEfcucXOR%2Fuploads%2FXtNpEMk17YOUrC39Cmvr%2FJPU_CustomerAPIV_Without_Test%20it.yaml?alt=media\&token=09b74b38-dd09-4edc-8f98-4df792b3c986)
{% endopenapi %}


---

# 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://docs.monogoto.io/developer/api/how-to-obtain-login-token.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.
