🔓Authentication

Utilizing Your API Key

To interact with the VeChainStats API, you have the flexibility to employ any server-side programming language capable of making HTTP requests. All requests must be directed towards the domain https://api.vechainstats.com/v2/. You have two options for incorporating your API Key into REST API calls:

  1. Preferred approach: Through a dedicated custom header named X-API-Key.

In your application, you need to add the API Key to the header of your requests for authentication. Below we provide some code examples to add the API Key to the header in different environments:

curl -X GET "https://api.vechainstats.com/v2/network/totals" -H "X-API-Key: YOUR_API_KEY_HERE"

Replace "YOUR_API_KEY" with your actual API key.

  1. Convenience method: By including it as a query string parameter named VCS_API_KEY.

Example request:

https://api.vechainstats.com/v2/account/vet-vtho
    ?address=0xd0d9cd5aa98efcaeee2e065ddb8538fa977bc8eb
    &VCS_API_KEY=YOUR_API_KEY

Replace YOUR_API_KEY with your actual API key.

Security Alert: Safeguarding your API Key from public exposure is of utmost importance. For operational environments, it is strongly advised to utilize the custom header option instead of the query string method when transmitting your API Key.

Last updated