> For the complete documentation index, see [llms.txt](https://docs.navigaglobal.com/navigaid/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.navigaglobal.com/navigaid/services/imsg/routes/imsg-service.md).

# Imsg-service

## /imsg-service/v1/callback

<mark style="color:blue;">`GET`</mark> `https://[SERVICE URL].com/imsg-service/v1/callback`

Callback from IMAS login

#### Query Parameters

| Name            | Type   | Description                          |
| --------------- | ------ | ------------------------------------ |
| imid\_token     | string | IM ID JWT                            |
| serviceCallback | string | Where to redirect client after login |

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

```javascript
"Redirected to the service callback url"
```

{% endtab %}
{% endtabs %}

## /imsg-service/v1/health

<mark style="color:blue;">`GET`</mark> `https://[SERVICE URL].com/imsg-service/v1/health`

Health status

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

```javascript
{
  "inGrace": false,
  "stateChecksum": "A checksum string"
}
```

{% endtab %}

{% tab title="500 " %}

```javascript
{
  "inGrace": false,
  "stateChecksum": "No checksum string"
}
```

{% endtab %}
{% endtabs %}

## /imsg-service/v1/login

<mark style="color:blue;">`GET`</mark> `https://[SERVICE URL].com/imsg-service/v1/login`

Trigger login flow

#### Query Parameters

| Name                                       | Type   | Description                          |
| ------------------------------------------ | ------ | ------------------------------------ |
| callback<mark style="color:red;">\*</mark> | string | Where to redirect client after login |
| org<mark style="color:red;">\*</mark>      | string | Which org to login with              |

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

```javascript
"Redirected after login"
```

{% endtab %}
{% endtabs %}

## /imsg-service/v1/token-is-set

<mark style="color:blue;">`GET`</mark> `https://[SERVICE URL].com/imsg-service/v1/token-is-set`

Check if request contains IMID token

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

```javascript
{
  "msg": "ok"
}
```

{% endtab %}

{% tab title="401 " %}

```javascript
"errors.auth.MissingToken"
```

{% endtab %}
{% endtabs %}

## /imsg-service/v1/units

<mark style="color:blue;">`GET`</mark> `https://[SERVICE URL].com/imsg-service/v1/units`

List all units a subject belongs to

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

```javascript
{
  "msg": "Unit set"
}
```

{% endtab %}

{% tab title="403 " %}

```javascript
"errors.auth.Forbidden"
```

{% endtab %}
{% endtabs %}

## /imsg-service/v1/org/{org}/login

<mark style="color:blue;">`GET`</mark> `https://[SERVICE URL].com/imsg-service/v1/org/{org}/login`

Trigger login flow

#### Query Parameters

| Name                                       | Type   | Description                          |
| ------------------------------------------ | ------ | ------------------------------------ |
| callback<mark style="color:red;">\*</mark> | string | Where to redirect client after login |

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

```javascript
"Redirected after login"
```

{% endtab %}
{% endtabs %}

## /imsg-service/v1/logout

<mark style="color:green;">`POST`</mark> `https://[SERVICE URL].com/imsg-service/v1/logout`

Log out

#### Query Parameters

| Name     | Type   | Description                           |
| -------- | ------ | ------------------------------------- |
| callback | string | Where to redirect client after logout |

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

```javascript
{
  "msg": "You are logged out"
}
```

{% endtab %}
{% endtabs %}

## /imsg-service/v1/unit

<mark style="color:green;">`POST`</mark> `https://[SERVICE URL].com/imsg-service/v1/unit`

Set preferred unit

#### Request Body

| Name | Type   | Description    |
| ---- | ------ | -------------- |
| unit | string | Preferred unit |

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

```javascript
{
  "msg": "Unit set"
}
```

{% endtab %}

{% tab title="403 " %}

```javascript
"errors.auth.Forbidden"
```

{% endtab %}
{% endtabs %}
