> ## Documentation Index
> Fetch the complete documentation index at: https://domoinc-openapi-sync-dataflows.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Roles Governance API

This API reference is useful if you are trying to manage Domo Roles from anywhere 'outside' of your Domo instance such as:

1. Jupyter scripts
2. Code Engine Functions
3. Custom Java/Node/Python scripts

## Create Role

<Card horizontal arrow title="Playground" icon="code" href="/api-reference/roles-governance-api/create-role" />

### Overview

Create a Role based on an existing role's authorities

### Endpoint

**POST** `/api/authorization/v1/roles`

### Body Parameters

| Parameter     | Type    | Required | Description                                     |
| ------------- | ------- | -------- | ----------------------------------------------- |
| `name`        | String  | Yes      | The name that will be displayed for the role    |
| `description` | String  | Yes      | Description that will be displayed for the role |
| `fromRoleId`  | Integer | Yes      | The ID of the role to fetch                     |

### Example

```json theme={"dark"}
{
  "method": "POST",
  "url": "https://{instance}.domo.com/api/authorization/v1/roles",
  "headers": {
    "X-DOMO-Developer-Token": "",
    "Content-Type": "application/json"
  },
  "body": {
    "name": string,
    "description": string,
    "fromRoleId": number
  }
}
```

### Response

```text theme={"dark"}
HTTP/1.1 200 OK
  Content-Type: application/json;charset=UTF-8
  {
    "id": 1234567,
    "name": "",
    "description": ""
  }
```

***

## Get Role By Id

<Card horizontal arrow title="Playground" icon="code" href="/api-reference/roles-governance-api/get-role-by-id" />

### Overview

Fetch a single Role by role id

### Endpoint

**GET** `/api/authorization/v1/roles/{roleId}`

### Path Parameters

| Parameter | Type    | Required | Description                 |
| --------- | ------- | -------- | --------------------------- |
| `roleId`  | Integer | Yes      | The ID of the role to fetch |

### Example

```json theme={"dark"}
{
  "method": "GET",
  "url": "https://{instance}.domo.com/api/authorization/v1/roles/{roleId}",
  "headers": {
    "X-DOMO-Developer-Token": "",
    "Content-Type": "application/json"
  }
}
```

### Response

```text theme={"dark"}
HTTP/1.1 200 OK
  Content-Type: application/json;charset=UTF-8
  {
    "id": 1,
    "name": "Admin",
    "description": "Full access to everything",
    "authorityCount": 94,
    "userCount": 358,
    "created": 1550093701000,
    "modified": 1550093701000
  }
```

***

## Get All Roles

<Card horizontal arrow title="Playground" icon="code" href="/api-reference/roles-governance-api/get-all-roles" />

### Overview

Fetch a all Roles in an instance

### Endpoint

**GET** `/api/authorization/v1/roles`

### Example

```json theme={"dark"}
{
  "method": "GET",
  "url": "https://{instance}.domo.com/api/authorization/v1/roles",
  "headers": {
    "X-DOMO-Developer-Token": "",
    "Content-Type": "application/json"
  }
}
```

### Response

```text theme={"dark"}
HTTP/1.1 200 OK
  Content-Type: application/json;charset=UTF-8
  [
    {
      "id": 1,
      "name": "Admin",
      "description": "Full access to everything",
      "authorityCount": 94,
      "userCount": 358,
      "created": 1550093701000,
      "modified": 1550093701000
    },
    ...
  ]
```

***

## Update Role Authorities

<Card horizontal arrow title="Playground" icon="code" href="/api-reference/roles-governance-api/update-role-authorities" />

### Overview

Updates the authorities or grants which a role is capable of utilizing

### Endpoint

**PATCH** `/api/authorization/v1/roles/{roleId}/authorities`

### Path Parameters

| Parameter | Type    | Required | Description                   |
| --------- | ------- | -------- | ----------------------------- |
| `roleId`  | Integer | Yes      | The ID of the role to updated |

### Body

The body for this query is a string array containing the complete list of authorities the role should have after the update

### Example

```json theme={"dark"}
{
  "method": "PATCH",
  "url": "https://{instance}.domo.com/api/authorization/v1/roles/{roleId}/authorities",
  "headers": {
    "X-DOMO-Developer-Token": "",
    "Content-Type": "application/json",
    "body": ["dataset.manage", "dataset.export"]
  }
}
```

### Response

```text theme={"dark"}
HTTP/1.1 200 OK
  Content-Type: application/json;charset=UTF-8
  {
    "status": "SUCCESS",
    "message": ""
  }
```

***

## Delete Role

<Card horizontal arrow title="Playground" icon="code" href="/api-reference/roles-governance-api/delete-role" />

### Overview

Delete a Role

### Endpoint

**DELETE** `/api/authorization/v1/roles/{roleId}`

### Path Parameters

| Parameter | Type    | Required | Description                   |
| --------- | ------- | -------- | ----------------------------- |
| `roleId`  | Integer | Yes      | The ID of the role to updated |

### Example

```json theme={"dark"}
{
  "method": "DELETE",
  "url": "https://{instance}.domo.com/api/authorization/v1/roles/{roleId}",
  "headers": {
    "X-DOMO-Developer-Token": "",
    "Content-Type": "application/json"
  }
}
```

### Response

```text theme={"dark"}
HTTP/1.1 204 No Content
  1
```
