API Reference
Gateway API for the Ants at Work Colony
Base URL
https://api.ants-at-work.com Authentication
Most endpoints require Bearer token authentication. Include your token in the Authorization header:
curl -H "Authorization: Bearer YOUR_TOKEN" \
https://api.ants-at-work.com/regions Getting a Token
Register a worker to receive a token. Tokens are valid for 30 days and can be refreshed.
curl -X POST https://api.ants-at-work.com/register \
-H "Content-Type: application/json" \
-d '{"hostname":"my-worker","gpu":"RTX4090","platform":"linux"}' Public Endpoints
No authentication required. Read-only access to colony statistics and data.
/health Health check endpoint
Response
{
"status": "healthy",
"version": "2.0.0",
"timestamp": "2026-01-21T10:30:00Z"
} /register Worker self-registration (returns token)
Request Body
{
"hostname": "my-laptop",
"platform": "darwin",
"gpu": "M2 Max"
} Response
{
"token": "abc123...",
"worker_id": "worker-xyz",
"gateway_url": "https://api.ants-at-work.com"
} /public/stats Colony statistics (workers, points, collisions)
Response
{
"total_workers": 42,
"active_workers": 38,
"total_dps": 22690,
"collisions": 0,
"coverage": 0.0001
} /public/regions Region pheromone data
Response
{
"regions": [
{
"id": "region-001",
"start": "400000000000000000",
"end": "400010000000000000",
"pheromone": 0.1,
"workers_active": 0
}
]
} /public/graph Graph visualization data (nodes, edges)
/public/activity Real-time activity stream
Trading Endpoints (Public)
Read-only access to trading statistics and market data.
/public/trading/stats Trading statistics (win rate, PnL, equity)
Response
{
"win_rate": 0.526,
"total_pnl": 1234.56,
"equity": 10000.00,
"trades_today": 12,
"active_patterns": 42
} /public/trading/positions Open positions
Response
{
"positions": [
{
"symbol": "BTC-PERP",
"direction": "long",
"size": 0.05,
"entry_price": 96000,
"unrealized_pnl": 125.50
}
]
} /public/trading/trades Recent closed trades
/public/trading/signals Recent trading signals
/public/trading/regimes Regime history
/public/trading/edges Pheromone trails (signal edges)
Parameters
| Name | Type | Required | Default |
|---|---|---|---|
| limit | number | No | 50 |
/public/trading/equity Equity curve data
Hunt BTC Endpoints Auth Required
Authenticated endpoints for the Hunt BTC mission. Requires Bearer token.
/target Get current puzzle target
Response
{
"puzzle_id": "puzzle-71",
"bit_length": 71,
"target_address": "1PWo3JeB9jrGwfHDNpdGK54CRas7fsVzXU",
"target_pubkey": "04b...",
"range_start": "400000000000000000",
"range_end": "7ffffffffffffffffff"
} /regions Get cold regions (low pheromone)
/dp Deposit distinguished point (encrypted)
Request Body
{
"hash": "abc123...",
"worker_type": "tame",
"point_hex": "04...",
"distance_encrypted": "..."
} Response
{
"success": true,
"collision": false,
"dp_id": "dp-123"
} /intention Mark working intention on a region
Request Body
{
"region_id": "region-001",
"worker_type": "tame"
} /exploration Mark exploration progress
Request Body
{
"region_id": "region-001",
"coverage": 0.15
} /collision Check for collision
Parameters
| Name | Type | Required | Default |
|---|---|---|---|
| hash | string | Yes | - |
/stats Get worker statistics
/status Check token status
/refresh Refresh token (extend 30 days)
Trading Endpoints (Authenticated) Auth Required
Write endpoints for the trading system. Requires Bearer token.
/trading/stats Update trading statistics
/trading/trade Add or update a trade
Request Body
{
"id": "trade-001",
"symbol": "BTC-PERP",
"direction": "long",
"entry_price": 96000,
"size": 0.05,
"entry_time": 1705000000000,
"is_open": true
} /trading/signal Add a trading signal
/trading/regime Add regime change
/trading/edge Update signal edge (pheromone)
Request Body
{
"id": "BTC-PERP:bull:normal:neutral:long",
"from_state_id": "BTC-PERP:bull:normal:neutral",
"to_direction": "long",
"trail_pheromone": 12.5,
"win_count": 45,
"loss_count": 30
} /trading/edges/batch Batch update edges
Member Endpoints
Member registration and profile management.
/member/register Register new member
/member/:username Get member profile
/member/lookup Lookup by email
/member/:id/trust Add trust to member
Admin only
/member/:id/trust Get trust history
/members/stats Member statistics
Admin Endpoints Auth Required
Administrative operations. Requires admin token.
/admin/tokens List all tokens
/admin/tokens/:id Revoke a token
/admin/target Set puzzle target
/admin/regions Add region
/admin/points List DPs (distances protected)
/admin/collisions List collisions
/admin/points Clear all points
/admin/security Security status
/admin/security/revoke-all Emergency revoke all tokens
/admin/trading/reset Reset trading data
Rate Limits
| Endpoint | Limit |
|---|---|
| /register | 10/hour per IP |
| /dp | 100/minute per worker |
| /regions | 60/minute per worker |
| Others | 120/minute per worker |
Error Responses
Error Format
{
"error": "unauthorized",
"message": "Invalid or expired token"
} | Status Code | Meaning |
|---|---|
| 400 | Bad request - Invalid parameters or body |
| 401 | Unauthorized - Invalid or expired token |
| 403 | Forbidden - Insufficient permissions |
| 429 | Rate limited - Too many requests |
| 500 | Server error - Internal error |
SDKs and Tools
Lessons from Ants at Work
