Skip to main content

secrets

Creates, updates, deletes, gets or lists a secrets resource.

Overview​

Namesecrets
TypeResource
Idcloudflare.secrets_store.secrets

Fields​

The following fields are returned by SELECT queries:

secret detail

NameDatatypeDescription
idstringSecret identifier tag. (example: 3fd85f74b32742f1bff64a85009dda07)
namestringThe name of the secret (example: MY_API_KEY)
store_idstringStore Identifier (example: 023e105f4ecef8ad9ca31a8372d0c353)
commentstringFreeform text describing the secret (example: info about my secret)
createdstring (date-time)Whenthe secret was created. (example: 2023-09-21T18:56:32.624632Z)
modifiedstring (date-time)When the secret was modified. (example: 2023-09-21T18:56:32.624632Z)
scopesarrayThe list of services that can use this secret.
statusstring (pending, active, deleted)

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_by_accountselectaccount_id, store_id, secret_idReturns details of a single secret
get_by_systemselectaccount_tag, store_id, secret_idReturns details of a single secret from a store managed by the calling service. Returns 404 if the store doesn't exist or is not managed by the authenticated service.
list_by_accountselectaccount_id, store_iddirection, page, per_page, search, order, scopesLists all store secrets
list_by_systemselectaccount_tag, store_iddirection, page, per_page, search, order, scopesLists all secrets in a store managed by the calling service. Returns 404 if the store doesn't exist or is not managed by the authenticated service.
duplicate_by_accountinsertaccount_id, store_id, secret_id, name, scopesDuplicates the secret, keeping the value
secrets_store_secret_createinsertaccount_id, store_idCreates a secret in the account
secrets_store_system_secret_createinsertaccount_tag, store_idCreates one or more secrets in a store managed by the calling service. Returns 404 if the store doesn't exist or is not managed by the authenticated service.
editupdateaccount_id, store_id, secret_idUpdates a single secret
secrets_store_system_patch_by_idupdateaccount_tag, store_id, secret_idUpdates a single secret in a store managed by the calling service. Returns 404 if the store doesn't exist or is not managed by the authenticated service.
deletedeleteaccount_id, store_id, secret_idDeletes a single secret
secrets_store_system_secret_delete_by_iddeleteaccount_tag, store_id, secret_idDeletes a single secret from a store managed by the calling service. Returns 404 if the store doesn't exist or is not managed by the authenticated service.
bulk_deletedeleteaccount_id, store_idDeletes one or more secrets
secrets_store_system_delete_bulkdeleteaccount_tag, store_idDeletes one or more secrets from a store managed by the calling service. Returns 404 if the store doesn't exist or is not managed by the authenticated service.
duplicate_by_systemexecaccount_tag, store_id, secret_id, name, scopesDuplicates a secret in a store managed by the calling service, keeping the value. Returns 404 if the store doesn't exist or is not managed by the authenticated service.

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
account_idstringThe Cloudflare account ID.
account_tagstringAccount tag identifier (e.g., '12a6ed19f349896cfbd6694ba3de8d31'). This is the account's external tag identifier, not the numeric account ID.
secret_idstringThe secret ID.
store_idstringThe secrets store ID.
directionstringDirection to sort objects
orderstringOrder secrets by values in the given field
pageintegerPage number
per_pageintegerNumber of objects to return per page
scopesarrayOnly secrets with the given scopes will be returned

SELECT examples​

Returns details of a single secret

SELECT
id,
name,
store_id,
comment,
created,
modified,
scopes,
status
FROM cloudflare.secrets_store.secrets
WHERE account_id = '{{ account_id }}' -- required
AND store_id = '{{ store_id }}' -- required
AND secret_id = '{{ secret_id }}' -- required
;

INSERT examples​

Duplicates the secret, keeping the value

INSERT INTO cloudflare.secrets_store.secrets (
comment,
name,
scopes,
account_id,
store_id,
secret_id
)
SELECT
'{{ comment }}',
'{{ name }}' /* required */,
'{{ scopes }}' /* required */,
'{{ account_id }}',
'{{ store_id }}',
'{{ secret_id }}'
RETURNING
errors,
messages,
result,
result_info,
success
;

UPDATE examples​

Updates a single secret

UPDATE cloudflare.secrets_store.secrets
SET
comment = '{{ comment }}',
scopes = '{{ scopes }}',
value = '{{ value }}'
WHERE
account_id = '{{ account_id }}' --required
AND store_id = '{{ store_id }}' --required
AND secret_id = '{{ secret_id }}' --required
RETURNING
errors,
messages,
result,
result_info,
success;

DELETE examples​

Deletes a single secret

DELETE FROM cloudflare.secrets_store.secrets
WHERE account_id = '{{ account_id }}' --required
AND store_id = '{{ store_id }}' --required
AND secret_id = '{{ secret_id }}' --required
;

Lifecycle Methods​

Duplicates a secret in a store managed by the calling service, keeping the value. Returns 404 if the store doesn't exist or is not managed by the authenticated service.

EXEC cloudflare.secrets_store.secrets.duplicate_by_system
@account_tag='{{ account_tag }}' --required,
@store_id='{{ store_id }}' --required,
@secret_id='{{ secret_id }}' --required
@@json=
'{
"comment": "{{ comment }}",
"name": "{{ name }}",
"scopes": "{{ scopes }}"
}'
;