Roles API Reference
This guide covers the creating and managing roles in the platform.
The Role model
The role model is a representation of a role in the platform. It has the following properties:
Properties
- Name
id
- Type
- string
- Field Type
- Description
Unique identifier for the role.
- Name
name
- Type
- string
- Field Type
- Description
The name of the role.
- Name
description
- Type
- string
- Field Type
- Description
The description of the role.
- Name
scope
- Type
- string
- Field Type
- Description
The scope of the role. One of
platform
orbusiness
. (cant be changed once created)
- Name
created_at
- Type
- timestamp
- Field Type
- Description
The date and time the role was created.
- Name
abilities
- Type
- array
- Field Type
- Description
The abilities of the role.
Role / User Scopes
There are 2 types of users in Crater:
- Platform Scope: Used to manage businesses, users, and other resources across the platform. For example the super admin user & other of the platform.
- Business Scope: Used to manage resources within a specific business. For example the business owner or accountant. of a specific business.
Abilities
Abilities define the level of access a given role will have to resources in Crater.
Name | Resource | Scope |
---|---|---|
view-business | Business | platform |
create-business | Business | platform |
edit-business | Business | platform |
delete-business | Business | platform |
view-access-log | AccessLog | platform |
view-role | Role | platform |
manage-role | Role | platform |
view-api-log | ApiLog | platform |
view-platform-setting | Settings | platform |
edit-platform-setting | Settings | platform |
view-webhook | Webhook | platform |
create-webhook | Webhook | platform |
edit-webhook | Webhook | platform |
delete-webhook | Webhook | platform |
view-event | Event | platform |
view-email-template | EmailTemplate | platform |
create-email-template | EmailTemplate | platform |
edit-email-template | EmailTemplate | platform |
delete-email-template | EmailTemplate | platform |
view-platform-user | User | platform |
create-platform-user | User | platform |
edit-platform-user | User | platform |
delete-platform-user | User | platform |
edit-business-information | Business | business & platform |
view-business-stats | Business | business & platform |
manage-business-settings | Business | business & platform |
manage-notifications | Business | business & platform |
edit-business-information | Settings | business & platform |
view-user | User | business & platform |
create-user | User | business & platform |
edit-user | User | business & platform |
delete-user | User | business & platform |
view-customer | Customer | business & platform |
create-customer | Customer | business & platform |
edit-customer | Customer | business & platform |
delete-customer | Customer | business & platform |
view-vendor | Vendor | business & platform |
create-vendor | Vendor | business & platform |
edit-vendor | Vendor | business & platform |
delete-vendor | Vendor | business & platform |
view-estimate | Estimate | business & platform |
create-estimate | Estimate | business & platform |
edit-estimate | Estimate | business & platform |
delete-estimate | Estimate | business & platform |
send-estimate | Estimate | business & platform |
approve-reject-estimate | Estimate | business & platform |
view-invoice | Invoice | business & platform |
create-invoice | Invoice | business & platform |
edit-invoice | Invoice | business & platform |
delete-invoice | Invoice | business & platform |
send-estimate | Invoice | business & platform |
approve-invoice | Invoice | business & platform |
pay-invoice | Invoice | business & platform |
view-payment | Payment | business & platform |
send-payment | Payment | business & platform |
view-recurring-invoice | RecurringInovice | business & platform |
create-recurring-invoice | RecurringInovice | business & platform |
edit-recurring-invoice | RecurringInovice | business & platform |
delete-recurring-invoice | RecurringInovice | business & platform |
view-item | Item | business & platform |
create-item | Item | business & platform |
edit-item | Item | business & platform |
delete-item | Item | business & platform |
view-note | Note | business & platform |
create-note | Note | business & platform |
edit-note | Note | business & platform |
delete-note | Note | business & platform |
view-tax-type | Taxtype | business & platform |
create-tax-type | Taxtype | business & platform |
edit-tax-type | Taxtype | business & platform |
delete-tax-type | Taxtype | business & platform |
view-payment-reminder | PaymentReminder | business & platform |
create-payment-reminder | PaymentReminder | business & platform |
edit-payment-reminder | PaymentReminder | business & platform |
delete-payment-reminder | PaymentReminder | business & platform |
view-payment-method | PaymentMethod | business & platform |
create-payment-method | PaymentMethod | business & platform |
edit-payment-method | PaymentMethod | business & platform |
delete-payment-method | PaymentMethod | business & platform |
view-payment-onboarding-link | PaymentOnboardingLink | business & platform |
create-payment-onboarding-link | PaymentOnboardingLink | business & platform |
edit-payment-onboarding-link | PaymentOnboardingLink | business & platform |
delete-payment-onboarding-link | PaymentOnboardingLink | business & platform |
view-report | Report | business & platform |
view-audit-log | AuditLog | business & platform |
view-balance-sheet | LoanBalance | business & platform |
manage-integration | Integration | business & platform |
List all roles
This endpoint allows you to retrieve a paginated list of all roles.
Query Parameters
- Name
name
- Type
- integer
- Field Type
optional
- Description
Filter roles by name.
- Name
scope
- Type
- integer
- Field Type
optional
- Description
Filter roles by scope. One of
platform
orbusiness
. (if not passed or passedall
it will return all roles).
Request
curl --request GET \
"https://payments.your-domain.com/api/v1/platform/roles" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
Response
{
"data": [
{
"id": "0073c5c8-637f-491d-bcb8-325210f1fd2e",
"name": "Admin",
"description": "Admin role",
"scope": "platform",
"created_at": 1714040338,
"abilities": [
{
"name": "view-business",
"scope": "platform"
}, {...}
]
}, {...}
]
}
Create a role
This endpoint allows you to create a new role in the platform.
Query Parameters
- Name
name
- Type
- string
- Field Type
required
- Description
The name of the role.
- Name
description
- Type
- string
- Field Type
required
- Description
The description of the role.
- Name
scope
- Type
- string
- Field Type
required
- Description
The scope of the role. One of
platform
orbusiness
.
- Name
abilities
- Type
- array
- Field Type
required
- Description
The abilities of the role. You can check the list of abilities here.
Request
curl --request POST \
"https://payments.your-domain.com/api/v1/platform/roles" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"name\": \"Admin\",
\"description\": \"Admin role\",
\"scope\": \"platform\",
\"abilities\": [\"view-customer\", \"create-customer\"]
}"
Response
{
"data": {
"id": "0073c5c8-637f-491d-bcb8-325210f1fd2e",
"name": "Admin",
"description": "Admin role",
"scope": "platform",
"created_at": 1714040338,
"abilities": [
{
"name": "view-business",
"scope": "platform"
}, {...}
]
}
}
Retrive a role
This endpoint allows you to retrieve a role by its ID.
URL Parameters
- Name
role_id
- Type
- string
- Field Type
required
- Description
The ID of the role.
Request
curl --request GET \
"https://payments.your-domain.com/api/v1/platform/roles/0073c5c8-637f-491d-bcb8-325210f1fd2e" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
Response
{
"data": {
"id": "0073c5c8-637f-491d-bcb8-325210f1fd2e",
"name": "Admin",
"description": "Admin role",
"scope": "platform",
"created_at": 1714040338,
"abilities": [
{
"name": "view-business",
"scope": "platform"
}, {...}
]
}
}
Update a role
This endpoint allows you to update a role by its ID.
URL Parameters
- Name
role_id
- Type
- string
- Field Type
required
- Description
The ID of the role.
Body Parameters
- Name
name
- Type
- string
- Field Type
optional
- Description
The name of the role.
- Name
description
- Type
- string
- Field Type
optional
- Description
The description of the role.
- Name
abilities
- Type
- array
- Field Type
optional
- Description
The abilities of the role.
Request
curl --request PUT \
"https://payments.your-domain.com/api/v1/platform/roles/0073c5c8-637f-491d-bcb8-325210f1fd2e" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"name\": \"Admin\",
\"description\": \"Admin role\",
\"abilities\": [\"view-customer\", \"create-customer\"]
}"
Response
{
"data": {
"id": "0073c5c8-637f-491d-bcb8-325210f1fd2e",
"name": "Admin",
"description": "Admin role",
"scope": "platform",
"created_at": 1714040338,
"abilities": [
{
"name": "view-business",
"scope": "platform"
}, {...}
]
}
}
Delete a role
This endpoint allows you to delete a role by its ID.
URL Parameters
- Name
role_id
- Type
- string
- Field Type
required
- Description
The ID of the role.
Request
curl --request DELETE \
"https://payments.your-domain.com/api/v1/platform/roles/0073c5c8-637f-491d-bcb8-325210f1fd2e" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"
Response
{
{
"id": "0073c5c8-637f-491d-bcb8-325210f1fd2e",
"object": "Role",
"deleted": true
}
}