Docs/Account/API/Roles & Permissions

Roles & Permissions API

Manage role-based access control within a tenant. Create roles, assign permission sets, and perform real-time authorization checks.

Base URL: https://id.vyntech.com.au/api/v1 — All endpoints require authentication. Role management requires roles:manage permission.

List Roles

Returns all roles defined within the tenant, including their permission sets.

GET/api/v1/roles🔒 Auth

List all roles in the current tenant.

curl https://id.vyntech.com.au/api/v1/roles \ -H "Authorization: Bearer eyJhbGciOiJFZERTQSIs..."

Create Role

Creates a new role within the tenant. Role names must be unique within the tenant. Permissions are specified as an array of resource:action strings.

POST/api/v1/roles🔒 Auth

Create a new role with specified permissions.

curl -X POST https://id.vyntech.com.au/api/v1/roles \ -H "Authorization: Bearer eyJhbGciOiJFZERTQSIs..." \ -H "Content-Type: application/json" \ -d '{ "name": "billing-admin", "description": "Manage billing and invoices", "permissions": ["billing:read", "billing:write", "invoices:read", "invoices:write"] }'
Request Body
{
  "name": "billing-admin",
  "description": "Manage billing and invoices",
  "permissions": ["billing:read", "billing:write", "invoices:read", "invoices:write"]
}

Get Role

Returns a specific role by ID, including its permissions and user count.

GET/api/v1/roles/:id🔒 Auth

Get a specific role by ID.

curl https://id.vyntech.com.au/api/v1/roles/rol_01H8MNOP2Q4R6S8T \ -H "Authorization: Bearer eyJhbGciOiJFZERTQSIs..."

Update Role

Updates a role's name, description, or permissions. Users with this role will get updated permissions on their next token refresh.

PUT/api/v1/roles/:id🔒 Auth

Update a role's details and permissions.

curl -X PUT https://id.vyntech.com.au/api/v1/roles/rol_01H8MNOP2Q4R6S8T \ -H "Authorization: Bearer eyJhbGciOiJFZERTQSIs..." \ -H "Content-Type: application/json" \ -d '{ "name": "admin", "description": "Full administrative access (updated)", "permissions": ["users:read", "users:write", "roles:manage", "settings:write", "billing:read"] }'
Request Body
{
  "name": "admin",
  "description": "Full administrative access (updated)",
  "permissions": ["users:read", "users:write", "roles:manage", "settings:write", "billing:read"]
}

Delete Role

Deletes a role. All users with this role will have it removed. Cannot delete a role that is the tenant's only admin role (safety check).

DELETE/api/v1/roles/:id🔒 Auth

Delete a role and unassign from all users.

curl -X DELETE https://id.vyntech.com.au/api/v1/roles/rol_01H8UVWX4Y6Z8A0B \ -H "Authorization: Bearer eyJhbGciOiJFZERTQSIs..."

Set Role Permissions

Replaces the entire permission set for a role. This is a full replacement — any permissions not included in the array will be removed.

PUT/api/v1/roles/:id/permissions🔒 Auth

Replace all permissions for a role.

curl -X PUT https://id.vyntech.com.au/api/v1/roles/rol_01H8QRST3U5V7W9X/permissions \ -H "Authorization: Bearer eyJhbGciOiJFZERTQSIs..." \ -H "Content-Type: application/json" \ -d '{"permissions": ["posts:read", "posts:write", "posts:publish", "media:upload", "media:delete"]}'
Request Body
{
  "permissions": ["posts:read", "posts:write", "posts:publish", "media:upload", "media:delete"]
}

List Available Permissions

Returns the full list of available permissions that can be assigned to roles. Permissions follow the resource:action format.

GET/api/v1/permissions🔒 Auth

List all available permissions.

curl https://id.vyntech.com.au/api/v1/permissions \ -H "Authorization: Bearer eyJhbGciOiJFZERTQSIs..."

Authorization Check

Performs a real-time authorization check against the user's roles, permissions, and Cedar policies. Use this when your backend needs to make a complex access decision that goes beyond simple JWT permission checks.

POST/api/v1/authz/check🔒 Auth

Check if a user is authorized for a specific action on a resource.

curl -X POST https://id.vyntech.com.au/api/v1/authz/check \ -H "Authorization: Bearer eyJhbGciOiJFZERTQSIs..." \ -H "Content-Type: application/json" \ -d '{ "user_id": "usr_01H8KXYZ4F2B7NQ9RPWT3M6J", "action": "write", "resource": "posts", "context": {"department": "engineering", "post_status": "draft"} }'
Request Body
{
  "user_id": "usr_01H8KXYZ4F2B7NQ9RPWT3M6J",
  "action": "write",
  "resource": "posts",
  "context": {
    "department": "engineering",
    "post_status": "draft"
  }
}

What's Next

We use cookies and similar technologies to measure traffic and improve the site. You can choose which categories to allow. Manage Preferences.