Chelabase
ManagementKeys

Change which databases a key may reach

PATCH
/v1/databases/{id}/branches/{branch_id}/keys/{key_id}

Replaces the key's database list on a secret or the public key. databases is required: a list of 1 to 20 databases of the branch (a disabled one is allowed; it is just not served), or null for every served database. Rest forgets the branch's cached state when the list changes. The gateway caches a key for up to 30 seconds, so a narrowed list applies to new requests within 30 seconds of the answer, not at once.

Authorization

bearer
AuthorizationBearer <token>

In: header

Path Parameters

id*string

Database id

Formatuuid
branch_id*string

Branch id

Formatuuid
key_id*string

Key id

Formatuuid

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Which databases a key may reach. databases has no default, so an empty body can't widen a key to every database by accident.

databases*array<string>|

The Postgres databases the key may reach (1 to 20 databases of the branch, disabled ones included), or null for every served database. Required.

Response Body

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/keys/497f6eca-6276-4993-bfeb-53cbbbba6f08" \  -H "Content-Type: application/json" \  -d '{    "databases": [      "string"    ]  }'
{  "bypasses_rls": true,  "created_at": "2019-08-24T14:15:22Z",  "databases": [    "string"  ],  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",  "key": "string",  "kind": "public",  "last_used_at": "2019-08-24T14:15:22Z",  "name": "string",  "prefix": "string",  "role": "string",  "role_blocked": true}