Skip to main content
POST
/
v1
/
roles
Create a new role
curl --request POST \
  --url https://api-sandbox.rinne.com.br/core/v1/roles \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "admin",
  "permissions": [
    "user.create",
    "user.read",
    "role.create"
  ],
  "description": "Administrator role with full access",
  "company_id": "a3dbd0c2-9f79-4f86-8caa-47779b3f2793",
  "organization_id": "a3dbd0c2-9f79-4f86-8caa-47779b3f2794"
}'
{
  "id": "a3dbd0c2-9f79-4f86-8caa-47779b3f2793",
  "name": "admin",
  "permissions": [
    "user.create",
    "user.read",
    "role.create"
  ],
  "description": "Administrator role with full access",
  "company_id": "a3dbd0c2-9f79-4f86-8caa-47779b3f2793",
  "organization_id": "a3dbd0c2-9f79-4f86-8caa-47779b3f2794",
  "created_at": "2024-01-01T00:00:00.000Z",
  "updated_at": "2024-01-01T00:00:00.000Z"
}

Authorizations

Authorization
string
header
required

JWT token for user authentication

Body

application/json

Schema for creating a new role

name
string
required

Role name

Required string length: 1 - 100
Example:

"admin"

permissions
string[]
required

Array of permission strings

Minimum length: 1
Example:
["user.create", "user.read", "role.create"]
description
string

Role description

Maximum length: 500
Example:

"Administrator role with full access"

company_id
string

Company ID for company-specific roles

Example:

"a3dbd0c2-9f79-4f86-8caa-47779b3f2793"

organization_id
string

Organization role ID for role inheritance

Example:

"a3dbd0c2-9f79-4f86-8caa-47779b3f2794"

Response

Role created successfully

id
string
required

Role ID

Example:

"a3dbd0c2-9f79-4f86-8caa-47779b3f2793"

name
string
required

Role name

Example:

"admin"

permissions
string[]
required

Array of permission strings

Example:
["user.create", "user.read", "role.create"]
created_at
string<date-time>
required

Creation timestamp

Example:

"2024-01-01T00:00:00.000Z"

updated_at
string<date-time>
required

Last update timestamp

Example:

"2024-01-01T00:00:00.000Z"

description
string | null

Role description

Example:

"Administrator role with full access"

company_id
string | null

Company ID for company-specific roles

Example:

"a3dbd0c2-9f79-4f86-8caa-47779b3f2793"

organization_id
string | null

Organization role ID for role inheritance

Example:

"a3dbd0c2-9f79-4f86-8caa-47779b3f2794"