> 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/admin-api/routes/roles.md).

# Roles

## /roles.get

<mark style="color:blue;">`GET`</mark> `https://admin-api.imid.infomaker.io/v1/roles.get`

Get role by id

#### Query Parameters

| Name   | Type   | Description |
| ------ | ------ | ----------- |
| roleId | string | Role id     |

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

```javascript
{
  "id": "Role id",
  "serviceId": "Service id",
  "name": "user",
  "description": "Description of speicific part xxx",
  "parentRoleId": "Role id",
  "updatedBySub": "infomaker_b8b9373b-a30d-459d-a44d-f270afb5e581"
}
```

{% endtab %}

{% tab title="400 Bad Request" %}

```javascript
"errors.api.BadRequestError"
```

{% endtab %}

{% tab title="500 Internal Server Error" %}

```javascript
"errors.api.InternalServerError"
```

{% endtab %}
{% endtabs %}

## /roles.list

<mark style="color:blue;">`GET`</mark> `https://admin-api.imid.infomaker.io/v1/roles.list`

List roles

#### Path Parameters

| Name | Type   | Description |
| ---- | ------ | ----------- |
|      | string |             |

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

```javascript
[
  {
    "id": "Role id",
    "serviceId": "Service id",
    "name": "user",
    "description": "Description of speicific part xxx",
    "parentRoleId": "Role id",
    "updatedBySub": "infomaker_b8b9373b-a30d-459d-a44d-f270afb5e581"
  }
]
```

{% endtab %}

{% tab title="400 Bad Request" %}

```javascript
"errors.api.BadRequestError"
```

{% endtab %}

{% tab title="500 Internal Server Error" %}

```javascript
"errors.api.InternalServerError"
```

{% endtab %}
{% endtabs %}

## /roles.listMappedGroups

<mark style="color:blue;">`GET`</mark> `https://admin-api.imid.infomaker.io/v1/roles.listMappedGroups`

List all mapped groups by role id

#### Query Parameters

| Name           | Type   | Description     |
| -------------- | ------ | --------------- |
| roleId         | string | Role id         |
| organizationId | string | Organization id |

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

```javascript
[
  {
    "roleId": "Role id",
    "unitId": "Unit id",
    "organizationId": "Organization id",
    "group": "Auth team"
  }
]
```

{% endtab %}

{% tab title="400 Bad Request" %}

```javascript
"errors.api.BadRequestError"
```

{% endtab %}

{% tab title="500 Internal Server Error" %}

```javascript
"errors.api.InternalServerError"
```

{% endtab %}
{% endtabs %}

## /roles.assignToGroup

<mark style="color:green;">`POST`</mark> `https://admin-api.imid.infomaker.io/v1/roles.assignToGroup`

Add group to role mapping

#### Request Body

| Name           | Type   | Description             |
| -------------- | ------ | ----------------------- |
| roleId         | string | Role id                 |
| organizationId | string | Organization id         |
| group          | string | Organization group name |
| unitId         | string | Unit id                 |

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

```javascript
{
  "roleId": "Role id",
  "organizationId": "Organization id",
  "group": "Auth team",
  "unitId": "Unit id"
}
```

{% endtab %}

{% tab title="400 Bad Request" %}

```javascript
"errors.api.BadRequestError"
```

{% endtab %}

{% tab title="500 Internal Server Error" %}

```javascript
"errors.api.InternalServerError"
```

{% endtab %}
{% endtabs %}

## /roles.create

<mark style="color:green;">`POST`</mark> `https://admin-api.imid.infomaker.io/v1/roles.create`

Create role

#### Request Body

| Name         | Type   | Description                       |
| ------------ | ------ | --------------------------------- |
| serviceId    | string | Service id                        |
| name         | string | Service role name                 |
| parentRoleId | string | Role id                           |
| description  | string | Description of speicific part xxx |

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

```javascript
{
  "id": "Role id",
  "serviceId": "Service id",
  "name": "user",
  "description": "Description of speicific part xxx",
  "permissions": []
}
```

{% endtab %}

{% tab title="400 Bad Request" %}

```javascript
"errors.api.BadRequestError"
```

{% endtab %}

{% tab title="500 Internal Server Error" %}

```javascript
"errors.api.InternalServerError"
```

{% endtab %}
{% endtabs %}

## /roles.delete

<mark style="color:green;">`POST`</mark> `https://admin-api.imid.infomaker.io/v1/roles.delete`

Delete role by id

#### Request Body

| Name   | Type   | Description |
| ------ | ------ | ----------- |
| roleId | string | Role id     |

{% tabs %}
{% tab title="204 No Content" %}

```javascript
""
```

{% endtab %}

{% tab title="400 Bad Request" %}

```javascript
"errors.api.BadRequestError"
```

{% endtab %}

{% tab title="500 Internal Server Error" %}

```javascript
"errors.api.InternalServerError"
```

{% endtab %}
{% endtabs %}

## /roles.mapPermission

<mark style="color:green;">`POST`</mark> `https://admin-api.imid.infomaker.io/v1/roles.mapPermission`

Map permissision to role

#### Request Body

| Name         | Type   | Description   |
| ------------ | ------ | ------------- |
| roleId       | string | Role id       |
| permissionId | string | Permission id |

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

```javascript
{
  "roleId": "Role id",
  "permissionId": "Permission id"
}
```

{% endtab %}

{% tab title="400 Bad Request" %}

```javascript
"errors.api.BadRequestError"
```

{% endtab %}

{% tab title="500 Internal Server Error" %}

```javascript
"errors.api.InternalServerError"
```

{% endtab %}
{% endtabs %}

## /roles.setDescription

<mark style="color:green;">`POST`</mark> `https://admin-api.imid.infomaker.io/v1/roles.setDescription`

Set role description by id

#### Request Body

| Name        | Type   | Description                       |
| ----------- | ------ | --------------------------------- |
| roleId      | string | Role id                           |
| description | string | Description of speicific part xxx |

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

```javascript
{
  "description": "Description of speicific part xxx"
}
```

{% endtab %}

{% tab title="400 Bad Request" %}

```javascript
"errors.api.BadRequestError"
```

{% endtab %}

{% tab title="500 Internal Server Error" %}

```javascript
"errors.api.InternalServerError"
```

{% endtab %}
{% endtabs %}

## /roles.setName

<mark style="color:green;">`POST`</mark> `https://admin-api.imid.infomaker.io/v1/roles.setName`

Set role name by id

#### Request Body

| Name   | Type   | Description       |
| ------ | ------ | ----------------- |
| roleId | string | Role id           |
| name   | string | Service role name |

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

```javascript
{
  "name": "user"
}
```

{% endtab %}

{% tab title="400 Bad Request" %}

```javascript
"errors.api.BadRequestError"
```

{% endtab %}

{% tab title="500 Internal Server Error" %}

```javascript
"errors.api.InternalServerError"
```

{% endtab %}
{% endtabs %}

## /roles.setParentRole

<mark style="color:green;">`POST`</mark> `https://admin-api.imid.infomaker.io/v1/roles.setParentRole`

Set role parent role by id

#### Request Body

| Name         | Type   | Description |
| ------------ | ------ | ----------- |
| roleId       | string | Role id     |
| parentRoleId | string | Role id     |

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

```javascript
{
  "parentRoleId": "Role id"
}
```

{% endtab %}

{% tab title="400 Bad Request" %}

```javascript
"errors.api.BadRequestError"
```

{% endtab %}

{% tab title="500 Internal Server Error" %}

```javascript
"errors.api.InternalServerError"
```

{% endtab %}
{% endtabs %}

## /roles.unassignFromGroup

<mark style="color:green;">`POST`</mark> `https://admin-api.imid.infomaker.io/v1/roles.unassignFromGroup`

Delete group to role mapping

#### Request Body

| Name           | Type   | Description             |
| -------------- | ------ | ----------------------- |
| roleId         | string | Role id                 |
| organizationId | string | Organization id         |
| group          | string | Organization group name |
| unitId         | string | Unit id                 |

{% tabs %}
{% tab title="204 No Content" %}

```javascript
""
```

{% endtab %}

{% tab title="400 Bad Request" %}

```javascript
"errors.api.BadRequestError"
```

{% endtab %}

{% tab title="500 Internal Server Error" %}

```javascript
"errors.api.InternalServerError"
```

{% endtab %}
{% endtabs %}

## /roles.unmapPermission

<mark style="color:green;">`POST`</mark> `https://admin-api.imid.infomaker.io/v1/roles.unmapPermission`

Unmap permission from role

#### Request Body

| Name         | Type   | Description   |
| ------------ | ------ | ------------- |
| roleId       | string | Role id       |
| permissionId | string | Permission id |

{% tabs %}
{% tab title="204 No Content" %}

```javascript
""
```

{% endtab %}

{% tab title="400 Bad Request" %}

```javascript
"errors.api.BadRequestError"
```

{% endtab %}

{% tab title="500 Internal Server Error" %}

```javascript
"errors.api.InternalServerError"
```

{% endtab %}
{% endtabs %}
