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.

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


RolesAuth

List all roles in the current tenant.

Status Codes

  • Name
    200
    Type
    HTTP
    Description
    Roles list returned
  • Name
    401
    Type
    HTTP
    Description
    Invalid or expired access token
Request
GET/api/v1/roles
Response 200

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.


RoleAuth

Create a new role with specified permissions.

Payload Example

{
  "name": "billing-admin",
  "description": "Manage billing and invoices",
  "permissions": ["billing:read", "billing:write", "invoices:read", "invoices:write"]
}

Status Codes

  • Name
    201
    Type
    HTTP
    Description
    Role created
  • Name
    401
    Type
    HTTP
    Description
    Invalid or expired access token
  • Name
    403
    Type
    HTTP
    Description
    Missing roles:manage permission
  • Name
    409
    Type
    HTTP
    Description
    Role name already exists in this tenant
  • Name
    422
    Type
    HTTP
    Description
    Invalid permission format
Request
POST/api/v1/roles
Response 201

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


RoleAuth

Get a specific role by ID.

Status Codes

  • Name
    200
    Type
    HTTP
    Description
    Role returned
  • Name
    401
    Type
    HTTP
    Description
    Invalid or expired access token
  • Name
    404
    Type
    HTTP
    Description
    Role not found
Request
GET/api/v1/roles/:id
Response 200

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


RoleAuth

Update a role's details and permissions.

Payload Example

{
  "name": "admin",
  "description": "Full administrative access (updated)",
  "permissions": ["users:read", "users:write", "roles:manage", "settings:write", "billing:read"]
}

Status Codes

  • Name
    200
    Type
    HTTP
    Description
    Role updated
  • Name
    401
    Type
    HTTP
    Description
    Invalid or expired access token
  • Name
    403
    Type
    HTTP
    Description
    Missing roles:manage permission
  • Name
    404
    Type
    HTTP
    Description
    Role not found
  • Name
    409
    Type
    HTTP
    Description
    Role name conflict
Request
PUT/api/v1/roles/:id
Response 200

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).


RoleAuth

Delete a role and unassign from all users.

Status Codes

  • Name
    200
    Type
    HTTP
    Description
    Role deleted
  • Name
    401
    Type
    HTTP
    Description
    Invalid or expired access token
  • Name
    403
    Type
    HTTP
    Description
    Missing roles:manage permission
  • Name
    404
    Type
    HTTP
    Description
    Role not found
  • Name
    409
    Type
    HTTP
    Description
    Cannot delete the last admin role
Request
DELETE/api/v1/roles/:id
Response 200

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


Set Role PermissionsAuth

Replace all permissions for a role.

Payload Example

{
  "permissions": ["posts:read", "posts:write", "posts:publish", "media:upload", "media:delete"]
}

Status Codes

  • Name
    200
    Type
    HTTP
    Description
    Permissions updated
  • Name
    401
    Type
    HTTP
    Description
    Invalid or expired access token
  • Name
    403
    Type
    HTTP
    Description
    Missing roles:manage permission
  • Name
    404
    Type
    HTTP
    Description
    Role not found
Request
PUT/api/v1/roles/:id/permissions
Response 200

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


Available PermissionsAuth

List all available permissions.

Status Codes

  • Name
    200
    Type
    HTTP
    Description
    Permissions list returned
  • Name
    401
    Type
    HTTP
    Description
    Invalid or expired access token
Request
GET/api/v1/permissions
Response 200

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.


Authorization CheckAuth

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

Payload Example

{
  "user_id": "usr_01H8KXYZ4F2B7NQ9RPWT3M6J",
  "action": "write",
  "resource": "posts",
  "context": {
    "department": "engineering",
    "post_status": "draft"
  }
}

Status Codes

  • Name
    200
    Type
    HTTP
    Description
    Authorization decision returned
  • Name
    401
    Type
    HTTP
    Description
    Invalid or expired access token
  • Name
    404
    Type
    HTTP
    Description
    User not found
Request
POST/api/v1/authz/check
Response 200

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.