Skip to main content

api_keys

Creates, updates, deletes, gets or lists an api_keys resource.

Overview​

Nameapi_keys
TypeResource
Idsupabase.secrets.api_keys

Fields​

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstring
namestring
api_keystring
descriptionstring
hashstring
inserted_atstring (date-time) (pattern: <code>^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:.\d+)?)?(?:Z))$</code>)
prefixstring
secret_jwt_templateobject
typestring (legacy, publishable, secret, )
updated_atstring (date-time) (pattern: <code>^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:.\d+)?)?(?:Z))$</code>)

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectid, refreveal
listselectrefreveal
createinsertref, type, namereveal
updateupdateid, refreveal
deletedeleteid, refreveal, was_compromised, reason

Parameters​

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
idstring (uuid)
refstringSupabase project reference (the Project ID shown in the dashboard under Settings -> General; 20 lowercase letters). Resolved from the SUPABASE_PROJECT_ID environment variable when it is set (x-stackQL-envVar); otherwise it must be supplied on every project-scoped query as WHERE ref = '<ref>'. A WHERE value always takes precedence over the environment. (x-stackQL-envVar: SUPABASE_PROJECT_ID)
reasonstring
revealstringBoolean string, true or false
was_compromisedstringBoolean string, true or false

SELECT examples​

No description available.

SELECT
id,
name,
api_key,
description,
hash,
inserted_at,
prefix,
secret_jwt_template,
type,
updated_at
FROM supabase.secrets.api_keys
WHERE id = '{{ id }}' -- required
AND ref = '{{ ref }}' -- required unless SUPABASE_PROJECT_ID is set
AND reveal = '{{ reveal }}'
;

INSERT examples​

No description available.

INSERT INTO supabase.secrets.api_keys (
type,
name,
description,
secret_jwt_template,
ref,
reveal
)
SELECT
'{{ type }}' /* required */,
'{{ name }}' /* required */,
'{{ description }}',
'{{ secret_jwt_template }}',
'{{ ref }}',
'{{ reveal }}'
RETURNING
id,
name,
api_key,
description,
hash,
inserted_at,
prefix,
secret_jwt_template,
type,
updated_at
;

UPDATE examples​

No description available.

UPDATE supabase.secrets.api_keys
SET
name = '{{ name }}',
description = '{{ description }}',
secret_jwt_template = '{{ secret_jwt_template }}'
WHERE
id = '{{ id }}' --required
AND ref = '{{ ref }}' --required unless SUPABASE_PROJECT_ID is set
AND reveal = '{{ reveal}}'
RETURNING
id,
name,
api_key,
description,
hash,
inserted_at,
prefix,
secret_jwt_template,
type,
updated_at;

DELETE examples​

No description available.

DELETE FROM supabase.secrets.api_keys
WHERE id = '{{ id }}' --required
AND ref = '{{ ref }}' --required unless SUPABASE_PROJECT_ID is set
AND reveal = '{{ reveal }}'
AND was_compromised = '{{ was_compromised }}'
AND reason = '{{ reason }}'
;