curl --request PATCH \
--url https://api.example.com/roles/{slug} \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"description": "<string>",
"permissions": [
"<string>"
]
}
'{
"roleId": "10",
"organizationId": null,
"slug": "custom-editor",
"name": "Updated Editor",
"description": null,
"type": "ORGANIZATION_ROLE",
"permissions": ["users:read", "users:write"],
"inherited": false,
"createdAt": "2026-03-25T14:00:00.000Z",
"updatedAt": "2026-03-25T14:30:00.000Z"
}
Atualizar nome, descricao ou permissoes de um papel.
curl --request PATCH \
--url https://api.example.com/roles/{slug} \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"description": "<string>",
"permissions": [
"<string>"
]
}
'{
"roleId": "10",
"organizationId": null,
"slug": "custom-editor",
"name": "Updated Editor",
"description": null,
"type": "ORGANIZATION_ROLE",
"permissions": ["users:read", "users:write"],
"inherited": false,
"createdAt": "2026-03-25T14:00:00.000Z",
"updatedAt": "2026-03-25T14:30:00.000Z"
}
roles:write.{
"roleId": "10",
"organizationId": null,
"slug": "custom-editor",
"name": "Updated Editor",
"description": null,
"type": "ORGANIZATION_ROLE",
"permissions": ["users:read", "users:write"],
"inherited": false,
"createdAt": "2026-03-25T14:00:00.000Z",
"updatedAt": "2026-03-25T14:30:00.000Z"
}
curl -X PATCH https://api.awsales.io/admin/roles/billing-manager \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Billing Admin",
"permissions": [
"billing:manage",
"invoices:read",
"invoices:write"
]
}'
| Status | Codigo | Descricao |
|---|---|---|
400 | validation_error | Entrada invalida ou campos obrigatorios ausentes |
401 | unauthorized | Autenticacao ausente ou invalida |
403 | forbidden | Permissoes insuficientes |
403 | role.cannot_modify_inherited | Nao e possivel modificar um papel herdado |
404 | role.not_found | Papel nao encontrado |
404 | permission.not_found | Uma ou mais permissoes nao existem |
500 | internal_server_error | Ocorreu um erro inesperado |