Overview
The API v2 requires an API key for all methods, including the JSON-RPC endpoint. The key can be sent either in an HTTP header or as a query parameter. To obtain an API key, see the TON Center API key guide.| Type | Location | Name | Required |
|---|---|---|---|
| API key | Header | X-API-Key | Yes |
| API key | Query | api_key | Yes |
REST endpoints authentication
Header authentication
Send the API key in theX-API-Key header:
<HOST>- The base URL of the TON Center API instance (toncenter.comfor example).<API_KEY>- The API key obtained from the TON Center bot.
Query parameter authentication
Pass the key as a query parameter namedapi_key:
JSON-RPC endpoints authentication
Endpoint:POST /api/v2/jsonRPC
The same API key rules apply. Example using header authentication: