{
  "openapi": "3.1.0",
  "info": {
    "title": "Busbar Agent-First B300 Cloud API",
    "version": "1.0.0",
    "description": "Programmatic REST & MCP API for discovering, quoting, launching, extending, and releasing bare-metal NVIDIA HGX B300 clusters."
  },
  "servers": [
    {
      "url": "https://busbar.pages.dev"
    }
  ],
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Scoped Agent API key (`bb_live_...` / `bb_test_...`) or session token."
      },
      "OperatorKey": {
        "type": "apiKey",
        "in": "header",
        "name": "x-operator-key"
      }
    }
  },
  "paths": {
    "/mcp": {
      "post": {
        "summary": "Streamable HTTP MCP JSON-RPC 2.0 endpoint (15 tools + 3 resources)",
        "security": [
          {},
          {
            "BearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "JSON-RPC 2.0 response"
          }
        }
      }
    },
    "/llms.txt": {
      "get": {
        "summary": "Markdown agent playbook and live B300 inventory",
        "responses": {
          "200": {
            "description": "text/markdown"
          }
        }
      }
    },
    "/.well-known/agent.json": {
      "get": {
        "summary": "Machine-readable Agent & MCP discovery manifest",
        "responses": {
          "200": {
            "description": "application/json"
          }
        }
      }
    },
    "/api/fleet": {
      "get": {
        "summary": "List HGX B300 physical nodes and online capacity",
        "responses": {
          "200": {
            "description": "Fleet inventory"
          }
        }
      }
    },
    "/api/listings": {
      "get": {
        "summary": "List bookable HGX B300 time blocks and free sub-slots",
        "responses": {
          "200": {
            "description": "Time listings"
          }
        }
      },
      "post": {
        "summary": "Publish a new B300 time block (Operator)",
        "security": [
          {
            "OperatorKey": []
          }
        ],
        "responses": {
          "201": {
            "description": "Listing created"
          }
        }
      }
    },
    "/api/schedule": {
      "get": {
        "summary": "72-hour per-node cluster schedule",
        "responses": {
          "200": {
            "description": "Node schedule"
          }
        }
      }
    },
    "/api/auth/register": {
      "post": {
        "summary": "Create a self-serve Busbar account",
        "responses": {
          "201": {
            "description": "Account + bearer token"
          }
        }
      }
    },
    "/api/auth/login": {
      "post": {
        "summary": "Sign in with email & password",
        "responses": {
          "200": {
            "description": "Account + bearer token"
          }
        }
      }
    },
    "/api/account/api-keys": {
      "post": {
        "summary": "Mint a scoped, spend-capped Agent API key (bb_live_/bb_test_)",
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "API key minted"
          }
        }
      }
    },
    "/api/account/api-keys/{keyId}": {
      "delete": {
        "summary": "Revoke an Agent API key",
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Key revoked"
          }
        }
      }
    },
    "/api/account/ssh-keys": {
      "post": {
        "summary": "Save an SSH public key to your vault",
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "SSH key saved"
          }
        }
      }
    },
    "/api/account/wallet/topup": {
      "post": {
        "summary": "Top up prepaid GPU credit balance",
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "Top-up initiated or credited"
          }
        }
      }
    },
    "/api/account/bookings": {
      "get": {
        "summary": "List your active & scheduled B300 clusters",
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Tenant bookings"
          }
        }
      },
      "post": {
        "summary": "Reserve & auto-provision HGX B300 nodes",
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "Booking created/active"
          }
        }
      }
    },
    "/api/account/bookings/{id}/extend": {
      "post": {
        "summary": "Extend a running cluster by +N hours from wallet",
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Booking extended"
          }
        }
      }
    },
    "/api/account/bookings/{id}/release": {
      "post": {
        "summary": "Stop cluster early, sanitize NVMe/NVLS, and refund unused credits",
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Cluster released & refunded"
          }
        }
      }
    }
  }
}