# Create Role

Create a custom role for the organization.

Set `role_type` to scope where the role applies once assigned to a user: `account` (the default) grants access on the specific account(s) it's assigned to, while `organization` grants that same access across every account in the organization, including accounts created later.

**POST** `/organizations/roles`

Base URL: `https://api-sandbox.whitelabel.com/v1`

Create a custom role for the organization.

## Authorization

- PUBLIC-API-KEY (apiKey in header)
- PRIVATE-SECRET-KEY (apiKey in header)

## Body

Content type: `application/json`

- `name` (string, required)
- `description` (string)
- `permission_ids` (string[])
- `testing_permission_ids` (string[])
- `role_type` ("account" | "organization")

Example:

```json
{
  "name": "Operator",
  "description": "Custom operator",
  "permission_ids": [],
  "testing_permission_ids": [],
  "role_type": "account"
}
```

## Responses

### 201

Created

- `id` (string)
- `name` (string)
- `description` (string)
- `admin` (boolean)
- `permission_ids` (string[])
- `testing_permission_ids` (string[])
- `role_type` (string)
- `created_at` (string<date-time>)
- `updated_at` (string<date-time>)

Example:

```json
{
  "id": "string",
  "name": "string",
  "description": "string",
  "admin": true,
  "permission_ids": [
    "string"
  ],
  "testing_permission_ids": [
    "string"
  ],
  "role_type": "string",
  "created_at": "1970-01-01T00:00:00.000Z",
  "updated_at": "1970-01-01T00:00:00.000Z"
}
```

### 400

Bad Request - Duplicate name or validation failure