Create an access token

POST https://{{host}}/edgekv/v1/tokens

Generate an access token that allows an EdgeWorkers code bundle to access the specified namespace. Each token name needs to be unique and have a defined expiration of no longer than six months. You can't renew a token once it expires. To learn more about access tokens, refer to the EdgeKV guide.

Request Params

KeyDatatypeRequiredDescription
accountSwitchKeystring(Optional) For customers who manage more than one account, this runs the operation from another account. The Identity and Access Management API provides a list of available account switch keys.

Request Body

{"allowOnProduction"=>false, "allowOnStaging"=>true, "expiry"=>"2021-09-30", "name"=>"my_token", "namespacePermissions"=>{"marketing"=>["r", "w"]}}

HEADERS

KeyDatatypeRequiredDescription
Content-Typestring
Acceptstring

RESPONSES

status: OK

{"expiry":"2021-09-30","name":"my_token","uuid":"fa3a7ae0-1b0c-45c7-adc3-f0638c6b7466","value":"xxxxxxxxxxxxxxxxxxxxxxxxxxxx"}