Chelabase
ManagementRoles

Change a role

PATCH
/v1/databases/{id}/branches/{branch_id}/roles/{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
AuthorizationBearer <token>

In: header

Path Parameters

id*string

Database id

Formatuuid
branch_id*string

Branch id

Formatuuid
role*string

Role name

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

A change to a role: only the fields given change.

bypass_rls?boolean|null
connection_limit?|

-1 is no limit.

Formatint32
inherit?boolean|null
login?|

Turning LOGIN on generates a password (read it with the connection details and role); turning it off drops the password.

member_of?array<string>|

The new list of the role's other memberships, with the create's rules (pg_* and Chelabase's own groups stay).

owner_level?|

Owner-level on (CREATEROLE, CREATEDB, BYPASSRLS, REPLICATION, neon_superuser) or off.

valid_until?|

null clears the expiry.

Formatdate-time

Response 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"}