Skip to main content

API Authentication

All requests to the Blocklens API must be authenticated using an API Key. API keys are available to users with an eligible subscription plan.

Generating Your API Key

You can manage your API keys from the API Keys section of your account dashboard.

  1. Navigate to the API Keys page.
  2. Click "Create New Key".
  3. Give your key a descriptive name (e.g., "My Trading Bot", "Research Script").
  4. Your new API key will be displayed. Copy this key immediately and store it in a secure location. For security reasons, you will not be able to see the full key again.

Making Authenticated Requests

To authenticate your API requests, you must include your API key in the Authorization header using the Bearer scheme.

Example Request using cURL

curl -X GET "https://api.blocklens.co/v1/holder/supply?limit=1" \
-H "Authorization: Bearer your_api_key_here"

Example Request using Python

import requests

API_KEY = "your_api_key_here"
API_URL = "https://api.blocklens.co/v1/holder/supply"

headers = {
"Authorization": f"Bearer {API_KEY}"
}

params = {
"limit": 1
}

response = requests.get(API_URL, headers=headers, params=params)

if response.status_code == 200:
print(response.json())
else:
print(f"Error: {response.status_code}")
print(response.text)

Requests made without a valid API key will result in a 401 Unauthorized error.