Skip to main content

tokens

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

Overview

Nametokens
TypeResource
Idcloudflare.workers.tokens

Fields

The following fields are returned by SELECT queries:

Build tokens retrieved successfully

NameDatatypeDescription
cloudflare_token_idstring (example: cf-token-123)
build_token_namestring (example: My Build Token)
build_token_uuidstring (uuid)Build token UUID.
owner_typestring (example: user)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
listselectaccount_idpage, per_pageGet all build tokens with pagination
create_build_tokeninsertaccount_id, build_token_name, build_token_secret, cloudflare_token_idCreate a new build authentication token
delete_build_tokendeleteaccount_id, build_token_uuidRemove a build authentication token

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.
build_token_uuidstring (uuid)
pageintegerPage number for pagination
per_pageintegerNumber of items per page

SELECT examples

Get all build tokens with pagination

SELECT
cloudflare_token_id,
build_token_name,
build_token_uuid,
owner_type
FROM cloudflare.workers.tokens
WHERE account_id = '{{ account_id }}' -- required
AND page = '{{ page }}'
AND per_page = '{{ per_page }}'
;

INSERT examples

Create a new build authentication token

INSERT INTO cloudflare.workers.tokens (
build_token_name,
build_token_secret,
cloudflare_token_id,
account_id
)
SELECT
'{{ build_token_name }}' /* required */,
'{{ build_token_secret }}' /* required */,
'{{ cloudflare_token_id }}' /* required */,
'{{ account_id }}'
RETURNING
errors,
messages,
result,
result_info,
success
;

DELETE examples

Remove a build authentication token

DELETE FROM cloudflare.workers.tokens
WHERE account_id = '{{ account_id }}' --required
AND build_token_uuid = '{{ build_token_uuid }}' --required
;