API Documentation
Professional REST API for accessing financial data from 81+ platforms with anti-detection technology.
Overview
Our API provides programmatic access to real-time financial data from crypto exchanges, stock markets, and financial news sources. Built with enterprise-grade reliability and anti-detection technology.
Quick Start
Authentication
All API requests require an API key. Include it in the Authorization header:
curl -H "Authorization: Bearer YOUR_API_KEY" \
https://api.stockapis.com/v1/market-data/binance/BTCUSDT
Base URL
https://api.stockapis.com/v1
Core Endpoints
Market Data
Get real-time market data from any supported platform:
GET /market-data/{platform}/{symbol}
Example:
curl https://api.stockapis.com/v1/market-data/binance/BTCUSDT
Response:
{
"symbol": "BTCUSDT",
"price": 43250.5,
"change_24h": 2.5,
"volume_24h": 1234567.89,
"high_24h": 43500.0,
"low_24h": 42800.0,
"timestamp": "2024-01-15T10:30:00Z"
}
Historical Data
Get historical price data:
GET /historical/{platform}/{symbol}?interval=1d&start=2024-01-01&end=2024-01-15
Order Book
Get real-time order book data:
GET /orderbook/{platform}/{symbol}?depth=10
Ticker Information
Get comprehensive ticker data:
GET /ticker/{platform}/{symbol}
Platform-Specific Endpoints
Crypto Exchanges
Binance
GET /binance/market-data/{symbol}
GET /binance/orderbook/{symbol}
GET /binance/ticker/{symbol}
GET /binance/klines/{symbol}?interval=1h
Coinbase
GET /coinbase/products/{product_id}/ticker
GET /coinbase/products/{product_id}/trades
GET /coinbase/products/{product_id}/candles
Stock Markets
Yahoo Finance
GET /yahoo-finance/quote/{symbol}
GET /yahoo-finance/historical/{symbol}
GET /yahoo-finance/options/{symbol}
NYSE Data
GET /nyse/quote/{symbol}
GET /nyse/historical/{symbol}
GET /nyse/options/{symbol}
Rate Limits
- Free Tier: 100 requests/hour
- Pro Tier: 10,000 requests/hour
- Enterprise: Custom limits
Rate limit headers are included in all responses:
X-RateLimit-Limit: 10000
X-RateLimit-Remaining: 9999
X-RateLimit-Reset: 1642234567
Error Handling
All errors follow a consistent format:
{
"error": {
"code": "RATE_LIMIT_EXCEEDED",
"message": "Rate limit exceeded. Please try again later.",
"details": {
"limit": 10000,
"reset_time": "2024-01-15T11:00:00Z"
}
}
}
Common Error Codes
400
- Bad Request401
- Unauthorized403
- Forbidden404
- Not Found429
- Rate Limit Exceeded500
- Internal Server Error
SDKs
JavaScript/Node.js
npm install @stockapis/sdk
import { StockAPIClient } from "@stockapis/sdk";
const client = new StockAPIClient("YOUR_API_KEY");
// Get market data
const data = await client.getMarketData("binance", "BTCUSDT");
console.log(data);
Python
pip install stockapis-sdk
from stockapis import StockAPIClient
client = StockAPIClient('YOUR_API_KEY')
# Get market data
data = client.get_market_data('binance', 'BTCUSDT')
print(data)
WebSocket API
For real-time data, use our WebSocket API:
const ws = new WebSocket("wss://api.stockapis.com/v1/ws");
ws.onopen = () => {
// Subscribe to market data
ws.send(
JSON.stringify({
action: "subscribe",
channel: "market_data",
platform: "binance",
symbol: "BTCUSDT",
})
);
};
ws.onmessage = (event) => {
const data = JSON.parse(event.data);
console.log("Real-time data:", data);
};
Support
- Documentation: docs.stockapis.com
- API Status: status.stockapis.com
- Support: support@stockapis.com
- Discord: discord.gg/stockapis
Next Steps
- Platforms Documentation - Learn about supported platforms
- Use Cases - See real-world examples
- Getting Started - Quick start guide