API 身份验证
所有发往 Blocklens API 的请求都必须使用 API Key 进行身份验证。API Key 面向拥有符合条件的订阅套餐的用户提供。
生成你的 API Key
你可以在账户控制台的 API Keys 区域管理你的 API Key。
- 进入 API Keys 页面。
- 点击 “Create New Key”。
- 为你的密钥取一个具有描述性的名称(例如“My Trading Bot”“Research Script”)。
- 系统将显示你新创建的 API Key。请立即复制该密钥并将其保存在安全的位置。出于安全原因,你将无法再次查看完整的密钥。
发起经过身份验证的请求
要对你的 API 请求进行身份验证,必须在 Authorization 请求头中使用 Bearer 方案附带你的 API Key。
使用 cURL 的示例请求
curl -X GET "https://api.blocklens.co/v1/holder/supply?limit=1" \
-H "Authorization: Bearer your_api_key_here"
使用 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)
未附带有效 API Key 的请求将返回 401 Unauthorized 错误。