Quick Start
Authentication
Note: Currently, this API does not require authentication. All endpoints are publicly accessible. For production use, consider implementing your own authentication layer.
⚠️ Important: Rate limiting is enforced based on tier (free, pro, enterprise)
Base URL
All API endpoints are relative to your deployment URL:
https://your-domain.com/api
Replace your-domain.com with your actual deployed domain or use relative paths like /api in your frontend code.
API Endpoints
/api/analyze
Analyze a trading chart image using AI (Google Gemini Vision) to detect patterns, identify support/resistance levels, and generate trading signals.
Request
Content-Type: multipart/form-data
Form Fields:
| Field | Type | Required | Description |
image |
File | ✅ Yes | Chart image file (JPG, PNG, WEBP, max 10MB) |
tier |
String | ❌ No | Rate limit tier: 'free' (default), 'pro', 'enterprise' |
Response (Success)
{
"success": true,
"data": {
"overview": {
"asset": "BTC/USDT",
"timeframe": "4h",
"currentTrend": "bullish",
"marketStructure": "uptrend"
},
"patterns": [
{
"name": "Ascending Triangle",
"type": "continuation",
"confidence": "high",
"description": "Bullish continuation pattern forming..."
}
],
"technicalLevels": {
"resistance": ["45000", "46500", "48000"],
"support": ["42000", "40500", "39000"],
"keyLevels": ["43500", "44800"]
},
"indicators": {
"rsi": "neutral",
"macd": "bullish",
"volume": "increasing",
"movingAverages": "above"
},
"signals": {
"entry": "43200-43500",
"stopLoss": "41800",
"takeProfit": ["45000", "46500", "48000"],
"riskReward": "1:3"
},
"analysis": {
"summary": "Strong bullish momentum with ascending triangle...",
"strengths": ["Strong volume", "Higher lows forming"],
"weaknesses": ["Overbought RSI", "Resistance ahead"],
"recommendation": "buy"
},
"confidence": {
"score": 0.85,
"reasoning": "Clear pattern with good volume confirmation"
}
},
"metadata": {
"timestamp": "2026-02-01T10:30:00Z",
"processingTime": 8.5,
"modelVersion": "gemini-1.5-flash"
},
"rateLimit": {
"limit": 10,
"remaining": 5,
"resetAt": "2026-02-02T00:00:00Z"
}
}
Response (Error)
{
"success": false,
"error": {
"code": "RATE_LIMIT_EXCEEDED",
"message": "Rate limit exceeded",
"details": {
"limit": 10,
"remaining": 0,
"resetAt": "2026-02-02T00:00:00Z",
"retryAfter": 3600
}
}
}
/api/market
Get real-time cryptocurrency market data from CoinGecko including prices, market cap, volume, and 7-day sparklines.
Query Parameters
| Parameter | Type | Default | Description |
per_page |
Integer | 50 | Number of coins per page (10-250) |
page |
Integer | 1 | Page number |
Example Request
GET /api/market?per_page=100&page=1
Response
{
"success": true,
"data": [
{
"id": "bitcoin",
"symbol": "btc",
"name": "Bitcoin",
"image": "https://...",
"current_price": 43250.50,
"market_cap": 846000000000,
"market_cap_rank": 1,
"total_volume": 28500000000,
"price_change_24h": 1250.30,
"price_change_percentage_24h": 2.98,
"sparkline_in_7d": {
"price": [41000, 41500, 42000, ...]
}
}
],
"pagination": {
"page": 1,
"perPage": 100,
"hasMore": true,
"totalResults": 100
},
"globalStats": {
"totalMarketCap": 1500000000000,
"totalVolume": 85000000000,
"btcDominance": 52.5,
"ethDominance": 17.3,
"totalCoins": 100
},
"timestamp": "2026-02-01T10:30:00Z"
}
/api/coin
Get detailed information about a specific cryptocurrency including price data, market stats, links, and exchange listings.
Query Parameters
| Parameter | Type | Required | Description |
id |
String | ✅ Yes | Coin ID (e.g., "bitcoin", "ethereum") |
Example Request
GET /api/coin?id=bitcoin
Response
{
"success": true,
"data": {
"id": "bitcoin",
"symbol": "btc",
"name": "Bitcoin",
"description": {
"en": "Bitcoin is a decentralized cryptocurrency..."
},
"image": {
"large": "https://..."
},
"market_data": {
"current_price": { "usd": 43250.50 },
"market_cap": { "usd": 846000000000 },
"total_volume": { "usd": 28500000000 },
"high_24h": { "usd": 43800 },
"low_24h": { "usd": 42100 },
"price_change_24h": 1250.30,
"price_change_percentage_24h": 2.98,
"ath": { "usd": 69000 },
"atl": { "usd": 67.81 },
"circulating_supply": 19500000,
"total_supply": 21000000
},
"links": {
"homepage": ["https://bitcoin.org"],
"blockchain_site": ["https://blockchair.com/bitcoin"],
"twitter_screen_name": "bitcoin"
},
"tickers": [
{
"base": "BTC",
"target": "USDT",
"market": { "name": "Binance" },
"last": 43250.50,
"volume": 1250000
}
]
},
"timestamp": "2026-02-01T10:30:00Z"
}
/api/news
Get latest cryptocurrency news articles from crypto.news RSS feed. No parameters required.
Example Request
GET /api/news
Response
{
"success": true,
"feed": {
"title": "Crypto News",
"link": "https://crypto.news",
"description": "Latest cryptocurrency news"
},
"articles": [
{
"title": "Bitcoin Reaches New All-Time High",
"link": "https://crypto.news/bitcoin-ath",
"pubDate": "2026-02-01T09:00:00Z",
"thumbnail": "https://...",
"description": "Bitcoin surged to a new record...",
"author": "Crypto News"
}
],
"timestamp": "2026-02-01T10:30:00Z"
}
/api/health
Health check endpoint to verify API status and get service information. Useful for monitoring and testing.
Example Request
GET /api/health
Response
{
"success": true,
"status": "OK",
"service": "TrafChart Pro API",
"timestamp": "2026-02-01T10:30:00Z",
"environment": "production",
"version": "1.0.0",
"endpoints": {
"analyze": "/api/analyze",
"market": "/api/market",
"coin": "/api/coin",
"news": "/api/news"
}
}
Code Examples
Browser JavaScript (Frontend)
Use FormData to upload image file from file input
// Get file from input const fileInput = document.getElementById('fileInput'); const file = fileInput.files[0]; // Create FormData const formData = new FormData(); formData.append('image', file); formData.append('tier', 'free'); // Optional: 'free', 'pro', 'enterprise' // Send request const response = await fetch('/api/analyze', { method: 'POST', body: formData // Don't set Content-Type - browser sets it with boundary }); const result = await response.json(); if (result.success) { console.log('Analysis:', result.data); console.log('Patterns:', result.data.patterns); console.log('Recommendation:', result.data.analysis.recommendation); } else { console.error('Error:', result.error); }
Node.js (Backend)
Use form-data package to send file upload
const fs = require('fs'); const FormData = require('form-data'); const fetch = require('node-fetch'); async function analyzeChart(imagePath) { // Create form data const formData = new FormData(); formData.append('image', fs.createReadStream(imagePath)); formData.append('tier', 'pro'); // Send request const response = await fetch('https://your-domain.com/api/analyze', { method: 'POST', body: formData, headers: formData.getHeaders() }); return await response.json(); } // Usage analyzeChart('./chart.png') .then(result => { console.log('✅ Analysis complete'); console.log('Trend:', result.data.overview.currentTrend); console.log('Patterns:', result.data.patterns); }) .catch(console.error);
Python
Use requests library with files parameter
import requests def analyze_chart(image_path): # Open image file with open(image_path, 'rb') as image_file: # Prepare files dict files = { 'image': image_file } # Optional form data data = { 'tier': 'pro' } # Send POST request response = requests.post( 'https://your-domain.com/api/analyze', files=files, data=data ) return response.json() # Usage result = analyze_chart('chart.png') if result['success']: data = result['data'] print(f"Asset: {data['overview']['asset']}") print(f"Trend: {data['overview']['currentTrend']}") print(f"Recommendation: {data['analysis']['recommendation']}") else: print(f"Error: {result['error']['message']}")
cURL (Command Line)
Test API directly from terminal
# Analyze chart curl -X POST https://your-domain.com/api/analyze \ -F "image=@chart.png" \ -F "tier=free" # Get market data curl https://your-domain.com/api/market?per_page=50&page=1 # Get coin details curl https://your-domain.com/api/coin?id=bitcoin # Get news curl https://your-domain.com/api/news # Health check curl https://your-domain.com/api/health
Rate Limits
API rate limits are enforced per tier to ensure fair usage. Rate limits reset every 24 hours at midnight UTC.
Free Tier
10
requests per day
Perfect for testing and personal projects
Pro Tier
100
requests per day
Ideal for active traders and small teams
Enterprise
Unlimited
no rate limits
For high-volume applications and businesses
Rate Limit Headers
Every API response includes rate limit information:
{
"rateLimit": {
"limit": 10, // Total requests allowed per day
"remaining": 5, // Requests remaining today
"resetAt": "2026-02-02T00:00:00Z" // When limit resets
}
}
⚠️ Rate Limit Exceeded
When rate limit is exceeded, the API returns HTTP 429 with retry information:
{
"success": false,
"error": {
"code": "RATE_LIMIT_EXCEEDED",
"message": "Rate limit exceeded",
"details": {
"limit": 10,
"remaining": 0,
"resetAt": "2026-02-02T00:00:00Z",
"retryAfter": 3600 // Seconds until reset
}
}
}
Need Help?
Check out our documentation or contact our API support team