Skip to main content
POST
/
api
/
roles
Create a role
curl --request POST \
  --url https://clarus-api.com/api/roles \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'X-Clarus-Subdomain: <api-key>' \
  --data '
{
  "data": {
    "type": "roles",
    "attributes": {
      "name": "<string>",
      "description": "<string>",
      "permissions": [
        "<string>"
      ]
    }
  }
}
'
{
  "data": {
    "id": 123,
    "type": "roles",
    "attributes": {
      "name": "<string>",
      "description": "<string>",
      "permissions": [
        "<string>"
      ]
    }
  }
}

Request Structure

{
  "data": {
    "type": "roles",
    "attributes": {
      "name": "Warehouse Manager",
      "description": "Full access to warehouse operations",
      "permissions": ["manage_stock", "manage_orders", "view_reports"]
    }
  }
}

Key Fields

FieldRequiredDescription
nameYesUnique role name
descriptionNoRole description
permissionsNoArray of permission identifiers

Authorizations

Authorization
string
header
required

OAuth 2.0 authentication. Use the client credentials or authorization code flow to obtain an access token.

X-Clarus-Subdomain
string
header
required

The subdomain/tenant name identifying which tenant's data to access. Required for all API requests.

Body

application/json
data
object
required

Response

Role created successfully

data
object