Skip to main content
POST
Create a new role

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your API key. Must only be used when using Hanko Cloud.

Body

application/json
slug
string
required

Machine-safe, human-readable identifier for the role. Immutable after creation. Must be non-empty (after trimming whitespace), at most 255 characters, contain only lowercase letters, numbers and hyphens (e.g. admin, billing-manager), and must not be a valid UUID.

Maximum string length: 255
Pattern: ^[a-z0-9]+(?:-[a-z0-9]+)*$
name
string
required

Display name of the new role. Must be non-empty (after trimming whitespace) and at most 255 characters.

Maximum string length: 255

Response

Details of the newly created role

id
string<uuid4>
required

The ID of the role

Example:

"c339547d-e17d-4ba7-8a1d-b3d5a4d17c1c"

slug
string
required

Machine-safe, human-readable identifier for the role. Immutable after creation.

name
string
required

Display name of the role

created_at
string<date-time>
required

Time of creation of the role

updated_at
string<date-time>
required

Time of last update of the role