Rotate Storefront Token
curl --request POST \
--url https://api.example.com/api/dashboard/storefront-tokens/{key_id}/rotateimport requests
url = "https://api.example.com/api/dashboard/storefront-tokens/{key_id}/rotate"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.example.com/api/dashboard/storefront-tokens/{key_id}/rotate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/dashboard/storefront-tokens/{key_id}/rotate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/dashboard/storefront-tokens/{key_id}/rotate"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/dashboard/storefront-tokens/{key_id}/rotate")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/dashboard/storefront-tokens/{key_id}/rotate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"key_id": "<string>",
"secret_prefix": "<string>",
"name": "<string>",
"scopes": [
"<string>"
],
"allowed_origins": [
"<string>"
],
"created_at": "2023-11-07T05:31:56Z",
"last_used_at": "2023-11-07T05:31:56Z",
"revoked_at": "2023-11-07T05:31:56Z",
"secret": "<string>",
"rotated_from_key_id": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Dashboard
Rotate Storefront Token
Rotate a token: mint a fresh one carrying the old name/scopes/
allowed_origins, then revoke the old. The new plaintext secret
is returned exactly once.
POST
/
api
/
dashboard
/
storefront-tokens
/
{key_id}
/
rotate
Rotate Storefront Token
curl --request POST \
--url https://api.example.com/api/dashboard/storefront-tokens/{key_id}/rotateimport requests
url = "https://api.example.com/api/dashboard/storefront-tokens/{key_id}/rotate"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.example.com/api/dashboard/storefront-tokens/{key_id}/rotate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/dashboard/storefront-tokens/{key_id}/rotate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/dashboard/storefront-tokens/{key_id}/rotate"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/dashboard/storefront-tokens/{key_id}/rotate")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/dashboard/storefront-tokens/{key_id}/rotate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"key_id": "<string>",
"secret_prefix": "<string>",
"name": "<string>",
"scopes": [
"<string>"
],
"allowed_origins": [
"<string>"
],
"created_at": "2023-11-07T05:31:56Z",
"last_used_at": "2023-11-07T05:31:56Z",
"revoked_at": "2023-11-07T05:31:56Z",
"secret": "<string>",
"rotated_from_key_id": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Path Parameters
Response
Successful Response
Response from POST /storefront-tokens/{key_id}/rotate. Carries
both the new token's metadata + plaintext secret AND the previous
key_id that was revoked, so the dashboard can confirm the swap.
The plaintext storefront secret (stk_sec_<...>). Returned only at creation time; not recoverable later.
The key_id of the token that was just revoked.