Auth API reference

Auth API · Roles

put/v1/apps/{app_id}/roles/{role_name}/permissionsAuth

Set permissions for a role (caller-narrowed: caller must hold every requested permission)

Path parameters

app_id*string

Id of the app.

role_name*string

Name of the role (e.g. `admin`).

Request body

permissions*array

Array of permission strings in resource.action format

Example: ["user.read","role.create"]

Response · 200 Permissions updated. Returns the set the role now holds — the write is caller-narrowed, so the resulting set is what the caller needs to see.

Array of object

id*string

Unique identifier of the role permission.

resource*string

Resource half of the permission key (`resource.action`).

Example: "user"

action*string

Action half of the permission key (`resource.action`).

Example: "read"

description*string

Free-text description of the role permission, or `null`.

Example

Request

PUT https://api.auth.productcraft.co/v1/apps/{app_id}/roles/{role_name}/permissions
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json

{
  "permissions": [
    "user.read",
    "role.create"
  ]
}

Response

[
  {
    "id": "string",
    "resource": "user",
    "action": "read",
    "description": "string"
  }
]