API Reference
Branch Memberships
/api/v1/console/users/{userId}/memberships JWT API KeyA user's branch grants and organisation-admin flag.,
`include_revoked` adds the tombstoned rows. They are off by default: a revoked grant and a live one mean opposite things, and a panel that mixed them would be answering a different question from the one it was opened to answer.
- Capability
manage_users- API key scope
cap:manage_users(the key's owner must also hold the capability)
Path parameters
| userIdrequired string (uuid) | — |
Query parameters
| include_revoked boolean | — |
| Sort string | A snake_case column key from the endpoint's allow-list (`created_at`, `gross_total`, `status` …). Absent or blank → the endpoint's default order. |
| Dir string | `asc` (the default when Panoptes.Application.Common.SortableRequest.Sort is present) or `desc`. Ignored without a sort. |
Responses
curl -X GET "https://staging-api.panoptesos.com/api/v1/console/users/{userId}/memberships" \
-H "X-Api-Key: <YOUR_API_KEY>"Path parameters
Query parameters
Headers
/api/v1/console/users/{userId}/memberships JWTGrant a branch.,,
The body names the branch, and the service proves it belongs to the caller's own organisation before writing — a branch outside it reads as `NOT_FOUND`. An optional `role_id` sets the per-branch role, which is the person's whole role at that branch: it beats the organisation-level role in every capability check there (`PrincipalResolver.EffectiveRoleAsync`, MUL-8), not only the manager passcode.
- Capability
manage_users- Signed-in user only
- API keys and OAuth tokens are refused (403). Do this in the dashboard.
Path parameters
| userIdrequired string (uuid) | — |
Request body
{
"branchId": "00000000-0000-0000-0000-000000000000",
"roleId": "00000000-0000-0000-0000-000000000000"
}| branchId string (uuid) | The branch to grant. Must be inside the caller's organisation. |
| roleId string (uuid) | The role the user holds <b>in that branch</b>, as a live `Role.id`. <br>Optional: omitted, the membership copies the user's organisation-level role at the moment of granting (BR-TEN-17), and from then on follows it when that role changes on the team screen — but only a role that exists in that branch (active, and platform-wide or the branch's own); a role defined only in the person's home branch cannot be inherited, and the grant must name one. Supplied, it is the per-branch role — the person's whole role at that branch, which beats the org-level one in every capability check there (MUL-8, FR-TEN-099, SRS §4.6.5). Granting a role here therefore grants real power in that branch, which is why it must resolve to a live, assignable row rather than an arbitrary string. |
Responses
curl -X POST "https://staging-api.panoptesos.com/api/v1/console/users/{userId}/memberships" \
-H "Content-Type: application/json" \
-H "X-Api-Key: <YOUR_API_KEY>" \
-d '{
"branchId": "00000000-0000-0000-0000-000000000000",
"roleId": "00000000-0000-0000-0000-000000000000"
}'Path parameters
Request body (JSON)
Headers
/api/v1/console/users/{userId}/memberships/{branchId} JWTChange a live grant's role in place.,
The same gate as granting, its own audit verb, and a session-version bump. The home grant is refused: its role is the organisation-level role, changed on the team screen.
- Capability
manage_users- Signed-in user only
- API keys and OAuth tokens are refused (403). Do this in the dashboard.
Path parameters
| userIdrequired string (uuid) | — |
| branchIdrequired string (uuid) | — |
Request body
{
"roleId": "00000000-0000-0000-0000-000000000000"
}| roleId string (uuid) | A live `Role.id`, platform-wide or belonging to the grant's own branch. |
Responses
curl -X PATCH "https://staging-api.panoptesos.com/api/v1/console/users/{userId}/memberships/{branchId}" \
-H "Content-Type: application/json" \
-H "X-Api-Key: <YOUR_API_KEY>" \
-d '{
"roleId": "00000000-0000-0000-0000-000000000000"
}'Path parameters
Request body (JSON)
Headers
/api/v1/console/users/{userId}/memberships/{branchId} JWTRevoke a branch
A tombstone with a mandatory reason, never a hard delete — keeps the row so the revocation itself stays auditable. The user's session version is bumped, so the access is gone on the next request rather than at token expiry. The home-branch grant is refused (`HOME_BRANCH_GRANT`): session resolution always re-adds the home branch.
- Capability
manage_users- Signed-in user only
- API keys and OAuth tokens are refused (403). Do this in the dashboard.
Path parameters
| userIdrequired string (uuid) | — |
| branchIdrequired string (uuid) | — |
Request body
{
"reason": "string"
}| reason string | — |
Responses
curl -X DELETE "https://staging-api.panoptesos.com/api/v1/console/users/{userId}/memberships/{branchId}" \
-H "X-Api-Key: <YOUR_API_KEY>"Path parameters
Headers
/api/v1/console/users/{userId}/org-admin JWTPromote or demote an organisation administrator.,
This one boolean is the entire HQ gate — not `view_hq`, and not "holds several memberships". The service additionally requires the caller to hold the flag themselves, so `manage_users` alone cannot be used to escalate into the organisation console.
- Capability
manage_users- Signed-in user only
- API keys and OAuth tokens are refused (403). Do this in the dashboard.
Path parameters
| userIdrequired string (uuid) | — |
Request body
{
"isOrgAdmin": false,
"reason": "string"
}| isOrgAdmin boolean | — |
| reason string | Why. Recorded in the audit payload; required in both directions. |
Responses
curl -X PATCH "https://staging-api.panoptesos.com/api/v1/console/users/{userId}/org-admin" \
-H "Content-Type: application/json" \
-H "X-Api-Key: <YOUR_API_KEY>" \
-d '{
"isOrgAdmin": false,
"reason": "string"
}'Path parameters
Request body (JSON)
Headers