Change a role
Changes a role's LOGIN, owner level, attributes or memberships; fields left out stay as they are, and valid_until: null clears the expiry. Turning LOGIN on generates a password (read it with the connection details and role); turning it off drops the password. member_of replaces the list of the role's other memberships (pg_* and Chelabase's own groups stay). Works on roles made through the API, and on roles made in SQL that the owner administers; the owner can't be changed. A change starts from the role as SQL left it: SQL controls every role's attributes and memberships. Turning LOGIN on counts toward the branch's login-role cap. Answers with the role, never a password.
Authorization
bearer In: header
Path Parameters
Database id
uuidBranch id
uuidRole name
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
A change to a role: only the fields given change.
-1 is no limit.
int32Turning LOGIN on generates a password (read it with the connection details and
role); turning it off drops the password.
The new list of the role's other memberships, with the create's rules
(pg_* and Chelabase's own groups stay).
Owner-level on (CREATEROLE, CREATEDB, BYPASSRLS, REPLICATION, neon_superuser) or off.
null clears the expiry.
date-timeResponse Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X PATCH "https://example.com/v1/databases/497f6eca-6276-4993-bfeb-53cbbbba6f08/branches/497f6eca-6276-4993-bfeb-53cbbbba6f08/roles/string" \ -H "Content-Type: application/json" \ -d '{}'{ "blocked_keys": [ { "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "name": "string" } ], "bypass_rls": true, "connection_limit": 0, "created_at": "2019-08-24T14:15:22Z", "guard_exempt": true, "inherit": true, "level": "plain", "login": true, "member_admin": [ "string" ], "member_no_set": [ "string" ], "member_of": [ "string" ], "name": "string", "origin": "owner", "password": "generated", "pending": true, "valid_until": "2019-08-24T14:15:22Z"}Create a role POST
Creates a role and answers with it. A LOGIN role (the default) gets a generated password; `login: false` makes a NOLOGIN role (a group) with none. `owner_level` gives it the owner's attributes (CREATEROLE, CREATEDB, BYPASSRLS, REPLICATION) and makes it a member of `neon_superuser`. `inherit`, `connection_limit`, `valid_until`, `bypass_rls` and `member_of` set the other allowed attributes and memberships; nothing else can be set. The password isn't in the answer: read it with the connection details and `role`. A role the compute couldn't take yet is `pending` and applied later.
Delete a login role DELETE
Deletes a role. Its objects in every database go to `successor` (never the owner): a role the owner can `SET ROLE` to that isn't owner-level, reserved or a personal login, or `chelabase_orphaned` (the default), a powerless role. Databases it owns go to the owner. PUBLIC loses EXECUTE on every routine that moved, and the answer lists the `SECURITY DEFINER` ones for review. Refused while a data API key uses it (`role_in_use`, with the keys in `keys`). The owner can't be deleted. A named successor that would let other roles run the role's `SECURITY DEFINER` routines or read its views without `security_invoker` with the successor's rights needs `confirm`, the current token of the delete's preview (`GET …/roles/{role}/delete-preview`); the grants are kept. `chelabase_orphaned` never needs one.