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, capped at 10/day.

POST/api/agent/tunnels

Response (200):

json
{
  "subdomain": "agent-a1b2c3d4",
  "publicUrl": "https://agent-a1b2c3d4.otterkit.app",
  "connectUrl": "wss://otterkit.app/ws/connect?subdomain=agent-a1b2c3d4",
  "mode": "foreground",
  "pricing": {
    "hourlyCredits": 1,
    "dailyCapCredits": 10,
    "note": "Charged per connected hour; 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 }.