Skip to main content
POST
/
v1
/
keys
/
{id}
/
rotate
Rotate an API key
import requests

url = "https://api.13-215-85-171.sslip.io/v1/keys/{id}/rotate"

payload = {
    "name": "<string>",
    "scope": "<string>"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
{
  "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "key": "ns_live_a1b2c3d4e5f67890a1b2c3d4e5f67890",
  "prefix": "ns_live_a1b2",
  "name": "<string>",
  "scope": "<string>",
  "expires_at": "2023-11-07T05:31:56Z"
}

Authorizations

Authorization
string
header
required

Supabase Auth access token passed as Bearer token

Path Parameters

id
string<uuid>
required

API key ID

Body

application/json
name
string | null

Optional human-readable key label.

scope
string | null

Optional advisory free-text scope label (T08 Phase 10). Persisted on the row and surfaced by the console KeysPage, but not enforced server-side at request time.

Response

Replacement API key created

id
string<uuid>
required
key
string
required

Plaintext API key returned only at creation time.

Example:

"ns_live_a1b2c3d4e5f67890a1b2c3d4e5f67890"

prefix
string
required

Stored display prefix for identifying the key.

Example:

"ns_live_a1b2"

name
string | null
scope
string | null

Echo of the advisory scope label provided at creation, if any.

expires_at
string<date-time> | null

Expiration time when returned from a rotation flow; null for normal keys.