Skip to main content
POST
/
api
/
v1
/
roles
/
Create Role
curl --request POST \
  --url https://services.pref.rio/heimdall-admin/api/v1/roles/ \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "description": "Data analysts with read access to analytics dashboards",
  "name": "data_analyst:read"
}'
{
  "created_at": "2024-01-15T10:30:00Z",
  "created_by": "12345678901",
  "description": "Data analysts with read access to analytics dashboards",
  "id": 1,
  "name": "data_analyst:read"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Request model for creating a new role.

name
string
required

Unique name for the role (lowercase letters, numbers, underscores, and colons only)

Required string length: 1 - 100
Example:

"data_analyst:read"

description
string
required

Human-readable description of the role's purpose and permissions

Required string length: 1 - 500
Example:

"Data analysts with read access to analytics dashboards"

Response

Successful Response

Response model for role information.

id
integer
required

Unique identifier for the role

Example:

1

name
string
required

Role name

Example:

"data_analyst:read"

description
string
required

Role description

Example:

"Data analysts with read access to analytics dashboards"

created_by
string | null

CPF of the user who created this role (null for system roles)

Example:

"12345678901"

created_at
string | null

ISO timestamp when the role was created (null for system roles)

Example:

"2024-01-15T10:30:00Z"