Create Roles
Roles are a set of permissions that can be assigned to API-Keys or Accounts.
Creating an Admin Role
CURL
Endpoint:/v1/{target}/roles-api/roles/create
| API Reference
Example Request
curl -X 'POST' \
'https://{orgID}.enterprise-sandbox.waltid.dev/v1/{target}/roles-api/roles/create' \
-H 'accept: */*' \
-H 'Authorization: Bearer {yourToken}' \
-H 'Content-Type: application/json' \
-d '{
"name": "My Admin",
"permissions": [
{
"target": "root_of_my_organization",
"action": "all",
"operation": "ADD"
}
]
}'
Body
{
"name": "My Admin",
"permissions": [
{
"target": "root_of_my_organization",
"action": "all",
"operation": "ADD"
}
]
}
Path Parameters
orgID
: - When performing operations within an organization, it is essential to use the organization's Base URL or another valid host alias. For example, if your organization is namedtest
, your default Base URL will betest.enterprise-sandbox.walt.dev
when using the sandbox environment.target
: resourceIdentifier - The target indicates the organization in which to create the new role and the role's ID ({organizationID}.[YourID]
), e.g.waltid.admin1
Body Parameters
name
: String - Human readable name for the role.permissions
- an array of objects specifying the permissions this role should hold.
The permission object:
target
- specifies the scope of the permission. For example, a permission could be applied on an organizational or a tenant level, thereby granting the permission on all sub-resources of that organization or tenant.action
- specifies the operation (e.g. create-key, delete-key). You can find a full list under the permission section.operation
- can beADD
to grant a permission orREMOVE
to revoke a permission.
Response Codes
201
- Role created successfully.