{
  "openapi": "3.0.3",
  "info": {
    "title": "Google AI Pro / Ultra Auto-Recharge Protocol Gateway API (Layer 1)",
    "version": "2.0.0",
    "description": "Pure protocol-layer API gateway with multi-tenant API Key management, atomic credit billing (Reserve → Settle / Auto-Refund), real-time queue position & ETA telemetry, regional proxy pools, and HMAC-SHA256 signed Webhooks."
  },
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer"
      },
      "ApiKeyHeader": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key"
      }
    }
  },
  "security": [
    {
      "BearerAuth": []
    },
    {
      "ApiKeyHeader": []
    }
  ],
  "paths": {
    "/portal": {
      "get": {
        "summary": "Self-Service User Platform (Register/Login + Visual Recharge + API Keys + CDK + Docs)"
      }
    },
    "/docs": {
      "get": {
        "summary": "Interactive API Integration Documentation (cURL / Python / Node.js / PHP)"
      }
    },
    "/docs.md": {
      "get": {
        "summary": "Downloadable Markdown (.md) API Documentation with live plan pricing (?lang=zh|en&download=1)"
      }
    },
    "/health": {
      "get": {
        "summary": "Service availability & queue summary"
      }
    },
    "/v1/auth/register": {
      "post": {
        "summary": "Register a new user account (username + password + optional CDK)"
      }
    },
    "/v1/auth/login": {
      "post": {
        "summary": "Log in with username & password to obtain session token"
      }
    },
    "/v1/auth/logout": {
      "post": {
        "summary": "Invalidate current web session token"
      }
    },
    "/v1/auth/password": {
      "post": {
        "summary": "Change logged-in user password"
      }
    },
    "/v1/account": {
      "get": {
        "summary": "Current user/API-key profile, credit balance, frozen credits & limits"
      }
    },
    "/v1/account/redeem-cdk": {
      "post": {
        "summary": "Redeem a Credit CDK to top up current account balance"
      }
    },
    "/v1/account/ledger": {
      "get": {
        "summary": "Current account credit transaction ledger"
      }
    },
    "/v1/account/webhook": {
      "post": {
        "summary": "Update default_callback_url or rotate own webhook_secret"
      }
    },
    "/v1/user/api-keys": {
      "get": {
        "summary": "List API keys generated by the logged-in user"
      },
      "post": {
        "summary": "Self-generate a new rk_live_... API key sharing the user's credit wallet"
      }
    },
    "/v1/user/api-keys/{key_id}": {
      "post": {
        "summary": "Update, disable/enable, or rotate a user-owned API key"
      }
    },
    "/v1/user/api-keys/{key_id}/delete": {
      "post": {
        "summary": "Delete / revoke a user-owned API key"
      }
    },
    "/v1/queue/status": {
      "get": {
        "summary": "Live global queue depth, worker capacity & estimated wait seconds"
      }
    },
    "/v1/plans": {
      "get": {
        "summary": "Supported recharge plans, credit costs & estimated durations"
      }
    },
    "/v1/regions": {
      "get": {
        "summary": "Supported billing regions, postal codes & regional pricing matrix"
      }
    },
    "/v1/recharge/orders": {
      "post": {
        "summary": "Submit recharge order (atomically freezes credits; idempotent by order_no)"
      },
      "get": {
        "summary": "List caller's recharge orders with queue & provisioning status"
      }
    },
    "/v1/recharge/orders/{order_no}": {
      "get": {
        "summary": "Get order progress, live queue position, ETA, credit billing & provisioning result"
      }
    },
    "/v1/recharge/orders/{order_no}/cancel": {
      "post": {
        "summary": "Cancel order & auto-refund frozen credits if not yet executed"
      }
    },
    "/v1/recharge/orders/{order_no}/redeliver-webhook": {
      "post": {
        "summary": "Synchronously redeliver signed Webhook callback for an order"
      }
    },
    "/v1/webhooks/test": {
      "post": {
        "summary": "Synchronously send signed webhook.test event to verify callback receiver"
      }
    }
  }
}