CastDex Voting API Documentation
Welcome to the CastDex Voting API! This API provides read-only access to voting data from the CastDex platform, allowing you to retrieve token statistics, trending information, and voting analytics.
Quick Start
Base URL
https://castdex.vercel.app/api/external/votesAuthentication
All API requests require authentication using an API key in the request header:
X-API-Key: your_64_character_api_key_hereExample Request
curl -H "X-API-Key: your_64_character_api_key_here" \
"https://castdex.vercel.app/api/external/votes/stats?token_id=solana_EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"Authentication
The CastDex Voting API uses API key authentication. Your API key is a unique 64-character alphanumeric string that identifies your application and tracks usage.
Header Formats
The API accepts API keys in multiple header formats:
X-API-Key
Direct key
X-API-Key: abc123...xyz789
Authorization
Bearer token
Authorization: Bearer abc123...xyz789
API-Key
Direct key
API-Key: abc123...xyz789
API Key Requirements
Length: Exactly 64 characters
Format: Alphanumeric only (a-z, A-Z, 0-9)
Example:
abc123def456ghi789jkl012mno345pqr678stu901vwx234yzab567cde890fgh
Getting an API Key
Contact the CastDex team to request an API key for your application. Please provide:
Application name and description
Expected usage volume
Integration timeline
Technical contact information
Rate Limits
To ensure fair usage and system stability, the API implements rate limiting per API key:
Per Minute
1,000 requests
X-RateLimit-Remaining
Per Hour
10,000 requests
X-RateLimit-Reset
Per Day
100,000 requests
X-RateLimit-Window
Rate Limit Headers
Every API response includes rate limit information:
Handling Rate Limits
When you exceed the rate limit, you'll receive a 429 Too Many Requests response:
Best Practices:
Monitor the
X-RateLimit-RemainingheaderImplement exponential backoff for retries
Cache responses when possible
Contact support if you need higher limits
API Endpoints
1. Token Statistics
Get detailed voting statistics for one or more tokens.
Endpoint: GET /stats
Parameters
token_id
string
Yes*
Single token identifier
token_ids
string
Yes*
Comma-separated list of token IDs (max 100)
period
string
No
Time period: 1h, 24h, 7d, 30d, all (default: 24h)
group_by
string
No
Group results: hour, day, user
include_details
boolean
No
Include detailed vote information (default: false)
*Either token_id or token_ids is required
Examples
Single Token:
Multiple Tokens:
Grouped by Hour:
Response Format
Basic Response:
Grouped by Hour Response:
2. Trending Tokens
Get currently trending tokens based on voting activity.
Endpoint: GET /trending
Parameters
period
string
No
Time period: 1h, 24h, 7d (default: 24h)
type
string
No
Sort by: total, likes, rockets (default: total)
limit
integer
No
Number of tokens to return (max 100, default: 10)
Examples
Default Trending:
Trending by Rockets (7-day):
Response Format
Response Format
All API responses follow a consistent JSON structure:
Success Response
Error Response
Common HTTP Status Codes
200
OK
Request successful
400
Bad Request
Invalid parameters or missing required fields
401
Unauthorized
Invalid or missing API key
429
Too Many Requests
Rate limit exceeded
500
Internal Server Error
Server error (contact support)
Code Examples
JavaScript/Node.js
Python
PHP
cURL
Best Practices
1. Error Handling
Always check the success field in API responses:
2. Rate Limit Management
Monitor rate limit headers and implement backoff:
3. Caching
Cache responses to reduce API calls:
4. Retry Logic
Implement exponential backoff for transient errors:
5. Batch Requests
Use the token_ids parameter to request multiple tokens efficiently:
Common Use Cases
1. Token Dashboard
Display comprehensive token information:
2. Trending Analysis
Track trending patterns over time:
3. Portfolio Tracking
Monitor multiple tokens for a portfolio:
Troubleshooting
Common Issues
Authentication Errors (401)
Solutions:
Verify your API key is exactly 64 alphanumeric characters
Ensure the API key is included in the request header
Check that your API key is active and not expired
Contact support if the issue persists
Rate Limit Exceeded (429)
Solutions:
Implement request throttling in your application
Add retry logic with exponential backoff
Cache responses to reduce API calls
Contact support to discuss higher rate limits
Bad Request (400)
Solutions:
Check that all required parameters are included
Validate parameter formats (e.g., period values)
Ensure token_ids list doesn't exceed 100 tokens
Review the API documentation for correct parameter usage
Debug Checklist
API Key Format: Verify 64 alphanumeric characters
Headers: Ensure API key is in the correct header
URL: Check the base URL and endpoint paths
Parameters: Validate all parameter names and values
Rate Limits: Monitor usage and implement proper throttling
Response Handling: Always check the
successfield
Support
Getting Help
Documentation: This guide covers all API functionality
Status Page: Check [status.castdex.com] for system status
Support Email: [[email protected]] for technical assistance
Reporting Issues
When reporting issues, please include:
Your API key (first 10 characters only)
Request URL and parameters
Response received
Timestamp of the issue
Programming language/framework used
Feature Requests
We're always looking to improve the API. Submit feature requests to [[email protected]] with:
Detailed description of the requested feature
Use case explanation
Expected response format
Priority level for your integration
Changelog
Version 1.0 (July 2025)
Initial API release
Token statistics endpoint
Trending tokens endpoint
API key authentication
Rate limiting implementation
Comprehensive documentation
Last Updated: July 17, 2025 API Version: 1.0
