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>"
]
}
}
}
'import requests
url = "https://clarus-api.com/api/roles"
payload = { "data": {
"type": "roles",
"attributes": {
"name": "<string>",
"description": "<string>",
"permissions": ["<string>"]
}
} }
headers = {
"Authorization": "Bearer <token>",
"X-Clarus-Subdomain": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: 'Bearer <token>',
'X-Clarus-Subdomain': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
data: {
type: 'roles',
attributes: {name: '<string>', description: '<string>', permissions: ['<string>']}
}
})
};
fetch('https://clarus-api.com/api/roles', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"data": {
"id": 123,
"type": "roles",
"attributes": {
"name": "<string>",
"description": "<string>",
"permissions": [
"<string>"
]
}
}
}{
"error": "<string>"
}{
"errors": [
{
"code": 123,
"symbol": "<string>",
"details": "<string>",
"source": "<string>",
"context": {}
}
]
}Roles
Create a role
Create a new role for user access control. Roles define a set of permissions that can be assigned to users.
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>"
]
}
}
}
'import requests
url = "https://clarus-api.com/api/roles"
payload = { "data": {
"type": "roles",
"attributes": {
"name": "<string>",
"description": "<string>",
"permissions": ["<string>"]
}
} }
headers = {
"Authorization": "Bearer <token>",
"X-Clarus-Subdomain": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: 'Bearer <token>',
'X-Clarus-Subdomain': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
data: {
type: 'roles',
attributes: {name: '<string>', description: '<string>', permissions: ['<string>']}
}
})
};
fetch('https://clarus-api.com/api/roles', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"data": {
"id": 123,
"type": "roles",
"attributes": {
"name": "<string>",
"description": "<string>",
"permissions": [
"<string>"
]
}
}
}{
"error": "<string>"
}{
"errors": [
{
"code": 123,
"symbol": "<string>",
"details": "<string>",
"source": "<string>",
"context": {}
}
]
}Request Structure
{
"data": {
"type": "roles",
"attributes": {
"name": "Warehouse Manager",
"description": "Full access to warehouse operations",
"permissions": ["manage_stock", "manage_orders", "view_reports"]
}
}
}
Key Fields
| Field | Required | Description |
|---|---|---|
name | Yes | Unique role name |
description | No | Role description |
permissions | No | Array of permission identifiers |
Authorizations
OAuth 2.0 authentication. Use the client credentials or authorization code flow to obtain an access token.
The subdomain/tenant name identifying which tenant's data to access. Required for all API requests.
Body
application/json
Show child attributes
Show child attributes
Response
Role created successfully
Show child attributes
Show child attributes
⌘I

