palbaseDocs

Palbase Auth API · API

PUT/admin/roles/{name}

Create or replace a role

Creates the role or replaces its definition; running it twice is harmless. The permission list is replaced, not merged. Users holding the role get the new permission set. Answers the full role list.

Called by your server, with the project's secret key.

Path

namestring · requiredThe role name: lowercase letters, digits and underscore, at most 64. Postgres role names (anon, authenticated, service_role) and the backend_ prefix are reserved.

Request body

descriptionstring · optional
is_defaultboolean · optionalRefused while another role is the default.
permissionsstring[] · optional
curl
curl -X PUT "https://<your-ref>.palbase.studio/admin/roles/<name>" \
  -H "apikey: $PALBASE_SECRET_KEY" \
  -H "content-type: application/json" \
  -d '{"description":"string","is_default":false,"permissions":["string"]}'

Responses

200Every role, after the write

400Validation failed or required field missing

401Missing, invalid, or expired credentials

403Not permitted with this key; or the project is the platform's own (`owner_only`): every change on its admin surface — any account's address, password, factors, sessions or roles, an account made or imported, a sign-in minted, a setting — is its owner's or its operator's alone. The request carries, besides the project's key, the owner's access token (X-Palbase-Owner; a passkey sign-in of the last 15 minutes, else 401 `insufficient_user_authentication`) or the operator's token (X-Palbase-Operator). Its key reads.

503Downstream dependency unavailable (typically HIBP / breach service)

defaultAn error: the envelope names it (`error`) and explains it (`error_description`).

Operation AdminUpsertRole of auth's contract.