API Documentation
CryptoBoard public and authenticated API endpoints
Authentication
Most endpoints require a Bearer token. Get one by signing up and logging in at /register.html.
Authorization: Bearer <your-jwt-token>
Public Endpoints
GET/api/health
Health check — returns server status and counts
GET/api/public/prices
Get live crypto prices (limited without API key)
Optional: X-API-Key header for full access
GET/api/insights/latest
Get the latest AI market insight
Watchlist
GET/api/watchlist
Get user's watchlist coins
Requires authentication
POST/api/watchlist
Add/remove coin from watchlist (toggle)
{ "coinId": "bitcoin", "coinName": "Bitcoin", "coinSymbol": "BTC" }
Requires authentication
DELETE/api/watchlist/:coinId
Remove coin from watchlist
Requires authentication
Price Alerts
GET/api/alerts
Get user's active price alerts
Requires authentication
POST/api/alerts
Create a price alert
{ "coinId": "bitcoin", "coinName": "Bitcoin", "direction": "below", "price": 60000 }
Requires authentication
Portfolio
GET/api/portfolio
Get user's portfolio holdings
Requires authentication
POST/api/portfolio
Add or update a holding
{ "coinId": "bitcoin", "amount": 0.5, "buyPrice": 65000 }
Requires authentication
Community
GET/api/comments/:coinId?limit=20&offset=0
Get comments for a coin
POST/api/comments
Post a comment
{ "coinId": "bitcoin", "content": "Looking bullish!" }
Requires authentication
API Keys
POST/api/keys
Generate a new API key
{ "name": "My App" }
Requires authentication
GET/api/keys
List all API keys
Requires authentication
DELETE/api/keys/:keyHash
Revoke an API key
Requires authentication
Example: Full Auth Flow
# 1. Register
curl -X POST http://localhost:3000/api/auth/register \
-H "Content-Type: application/json" \
-d '{"username":"alice","email":"
[email protected]","password":"secret123","confirm_password":"secret123"}'
# 2. Login
curl -X POST http://localhost:3000/api/auth/login \
-H "Content-Type: application/json" \
-d '{"email":"
[email protected]","password":"secret123"}'
# → returns { "token": "eyJ...", "user": {...} }
# 3. Add to watchlist
curl -X POST http://localhost:3000/api/watchlist \
-H "Content-Type: application/json" \
-H "Authorization: Bearer eyJ..." \
-d '{"coinId":"bitcoin","coinName":"Bitcoin","coinSymbol":"BTC"}'
# 4. Get watchlist
curl http://localhost:3000/api/watchlist \
-H "Authorization: Bearer eyJ..."