API Overview¶
Chain Sentinel provides a powerful RESTful API for programmatic access to SCAM token detection and analysis.
Base URL¶
Authentication¶
All API requests require an API key in the X-API-Key header:
See API Authentication for details.
Rate Limits¶
| Tier | Requests/Day | Requests/Second |
|---|---|---|
| Free | 100 | 1 |
| Pro | 1,000 | 10 |
| Enterprise | Unlimited | 100 |
Response Format¶
All responses follow a standard JSON format:
Success Response¶
{
"data": {
"address": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"symbol": "USDC",
"is_rug": false,
"confidence": 0.98
},
"success": true,
"message": "Token retrieved successfully"
}
Error Response¶
HTTP Status Codes¶
| Code | Meaning | Description |
|---|---|---|
| 200 | OK | Request successful |
| 201 | Created | Resource created |
| 400 | Bad Request | Invalid parameters |
| 401 | Unauthorized | Invalid or missing API key |
| 403 | Forbidden | Insufficient permissions |
| 404 | Not Found | Resource not found |
| 429 | Too Many Requests | Rate limit exceeded |
| 500 | Internal Server Error | Server error |
Pagination¶
List endpoints support pagination:
Parameters: - page - Page number (default: 1) - limit - Items per page (default: 100, max: 1000)
Response:
Filtering¶
Most list endpoints support filtering:
Common filters: - is_rug - Filter by SCAM status (true/false) - confidence_min - Minimum confidence (0.0-1.0) - confidence_max - Maximum confidence (0.0-1.0) - created_after - ISO 8601 date - created_before - ISO 8601 date
Sorting¶
List endpoints support sorting:
Parameters: - sort_by - Field to sort by - sort_order - asc or desc
API Endpoints¶
Tokens¶
GET /api/tokens- List all tokensGET /api/tokens/{address}- Get token detailsPOST /api/predict/{address}- Analyze a token
Wallets¶
GET /api/wallet/{address}- Get wallet analysisGET /api/wallet/{address}/tokens- Get tokens created by walletGET /api/wallet/{address}/reputation- Get wallet reputation
Watchlist¶
GET /api/watchlist- List watched walletsPOST /api/watchlist- Add wallet to watchlistDELETE /api/watchlist/{address}- Remove from watchlist
Alerts¶
GET /api/alerts- List alert historyPOST /api/alerts/configure- Configure alert settings
Search¶
GET /api/search- Global searchPOST /api/search/advanced- Advanced search with filters
Graph¶
GET /api/graph/{address}- Get network graph dataGET /api/graph/path- Find path between two addresses
See API Endpoints for complete documentation.
Code Examples¶
Python¶
import requests
API_KEY = "your_api_key_here"
BASE_URL = "https://api.chainsentinel.net"
headers = {"X-API-Key": API_KEY}
# Get token details
response = requests.get(
f"{BASE_URL}/api/tokens/EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
headers=headers
)
token = response.json()
print(f"Token: {token['data']['symbol']}")
print(f"SCAM: {token['data']['is_rug']}")
print(f"Confidence: {token['data']['confidence']}")
JavaScript¶
const API_KEY = 'your_api_key_here';
const BASE_URL = 'https://api.chainsentinel.net';
const headers = {
'X-API-Key': API_KEY
};
// Get token details
const response = await fetch(
`${BASE_URL}/api/tokens/EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v`,
{ headers }
);
const token = await response.json();
console.log(`Token: ${token.data.symbol}`);
console.log(`SCAM: ${token.data.is_rug}`);
console.log(`Confidence: ${token.data.confidence}`);
cURL¶
curl -H "X-API-Key: your_api_key_here" \
https://api.chainsentinel.net/api/tokens/EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
See API Examples for more code samples.
Best Practices¶
1. Cache Responses¶
Cache API responses to reduce requests:
import requests
from functools import lru_cache
@lru_cache(maxsize=1000)
def get_token(address):
response = requests.get(
f"{BASE_URL}/api/tokens/{address}",
headers=headers
)
return response.json()
2. Handle Rate Limits¶
Implement exponential backoff:
import time
def api_request_with_retry(url, max_retries=3):
for attempt in range(max_retries):
response = requests.get(url, headers=headers)
if response.status_code == 429:
wait_time = 2 ** attempt
time.sleep(wait_time)
continue
return response
raise Exception("Max retries exceeded")
3. Monitor Rate Limits¶
Check rate limit headers:
response = requests.get(url, headers=headers)
limit = response.headers.get('X-RateLimit-Limit')
remaining = response.headers.get('X-RateLimit-Remaining')
reset = response.headers.get('X-RateLimit-Reset')
print(f"Remaining: {remaining}/{limit}")
4. Use Batch Endpoints¶
When analyzing multiple tokens, use batch endpoints:
# Instead of this (100 requests)
for address in addresses:
get_token(address)
# Do this (1 request)
response = requests.post(
f"{BASE_URL}/api/tokens/batch",
json={"addresses": addresses},
headers=headers
)
5. Handle Errors Gracefully¶
try:
response = requests.get(url, headers=headers)
response.raise_for_status()
data = response.json()
except requests.exceptions.HTTPError as e:
if e.response.status_code == 404:
print("Token not found")
elif e.response.status_code == 429:
print("Rate limit exceeded")
else:
print(f"HTTP error: {e}")
except requests.exceptions.RequestException as e:
print(f"Request failed: {e}")
Interactive API Documentation¶
Explore the API interactively:
- Swagger UI: api.chainsentinel.net/docs
- ReDoc: api.chainsentinel.net/redoc
- OpenAPI Schema: api.chainsentinel.net/openapi.json
Webhooks (Coming Soon)¶
Subscribe to real-time events:
- New SCAM detections
- Watchlist activity
- High-confidence predictions
SDKs (Coming Soon)¶
Official SDKs for popular languages:
- Python SDK
- JavaScript/TypeScript SDK
- Go SDK
- Rust SDK
Support¶
Need help with the API?
- 📖 API Examples
- 📖 FAQ
- 💬 Telegram Community
- 📧 support@chainsentinel.net
Next: API Authentication →