API Reference
The GOAT API provides programmatic access to AI-powered trading decisions, market analysis, and real-time trading signals. Built with RESTful principles for easy integration.
Base URL
https://api.0xgoat.ai/v1
Authentication
All API requests require authentication using an API key. Include your API key in the request header:
Authorization: Bearer YOUR_API_KEY Content-Type: application/json
Security Notice
Never expose your API keys in client-side code or public repositories. Always make API requests from your server.
API Endpoints
Analyze Market
POST/api/analyze
Analyzes current market conditions across multiple timeframes and returns trading recommendations from all AI models.
Request Body
{
"symbols": ["BTCUSDT", "ETHUSDT", "SOLUSDT"],
"timeframes": ["5m", "15m", "1h"],
"models": ["claude", "gpt5", "deepseek", "gemini", "grok", "qwen"]
}
Response
{
"success": true,
"timestamp": "2025-01-15T10:30:00Z",
"decisions": {
"BTCUSDT": {
"signal": "long",
"entry_price": 105432.50,
"profit_target": 106500.00,
"stop_loss": 104800.00,
"leverage": 10,
"confidence": 0.78,
"size_usd": 5000,
"expected_duration": "30min",
"justification": "Strong 15M support bounce with 1H trend confirmation...",
"model": "claude-sonnet-4-5"
}
},
"consensus": {
"bullish": 4,
"bearish": 1,
"neutral": 1
}
}
Get Market Data
GET/api/market/{symbol}
Retrieves current price, volume, and market statistics for a specific cryptocurrency.
Parameters
symbol (required) - Trading pair (e.g., BTCUSDT)
interval (optional) - Timeframe: 1m, 5m, 15m, 1h, 4h, 1d
Response
{
"symbol": "BTCUSDT",
"price": 105432.50,
"change_24h": 2.45,
"volume": 28456789012,
"market_cap": 2073456789012,
"high_24h": 106200.00,
"low_24h": 102800.00,
"timestamp": "2025-01-15T10:30:00Z"
}
Get Active Positions
GET/api/positions
Returns all currently open trading positions with real-time P&L data.
Response
{
"success": true,
"positions": [
{
"id": "pos_123456",
"symbol": "BTCUSDT",
"side": "long",
"entry_price": 104800.00,
"current_price": 105432.50,
"quantity": 0.05,
"leverage": 10,
"pnl": 316.25,
"pnl_percentage": 6.04,
"opened_at": "2025-01-15T09:45:00Z",
"stop_loss": 104200.00,
"take_profit": 106000.00
}
],
"total_pnl": 316.25,
"total_exposure": 5240.00
}
Execute Trade
POST/api/trade
Executes a trade based on AI recommendations or manual parameters.
Request Body
{
"symbol": "BTCUSDT",
"side": "long",
"entry_price": 105432.50,
"quantity": 5000,
"leverage": 10,
"stop_loss": 104800.00,
"take_profit": 106500.00,
"duration": "30min"
}
Response
{
"success": true,
"trade_id": "trade_789012",
"symbol": "BTCUSDT",
"side": "long",
"entry_price": 105432.50,
"quantity": 5000,
"leverage": 10,
"executed_at": "2025-01-15T10:30:15Z",
"status": "open"
}
Close Position
DELETE/api/positions/{position_id}
Closes an open position at current market price.
Response
{
"success": true,
"position_id": "pos_123456",
"symbol": "BTCUSDT",
"entry_price": 104800.00,
"exit_price": 105432.50,
"pnl": 316.25,
"pnl_percentage": 6.04,
"closed_at": "2025-01-15T10:35:00Z"
}
Trading History
GET/api/history
Retrieves historical trading data with filters for symbol, date range, and model.
Query Parameters
symbol - Filter by trading pair
model - Filter by AI model
from - Start date (ISO 8601)
to - End date (ISO 8601)
limit - Number of results (default: 50, max: 500)
Response
{
"success": true,
"trades": [
{
"id": "trade_789012",
"symbol": "BTCUSDT",
"side": "long",
"entry_price": 104800.00,
"exit_price": 105432.50,
"pnl": 316.25,
"pnl_percentage": 6.04,
"model": "claude-sonnet-4-5",
"opened_at": "2025-01-15T09:45:00Z",
"closed_at": "2025-01-15T10:35:00Z"
}
],
"total_trades": 1,
"page": 1,
"limit": 50
}
AI Models
Each AI model can be queried individually or collectively. Use the models parameter
to specify which models to include in the analysis.
Model Identifiers
claude- Claude Sonnet 4.5deepseek- DeepSeek V3.2gemini- Gemini 2.5 PROgrok- Grok 4gpt5- GPT-5qwen- Qwen 3-Max
Model Specialties
- Claude: Long-term trend analysis
- DeepSeek: Pattern recognition
- Gemini: Multi-modal analysis
- Grok: Real-time sentiment
- GPT-5: Contextual prediction
- Qwen: High-frequency signals
Error Codes
The API uses standard HTTP status codes and returns detailed error messages in JSON format.
200 OK
Success
Request completed successfully
400 Bad Request
Client Error
Invalid request parameters or malformed JSON
401 Unauthorized
Authentication Error
Missing or invalid API key
404 Not Found
Not Found
Requested resource does not exist
429 Too Many Requests
Rate Limit
Rate limit exceeded, please retry after the specified time
500 Internal Server Error
Server Error
Unexpected server error occurred
Error Response Format
{
"success": false,
"error": {
"code": "INVALID_PARAMETERS",
"message": "Symbol 'INVALID' is not supported",
"details": {
"supported_symbols": ["BTCUSDT", "ETHUSDT", "SOLUSDT", ...]
}
}
}
Code Examples
JavaScript / Node.js
// Analyze market with multiple AI models
const analyzeMarket = async () => {
const response = await fetch('https://api.0xgoat.ai/v1/api/analyze', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
symbols: ['BTCUSDT', 'ETHUSDT'],
timeframes: ['5m', '15m', '1h'],
models: ['claude', 'gpt5', 'gemini']
})
});
const data = await response.json();
console.log(data.decisions);
};
analyzeMarket();
Python
import requests
import json
# Get active positions
def get_positions():
url = 'https://api.0xgoat.ai/v1/api/positions'
headers = {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
}
response = requests.get(url, headers=headers)
data = response.json()
for position in data['positions']:
print(f"Symbol: {position['symbol']}")
print(f"P&L: {position['pnl_percentage']}%")
print("---")
get_positions()
PHP
<?php
// Execute trade
$url = 'https://api.0xgoat.ai/v1/api/trade';
$api_key = 'YOUR_API_KEY';
$data = [
'symbol' => 'BTCUSDT',
'side' => 'long',
'entry_price' => 105432.50,
'quantity' => 5000,
'leverage' => 10,
'stop_loss' => 104800.00,
'take_profit' => 106500.00
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer ' . $api_key,
'Content-Type: application/json'
]);
$response = curl_exec($ch);
$result = json_decode($response, true);
echo "Trade ID: " . $result['trade_id'];
curl_close($ch);
?>
cURL
# Get market data curl -X GET "https://api.0xgoat.ai/v1/api/market/BTCUSDT?interval=15m" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" # Close position curl -X DELETE "https://api.0xgoat.ai/v1/api/positions/pos_123456" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json"
Rate Limits
API rate limits are applied per API key to ensure fair usage:
Free Tier
100
requests per hour
Pro Tier
1,000
requests per hour
Enterprise
Unlimited
custom rate limits
Rate Limit Headers
Every API response includes rate limit information in the headers:
X-RateLimit-Limit: 1000 X-RateLimit-Remaining: 847 X-RateLimit-Reset: 1642248000