curl --request POST \
--url https://api.example.com/roles \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"organizationId": "<string>",
"slug": "<string>",
"name": "<string>",
"description": "<string>",
"permissions": [
"<string>"
]
}
'{
"roleId": "10",
"organizationId": null,
"slug": "custom-editor",
"name": "Custom Editor",
"description": null,
"type": "ORGANIZATION_ROLE",
"permissions": ["users:read"],
"inherited": false,
"createdAt": "2026-03-25T14:00:00.000Z",
"updatedAt": "2026-03-25T14:00:00.000Z"
}
Criar um novo papel com um conjunto de permissoes para controle de acesso a nivel de organizacao.
curl --request POST \
--url https://api.example.com/roles \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"organizationId": "<string>",
"slug": "<string>",
"name": "<string>",
"description": "<string>",
"permissions": [
"<string>"
]
}
'{
"roleId": "10",
"organizationId": null,
"slug": "custom-editor",
"name": "Custom Editor",
"description": null,
"type": "ORGANIZATION_ROLE",
"permissions": ["users:read"],
"inherited": false,
"createdAt": "2026-03-25T14:00:00.000Z",
"updatedAt": "2026-03-25T14:00:00.000Z"
}
roles:write.{
"roleId": "10",
"organizationId": null,
"slug": "custom-editor",
"name": "Custom Editor",
"description": null,
"type": "ORGANIZATION_ROLE",
"permissions": ["users:read"],
"inherited": false,
"createdAt": "2026-03-25T14:00:00.000Z",
"updatedAt": "2026-03-25T14:00:00.000Z"
}
curl -X POST https://api.awsales.io/admin/roles \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"slug": "billing-manager",
"name": "Billing Manager",
"description": "Can manage billing and subscriptions",
"permissions": [
"billing:manage",
"invoices:read"
]
}'
| Status | Codigo | Descricao |
|---|---|---|
400 | validation_error | Entrada invalida ou campos obrigatorios ausentes |
401 | unauthorized | Autenticacao ausente ou invalida |
403 | forbidden | Permissoes insuficientes |
409 | role.slug_already_exists | Slug do papel ja esta em uso |
404 | permission.not_found | Uma ou mais permissoes nao existem |
500 | internal_server_error | Ocorreu um erro inesperado |