Create access token - Platform API
Create a GetBlock Shared Node access token and get its endpoint URL. Complete guide to POST /tokens in the Platform API.
POST /tokens creates a Shared Node access token and returns it with its ready-to-use endpoint URL. The token's id and name are generated.
POST https://public-api.getblock.io/api/v1/tokensParameters
network
string
Yes
Network id, such as mainnet.
api
string
Yes
API type, such as json-rpc, ws, or graphql.
mode
string
No
Sync mode, full or archive. Default full.
region
string
No
Region, such as eu-central-1. Default eu-central-1.
Body parameters, sent as JSON.
Request Example
curl -X POST https://public-api.getblock.io/api/v1/tokens \
-H "Authorization: Bearer $GETBLOCK_API_KEY" \
-H "Content-Type: application/json" \
-d '{"protocol":"eth","network":"mainnet","api":"json-rpc","mode":"archive","region":"eu-central-1"}'const response = await fetch('https://public-api.getblock.io/api/v1/tokens', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.GETBLOCK_API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({ protocol: 'eth', network: 'mainnet', api: 'json-rpc', mode: 'archive', region: 'eu-central-1' })
});
const body = await response.json();
console.log(body.endpoint);import os
import requests
body = requests.post(
"https://public-api.getblock.io/api/v1/tokens",
headers={"Authorization": f"Bearer {os.environ['GETBLOCK_API_KEY']}"},
json={"protocol": "eth", "network": "mainnet", "api": "json-rpc", "mode": "archive", "region": "eu-central-1"},
).json()
print(body["endpoint"])Response Example
201 Created:
Response Parameters
id
string
The access token, the credential inside endpoint. Treat it as a secret.
name
string
Generated name, such as eth-9b279.
status
string
active, or locked when suspended by plan or billing state.
namespace
string
Access type the token was issued for, such as shared.
protocol
string
Protocol id.
network
string
Network id.
api
string
API type served on the endpoint.
mode
string
Sync mode. Empty when it does not apply.
region
string
Region serving the endpoint.
addon
string
Add-on bound to the token. Empty when none.
dedicated_node_id
string
Set only for tokens bound to a Dedicated Node.
limitless_node_id
string
Set only for tokens bound to a Limitless Node.
endpoint
string
Ready-to-use RPC URL.
created_at, updated_at
string
RFC 3339 UTC times.
Use Cases
Provision an endpoint per environment from a deployment script
Give each customer or service its own token, so one can be rotated without touching the others
Create an MEV-protected endpoint by passing
"addon": "mevprotected"
Error Handling
400
A required field is missing, or the combination is not served. The error field says which.
401
Missing or invalid API key.
403
Your plan does not allow it: the token limit is reached, or the network or region needs a paid plan.
429
Too many requests. Wait and retry.
502
A GetBlock service behind the API did not answer. Retry later.
Error bodies carry an error message and a request_id. See Errors.
Last updated
Was this helpful?