API Endpoint Specification

Public webhook, health, operator /v1 and /wallet proxy routes on the hoox gateway.

This page

This document details the HTTP routes on the hoox gateway (workers/hoox-worker). TradingView® and other signal sources hit /webhook. Operator tools (TUI, dashboard, CLI health) use Bearer OPERATOR_API_KEY on /v1/* and /wallet/*.

agent-worker chat/vision/usage routes are not public gateway paths — they stay on that isolate (dashboard / TUI reach them via Service Bindings).


🔒 Request headers

http
Content-Type: application/json
Accept: application/json

Operator routes also require:

http
Authorization: Bearer <OPERATOR_API_KEY>

Optional on webhook and wallet writes: Idempotency-Key (max 256 chars). Prefer this over the auto fingerprint when you need cross-minute uniqueness.

CORS is disabled on /webhook — server-to-server POST only.


🎯 1. Ingest trade signal webhook

Receives, validates, and routes trade orders.

  • Endpoint: /webhook (also POST /)
  • Method: POST
  • Auth: JSON apiKey must match WEBHOOK_API_KEY_BINDING on the hoox gateway

Request payload

json
{
  "apiKey": "your-hoox-webhook-passkey",
  "exchange": "bybit",
  "action": "LONG",
  "symbol": "BTCUSDT",
  "quantity": 0.005,
  "leverage": 10,
  "test": true,
  "idempotencyKey": "uuid-9b1deb4d-3b7d"
}

DEX example (BASE/QUOTE required; "test": true is rejected):

json
{
  "apiKey": "your-hoox-webhook-passkey",
  "exchange": "uniswap-ethereum",
  "action": "LONG",
  "symbol": "ETH/USDC",
  "quantity": 100
}
FieldLiveTest ("test": true)
HostProduction RESTTestnet REST (Binance / Bybit only)
SecretsEXCHANGE_KEY_BINDING / EXCHANGE_SECRET_BINDINGPrefer EXCHANGE_TESTNET_*, else live fallback
D1EXECUTED · normal position idTEST_EXECUTED · *-testnet-* id
DEXExactIn swap via web3-wallet-worker400 TEST_TRADING_UNSUPPORTED

exchange: binance, bybit, mexc, uniswap-ethereum, uniswap-arbitrum, jupiter-solana. Full field table: Signals & trades. Testnet: Test Trading. DEX: DEX spot swaps.

Response models

A. Success (200 OK)

json
{
  "success": true,
  "requestId": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
  "exchange": "bybit",
  "symbol": "BTCUSDT",
  "action": "LONG",
  "result": {
    "orderId": "18049284739",
    "status": "Filled",
    "executedQty": 0.005,
    "price": 68425.5,
    "timestamp": 1779261050000
  }
}

B. Queue failover (202 Accepted)

If the exchange is down and webhook:queue_mode is queue_failover or queue_everywhere, the signal is enqueued.

json
{
  "success": true,
  "requestId": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
  "status": "Enqueued",
  "message": "Signal enqueued in trade-execution Queue for background execution retry."
}

🟢 2. System health check

Liveness probe. No auth. Reports binding presence, not a KV round-trip.

  • Endpoint: /health
  • Method: GET
json
{
  "success": true,
  "status": "ok",
  "timestamp": 1779261050000,
  "service": "hoox",
  "bindings": {
    "kv": "configured",
    "sessions": "configured",
    "queue": "configured",
    "trade": "configured",
    "telegram": "configured",
    "wallet": "configured",
    "idempotency": "configured",
    "rateLimiter": "configured"
  }
}

CLI: hoox check health.


🛡️ 3. Operator plane (/v1/*)

Bearer OPERATOR_API_KEY. Fail-closed if the secret is missing.

MethodPathPurpose
GET/v1/healthOperator liveness (plane: "operator")
GET/v1/workersMinimal gateway self-view
GET/v1/trades/streamSSE trade stream (TUI)
GET/v1/logs/streamSSE log stream (TUI)
GET/workersLegacy alias of /v1/workers

💱 4. Wallet proxy (/wallet/*)

Forwards allowlisted paths to web3-wallet-worker with operator Bearer auth. The gateway injects mesh X-Internal-Auth-Key (WALLET_EXECUTE_KEY_BINDING / INTERNAL_KEY_BINDING). Idempotency-Key is passed through. Unknown paths are not forwarded.

MethodGateway pathUpstream
GET/POST/PUT/wallet/
GET/POST/PUT/wallet/status/status
GET/POST/PUT/wallet/config/config
GET/POST/PUT/wallet/balance/balance
GET/POST/PUT/wallet/quote/quote
GET/POST/PUT/wallet/swap/swap
GET/POST/PUT/wallet/transfer/transfer
GET/POST/PUT/wallet/approve/approve
GET/POST/PUT/wallet/transactions/transactions

Signal-driven DEX swaps still go POST /webhook → trade-worker → WEB3_WALLET_SERVICE /swap. The /wallet proxy is the operator surface.


🚨 5. Standard platform errors

A. 400 Bad Request

Invalid JSON, missing fields, unsupported test: true on MEXC/DEX (TEST_TRADING_UNSUPPORTED), or DEX symbol not BASE/QUOTE.

json
{
  "success": false,
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Invalid JSON payload structure.",
    "details": [
      { "field": "quantity", "issue": "Must be greater than zero." },
      {
        "field": "exchange",
        "issue": "Invalid exchange. Options: binance, bybit, mexc, uniswap-ethereum, uniswap-arbitrum, jupiter-solana."
      }
    ]
  }
}

B. 403 Forbidden (invalid apiKey or IP)

json
{
  "success": false,
  "error": "Forbidden"
}

IP allowlist rejects return { "success": false, "error": "Access denied" } with 403.

C. 409 Conflict (duplicate idempotency key)

json
{
  "success": false,
  "requestId": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
  "error": "Duplicate trade request. This trade was already processed."
}

Auto fingerprints include a per-minute time bucket. Prefer a client idempotencyKey.

D. 503 Service Unavailable (kill switch or missing DO)

json
{
  "success": false,
  "error": "Trading paused: global kill switch is enabled",
  "code": "KILL_SWITCH"
}

Missing IDEMPOTENCY_STORE binding is fail-closed (503).


Tip

Probe the mesh with hoox check health. Tail the gateway with hoox logs worker hoox.

🔗 Next Steps