Delete access token - Platform API

DELETE /tokens/{id} deletes one of your tokens, whatever its access type. The token stops working immediately.

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

This cannot be undone. Every client still using the token's endpoint URL starts failing. To replace a leaked token with a working one, rotate it instead.

Parameters

ParameterTypeRequiredDescription
idstringYesPath parameter. The token's id.

Request Example

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

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

console.log(response.status); // 204
pythonimport os
import requests

token_id = "9b2796d7b4c448de83b01644bb93f625"

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

print(response.status_code)  # 204

Response Example

204 No Content, without a body.

Response Parameters

None.

Use Cases

  • Remove endpoints of a service you shut down
  • Free a slot when you reach the plan's token limit
  • Revoke access for a customer who left your service

Error Handling

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

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