AutoSpot

🔌 Public API Documentation

⚡ Pro Plan Required
API access chỉ dành cho Pro plan trở lên. Nâng cấp ngay

🔐 Authentication

Tất cả API requests cần header X-API-Key:

curl -H "X-API-Key: ask_xxxxxxxxxxxxx" \
     https://your-domain.com/public/api/v1/portfolio

Tạo API key từ trang Account → API Keys section.

🌐 Base URL

https://your-domain.com/public/api/v1

📖 Endpoints

GET /portfolio

Lấy portfolio hiện tại

Response Example
{
  "success": true,
  "data": {
    "holdings": [
      {
        "symbol": "BTCUSDT",
        "quantity": 0.005,
        "avg_price": 95000,
        "current_price": 97500,
        "value": 487.50
      }
    ],
    "total_invested": 475.00,
    "total_value": 487.50
  }
}

GET /status

Lấy trạng thái thị trường (Fear & Greed, BTC price)

Response Example
{
  "success": true,
  "data": {
    "fng": {
      "value": 42,
      "classification": "Fear",
      "timestamp": "2026-02-08"
    },
    "btc_price": 97500.50
  }
}

GET /trades

Lấy lịch sử giao dịch

Query params: page (default: 1), limit (default: 50, max: 100)

Response Example
{
  "success": true,
  "data": {
    "trades": [
      {
        "symbol": "BTCUSDT",
        "action": "BUY",
        "price": 95000,
        "quantity": 0.001,
        "amount": 95,
        "created_at": "2026-02-08T10:30:00"
      }
    ],
    "total": 25,
    "page": 1,
    "per_page": 50,
    "total_pages": 1
  }
}

❌ Error Codes

401 Missing or invalid API key
403 Plan không hỗ trợ API access (cần Pro+)
429 Rate limit exceeded

💻 Code Examples

Python

import requests

API_KEY = "ask_xxxxxxxxxxxxx"
BASE_URL = "https://your-domain.com/public/api/v1"

headers = {"X-API-Key": API_KEY}

# Get portfolio
resp = requests.get(f"{BASE_URL}/portfolio", headers=headers)
print(resp.json())

JavaScript

const API_KEY = "ask_xxxxxxxxxxxxx";
const BASE_URL = "https://your-domain.com/public/api/v1";

fetch(`${BASE_URL}/portfolio`, {
  headers: { "X-API-Key": API_KEY }
})
.then(res => res.json())
.then(data => console.log(data));