Rotate access token - Platform API

POST /tokens/{id}/rotate replaces a token with a new one of the same configuration and returns the replacement. Rotation is how a leaked token is retired.

POST https://public-api.getblock.io/api/v1/tokens/{id}/rotate

The replacement has a different id and a different endpoint. The old token stops working when the call returns, and its id is no longer found. Store the response and update every place the old endpoint was used.

Parameters

ParameterTypeRequiredDescription
idstringYesPath parameter. The id of the token to retire.

Request Example

bashcurl -X POST https://public-api.getblock.io/api/v1/tokens/9b2796d7b4c448de83b01644bb93f625/rotate \
  -H "Authorization: Bearer $GETBLOCK_API_KEY"
javascriptconst tokenId = '9b2796d7b4c448de83b01644bb93f625';

const response = await fetch(`https://public-api.getblock.io/api/v1/tokens/${tokenId}/rotate`, {
  method: 'POST',
  headers: { Authorization: `Bearer ${process.env.GETBLOCK_API_KEY}` }
});
const body = await response.json();

console.log(body.endpoint);
pythonimport os
import requests

token_id = "9b2796d7b4c448de83b01644bb93f625"

body = requests.post(
    f"https://public-api.getblock.io/api/v1/tokens/{token_id}/rotate",
    headers={"Authorization": f"Bearer {os.environ['GETBLOCK_API_KEY']}"},
).json()

print(body["endpoint"])

Response Example

201 Created:

json{
  "id": "4f1c8a2e6b9d47f3a05c2e8b71d4f960",
  "name": "eth-4f1c8",
  "status": "active",
  "namespace": "shared",
  "protocol": "eth",
  "network": "mainnet",
  "api": "json-rpc",
  "mode": "archive",
  "region": "eu-central-1",
  "addon": "",
  "dedicated_node_id": "",
  "limitless_node_id": "",
  "endpoint": "https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/",
  "created_at": "2026-10-15T09:41:07Z",
  "updated_at": "2026-10-15T09:41:07Z"
}

Response Parameters

FieldTypeDescription
idstringThe access token, the credential inside endpoint. Treat it as a secret.
namestringGenerated name, such as eth-9b279.
statusstringactive, or locked when suspended by plan or billing state.
namespacestringAccess type the token was issued for, such as shared.
protocolstringProtocol id.
networkstringNetwork id.
apistringAPI type served on the endpoint.
modestringSync mode. Empty when it does not apply.
regionstringRegion serving the endpoint.
addonstringAdd-on bound to the token. Empty when none.
dedicated_node_idstringSet only for tokens bound to a Dedicated Node.
limitless_node_idstringSet only for tokens bound to a Limitless Node.
endpointstringReady-to-use RPC URL.
created_at, updated_atstringRFC 3339 UTC times.

Use Cases

  • Retire a token that leaked in a log, a commit, or a client bundle
  • Rotate endpoints on a schedule from CI, then redeploy with the new URL in the same job

Error Handling

HTTPCause
401Missing or invalid API key.
404No such token among yours, or it was already rotated.
502A GetBlock service behind the API did not answer. Retry later.

Error bodies carry an error message and a request_id. See Errors.