API

Provision Tunnel

Provision a foreground tunnel. Requires an OtterKit token in the Authorization: Bearer otk_… header (get one with otterkit login or from the console). Debits 1 credit (the first connected hour) and returns the tunnel details; each further connected hour debits 1 credit (no endpoint ever bills more than 300 credits per 30 days).

POST/api/agent/tunnels

Response (200):

json
{
  "subdomain": "tunnel-a1b2c3d4",
  "publicUrl": "https://tunnel-a1b2c3d4.otterkit.app",
  "connectUrl": "wss://otterkit.app/ws/connect?subdomain=tunnel-a1b2c3d4",
  "mode": "foreground",
  "pricing": {
    "hourlyCredits": 1,
    "monthlyCapCredits": 300,
    "note": "Charged per connected hour, never more than 300 credits per 30 days; first hour charged now."
  },
  "autoStopAt": "2026-07-15T09:00:00.000Z",
  "cost": 1,
  "balance": 49
}

Response (401): missing/invalid token, { "error": "authentication_required" }. Response (402): out of credits, { "error": "insufficient_credits", "balance": 0 }.