Purchase Now

CoinGecko API

CoinTrail uses CoinGecko as the primary data source for cryptocurrency prices, market data, and coin information.

API Plans

Plan Monthly Calls Rate Limit API Key Required
Demo (Free) 10,000 30 calls/min Optional
Analyst 500,000 500 calls/min Yes
Pro Unlimited 1,000 calls/min Yes
Screenshot: CoinGecko API dashboard showing available plans and pricing tiers technical/coingecko-api-dashboard.png

CoinGecko API plans dashboard - choose based on your traffic requirements

Free Tier Optimized

CoinTrail's tiered update system is designed to work within CoinGecko's free tier limits (10,000 calls/month).

Configuration

Configure your CoinGecko API settings in the admin panel or .env file:

.env
# CoinGecko API Configuration
COINGECKO_API_KEY=your-api-key-here
COINGECKO_API_TYPE=demo

# API Types: demo, pro
# demo = Free tier (api.coingecko.com)
# pro = Paid tier (pro-api.coingecko.com)

Or configure via Admin Panel → Settings → API Settings.

Screenshot: API settings configuration page in the admin panel technical/api-settings-admin-panel.png

Admin panel API settings - configure your CoinGecko API key and type

Tiered Update System

CoinTrail implements a smart tiered update system to optimize API usage while keeping popular coins updated frequently.

Tier Coins Update Interval API Calls/Day
Top Tier 1-100 (by market cap) Every 5 minutes ~288
Mid Tier 101-500 Every 15 minutes ~96
Low Tier 501-1000 Every 30 minutes ~48
Rare Tier 1001+ Every 60 minutes ~24

Total estimated daily calls: ~450 (well within free tier limits)

Screenshot: Tiered update system configuration showing rate limits per tier technical/rate-limit-configuration.png

Rate limit configuration - adjust update intervals for each tier in admin settings

Adjusting Update Intervals

You can customize update intervals in Admin → Settings → API Settings, or modify the configuration:

config/crypto.php
return [
    'update_intervals' => [
        'top' => 5,      // minutes
        'mid' => 15,     // minutes
        'low' => 30,     // minutes
        'rare' => 60,    // minutes
    ],
    'tier_ranges' => [
        'top' => [1, 100],
        'mid' => [101, 500],
        'low' => [501, 1000],
        'rare' => [1001, null],
    ],
];

Data Fetched from CoinGecko

Market Data (per coin)

  • Current price (in multiple currencies)
  • 24h price change (absolute and percentage)
  • 7d, 30d, 1y price change
  • Market cap and market cap rank
  • 24h trading volume
  • Circulating, total, and max supply
  • All-time high/low prices and dates

Coin Details

  • Coin name, symbol, and description
  • Logo and images
  • Categories and platforms
  • Links (website, whitepaper, social media)
  • Genesis date
  • Developer and community stats

Historical Data

  • OHLC data for charts
  • Historical prices for specified date ranges
  • Market chart data (prices, market caps, volumes)
Screenshot: Sample API response showing cryptocurrency data structure technical/api-response-example.png

Example API response - JSON structure returned from CoinGecko API

Other Data Sources

Fear & Greed Index

CoinTrail fetches the Crypto Fear & Greed Index from Alternative.me:

.env
# Fear & Greed Index
FEAR_GREED_ENABLED=true
FEAR_GREED_UPDATE_INTERVAL=60  # minutes

Exchange Rates

For fiat currency conversion rates:

.env
# Exchange Rates (optional - for fiat conversions)
EXCHANGE_RATE_API_KEY=your-key-here
EXCHANGE_RATE_PROVIDER=exchangerate-api  # or openexchangerates
Screenshot: External API integrations panel showing Fear & Greed Index and Exchange Rate settings technical/external-api-integration.png

External API integrations - configure additional data sources like Fear & Greed Index

Rate Limiting & Error Handling

Built-in Rate Limiting

CoinTrail implements automatic rate limiting to prevent API quota exhaustion:

  • Queues API requests with configurable delays
  • Respects CoinGecko's rate limits per tier
  • Implements exponential backoff on errors
  • Caches responses to reduce duplicate calls

Error Handling

When API errors occur:

Error Code Meaning Action Taken
429 Rate limit exceeded Wait and retry with backoff
401 Invalid API key Log error, use cached data
500 Server error Retry up to 3 times
Timeout Request timeout Retry with longer timeout
Screenshot: Error handling logs showing rate limit and retry behavior technical/api-error-handling.png

Error handling in action - system logs showing automatic retry with exponential backoff

Data Caching

CoinTrail caches API responses to improve performance and reduce API calls:

Data Type Cache Duration Storage
Price data Based on tier interval Database + Redis/File
Coin details 24 hours Database
Global market data 5 minutes Cache
Exchange rates 1 hour Cache
Fear & Greed Index 1 hour Cache
Performance Tip

For best performance, use Redis for caching. Configure CACHE_DRIVER=redis in your .env file.

Screenshot: Cache configuration settings in admin panel technical/cache-settings-panel.png

Cache settings panel - configure cache driver and duration settings