Create a role
post
https://api.flactrum.com/v1/roles
| Required scope | roles.write |
| Success status | 201 |
| Returns | One Role object |
Request body
| Field | Type | Description |
|---|---|---|
| name * | string | — |
| scope * | string | — |
| permissions | array | Permission slugs. Sending this replaces the whole set. Per-page slugs (page.products.create) and legacy coarse slugs (menu.manage) are both accepted; legacy slugs are converted to the page permissions they used to open. Get valid slugs from /permissions. |
Response fields
| Field | Type | Description |
|---|---|---|
| id | string | — |
| name | string | — |
| slug | string | — |
| scope | string | — |
| is_system | boolean | System roles are shared by every brand and cannot be edited. |
| permissions | array | Effective permissions: per-page slugs (page.{page}.{view|create|update|delete}), special permissions such as cash.close, and the legacy coarse slugs (menu.view…) derived from the page permissions. |
| user_count | integer | — |
Examples
Recorded from the test suite — these are real requests and their real responses.
curl -X POST 'https://api.flactrum.com/v1/roles' \
-H 'Authorization: Bearer flk_your_key:your_secret' \
-H 'Content-Type: application/json' \
-d '{
"name": "Depo sorumlusu",
"scope": "branch",
"permissions": [
"stock.view",
"stock.count"
]
}'
HTTP 201 · application/json
{
"data": {
"id": "01m43mzqy0ntafnza900bb9ra8",
"name": "Depo sorumlusu",
"slug": "depo_sorumlusu",
"scope": "branch",
"is_system": false,
"permissions": [
"stock.count",
"page.stock.view",
"page.stock.update",
"page.stock-expiry.view",
"page.stock-items.view",
"page.stock-items.create",
"page.stock-items.update",
"page.stock-items.delete",
"page.stock-item-categories.view",
"page.stock-item-categories.create",
"page.stock-item-categories.update",
"page.stock-item-categories.delete",
"page.stock-item-units.view",
"page.stock-item-units.create",
"page.stock-item-units.update",
"page.stock-item-units.delete",
"page.custom-units.view",
"page.custom-units.create",
"page.custom-units.update",
"page.custom-units.delete",
"page.stock-counts.view",
"page.stock-counts.create",
"page.stock-counts.update",
"page.stock-counts.delete",
"page.stock-waste.view",
"page.stock-waste.create",
"page.stock-movements.view",
"page.warehouse-stock.view",
"page.transfers.view",
"page.transfers.create",
"page.transfers.update",
"page.transfers.delete",
"page.goods-receipts.view",
"page.goods-receipts.create",
"page.goods-receipts.update",
"page.goods-receipts.delete",
"stock.view"
],
"user_count": 0,
"created_at": "2026-10-04T14:27:17+00:00",
"updated_at": "2026-10-04T14:27:17+00:00"
}
}