{
  "openapi": "3.1.0",
  "info": {
    "title": "rbox Public API",
    "version": "1.0.0",
    "description": "Stable, unauthenticated rbox health and CLI release endpoints. Workspace synchronization is supported through the rbox CLI rather than as a third-party REST API.",
    "contact": {
      "name": "rbox support",
      "email": "support@rbox.to",
      "url": "https://rbox.to/contact/"
    }
  },
  "servers": [{ "url": "https://api.rbox.to", "description": "Production rbox API" }],
  "paths": {
    "/health": {
      "get": {
        "operationId": "getRboxApiHealth",
        "summary": "Check API health",
        "description": "Returns the health of the production rbox API without authentication.",
        "responses": {
          "200": {
            "description": "The API is healthy.",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Health" } } }
          }
        }
      }
    },
    "/version": {
      "get": {
        "operationId": "getLatestRboxRelease",
        "summary": "Get the latest CLI release manifest",
        "description": "Returns the signed-release metadata used by the official installer and CLI updater.",
        "responses": {
          "200": {
            "description": "Latest release metadata.",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ReleaseManifest" } } }
          },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/version.sig": {
      "get": {
        "operationId": "getLatestRboxReleaseSignature",
        "summary": "Get the latest release signature",
        "description": "Returns the detached signature for the latest CLI release manifest.",
        "responses": {
          "200": { "description": "Detached release signature.", "content": { "text/plain": { "schema": { "type": "string" } } } },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/install.sh": {
      "get": {
        "operationId": "getRboxInstallScript",
        "summary": "Download the CLI installer",
        "description": "Returns the official POSIX shell installer for the latest stable rbox CLI.",
        "responses": {
          "200": { "description": "POSIX shell installer.", "content": { "text/x-shellscript": { "schema": { "type": "string" } } } },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/agent.sh": {
      "get": {
        "operationId": "getRboxAgentSetupScript",
        "summary": "Download the agent setup wrapper",
        "description": "Returns a POSIX shell wrapper that installs rbox when necessary and starts CLI setup for an agent or CI environment.",
        "responses": {
          "200": { "description": "POSIX shell setup wrapper.", "content": { "text/x-shellscript": { "schema": { "type": "string" } } } }
        }
      }
    },
    "/changelog.md": {
      "get": {
        "operationId": "getRboxCliChangelog",
        "summary": "Get the CLI changelog",
        "description": "Returns the public rbox CLI release history as Markdown.",
        "responses": {
          "200": { "description": "CLI release history.", "content": { "text/markdown": { "schema": { "type": "string" } } } },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Health": {
        "type": "object",
        "additionalProperties": false,
        "required": ["ok", "service"],
        "properties": {
          "ok": { "type": "boolean", "const": true, "description": "Whether the API is healthy." },
          "service": { "type": "string", "const": "rbox-api", "description": "Service identifier." }
        }
      },
      "ReleaseArtifact": {
        "type": "object",
        "description": "A downloadable CLI build for one supported operating-system and CPU target.",
        "required": ["path", "sha256"],
        "properties": {
          "path": { "type": "string", "description": "Artifact path relative to the API binary download prefix." },
          "sha256": { "type": "string", "pattern": "^[0-9a-f]{64}$", "description": "Lowercase SHA-256 digest of the artifact." }
        },
        "additionalProperties": true
      },
      "ReleaseManifest": {
        "type": "object",
        "description": "Signed metadata for the latest stable rbox CLI release.",
        "required": ["version", "keyId", "artifacts", "releasedAt"],
        "properties": {
          "version": { "type": "string", "pattern": "^v?\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?$", "description": "Latest semantic version." },
          "keyId": { "type": "string", "description": "Identifier of the signing key used for the release." },
          "artifacts": { "type": "object", "additionalProperties": { "$ref": "#/components/schemas/ReleaseArtifact" }, "description": "Artifacts keyed by platform target." },
          "releasedAt": { "type": "string", "format": "date-time", "description": "Release publication timestamp." }
        },
        "additionalProperties": true
      },
      "Error": {
        "type": "object",
        "additionalProperties": false,
        "required": ["error"],
        "properties": { "error": { "type": "string", "description": "Stable machine-readable error code." } }
      }
    },
    "responses": {
      "NotFound": {
        "description": "The requested release resource does not exist.",
        "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
      }
    }
  }
}
