{
  "openapi": "3.1.0",
  "info": {
    "title": "Actobase Public API",
    "version": "0.1.0",
    "summary": "Live Actobase request, account, and auth surfaces.",
    "description": "Public HTTP contract for the live Actobase Watch and QA request surfaces. This spec covers only endpoints that are already live on actobase.com."
  },
  "servers": [
    {
      "url": "https://actobase.com",
      "description": "Production"
    }
  ],
  "tags": [
    {
      "name": "Health"
    },
    {
      "name": "Watch"
    },
    {
      "name": "QA"
    },
    {
      "name": "Account"
    },
    {
      "name": "Auth"
    }
  ],
  "paths": {
    "/health": {
      "get": {
        "tags": [
          "Health"
        ],
        "operationId": "getHealth",
        "summary": "Read service health",
        "responses": {
          "200": {
            "description": "Service health",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HealthResponse"
                }
              }
            }
          }
        }
      }
    },
    "/watch/api/start": {
      "post": {
        "tags": [
          "Watch"
        ],
        "operationId": "createWatchRequest",
        "summary": "Create a Hosted Watch request",
        "description": "Creates a watch request. If no authenticated account is provided, the first request issues an API key immediately and returns it in the response.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WatchStartRequest"
              },
              "examples": {
                "http": {
                  "value": {
                    "target_url": "https://example.com",
                    "mode": "http",
                    "interval_seconds": 60
                  }
                },
                "ai_html": {
                  "value": {
                    "target_url": "https://example.com/checkout",
                    "mode": "ai_html",
                    "interval_seconds": 300,
                    "expected_text": "checkout button is visible and the error banner is absent"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Accepted watch request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WatchStartResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Invalid provided credentials",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/qa/api/start": {
      "post": {
        "tags": [
          "QA"
        ],
        "operationId": "createQaRequest",
        "summary": "Create a Hosted QA request",
        "description": "Creates a QA request. If no authenticated account is provided, the first request issues an API key immediately and returns it in the response.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/QaStartRequest"
              },
              "examples": {
                "copy": {
                  "value": {
                    "site_url": "https://example.com",
                    "qa_focus": "copy",
                    "cadence": "one_time"
                  }
                },
                "visual_on_deploy": {
                  "value": {
                    "site_url": "https://example.com",
                    "qa_focus": "visual",
                    "cadence": "on_deploy",
                    "repo_url": "https://github.com/example/site"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Accepted QA request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QaStartResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Invalid provided credentials",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/watch/api/account": {
      "get": {
        "tags": [
          "Account"
        ],
        "operationId": "getAccountStatus",
        "summary": "Read the current account status",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "sessionToken": []
          }
        ],
        "responses": {
          "200": {
            "description": "Account status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountStatusResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid auth transport",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Requires authenticated transport",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/watch/api/auth/api-key": {
      "get": {
        "tags": [
          "Auth"
        ],
        "operationId": "getApiKeyStatus",
        "summary": "Read API key issue and revoke status",
        "responses": {
          "200": {
            "description": "API key auth status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiKeyStatusResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid auth transport",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Auth"
        ],
        "operationId": "issueApiKey",
        "summary": "Issue an additional API key",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "sessionToken": []
          }
        ],
        "responses": {
          "201": {
            "description": "Issued API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiKeyIssueResponse"
                }
              }
            }
          },
          "401": {
            "description": "Requires authenticated transport",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Issue is disallowed by current entitlement",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuthDecisionErrorResponse"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Auth"
        ],
        "operationId": "revokeApiKey",
        "summary": "Revoke an API key",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "sessionToken": []
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TokenRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Revoke result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiKeyRevokeResponse"
                }
              }
            }
          },
          "400": {
            "description": "Missing target token or invalid auth transport",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuthDecisionErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Requires authenticated transport",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuthDecisionErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Target is not owned by the authenticated actor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuthDecisionErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/watch/api/auth/session": {
      "get": {
        "tags": [
          "Auth"
        ],
        "operationId": "getSessionStatus",
        "summary": "Read session issue and revoke status",
        "responses": {
          "200": {
            "description": "Session auth status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionStatusResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid auth transport",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Auth"
        ],
        "operationId": "issueSession",
        "summary": "Issue a session token",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "sessionToken": []
          }
        ],
        "responses": {
          "201": {
            "description": "Issued session token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionIssueResponse"
                }
              }
            }
          },
          "401": {
            "description": "Requires authenticated transport",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Issue is disallowed by current transport policy",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuthDecisionErrorResponse"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Auth"
        ],
        "operationId": "revokeSession",
        "summary": "Revoke a session token",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "sessionToken": []
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TokenRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Revoke result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionRevokeResponse"
                }
              }
            }
          },
          "400": {
            "description": "Missing target token or invalid auth transport",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuthDecisionErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Requires authenticated transport",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuthDecisionErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Target is not owned by the authenticated actor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuthDecisionErrorResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "API key"
      },
      "sessionToken": {
        "type": "apiKey",
        "in": "header",
        "name": "x-actobase-session-token"
      }
    },
    "schemas": {
      "HealthResponse": {
        "type": "object",
        "required": [
          "ok",
          "service"
        ],
        "properties": {
          "ok": {
            "type": "boolean"
          },
          "service": {
            "type": "string"
          }
        }
      },
      "PaymentLinks": {
        "type": "object",
        "required": [
          "pilot",
          "credits",
          "monthly_credits"
        ],
        "properties": {
          "pilot": {
            "type": "string",
            "format": "uri"
          },
          "credits": {
            "type": "string",
            "format": "uri"
          },
          "monthly_credits": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "MachineSurfaces": {
        "type": "object",
        "required": [
          "openapi_url",
          "llms_url",
          "offer_url",
          "watch_offer_url",
          "qa_offer_url",
          "watch_request_url",
          "qa_request_url",
          "account_status_url",
          "api_key_status_url",
          "session_status_url"
        ],
        "properties": {
          "openapi_url": {
            "type": "string",
            "format": "uri"
          },
          "llms_url": {
            "type": "string",
            "format": "uri"
          },
          "offer_url": {
            "type": "string",
            "format": "uri"
          },
          "watch_offer_url": {
            "type": "string",
            "format": "uri"
          },
          "qa_offer_url": {
            "type": "string",
            "format": "uri"
          },
          "watch_request_url": {
            "type": "string",
            "format": "uri"
          },
          "qa_request_url": {
            "type": "string",
            "format": "uri"
          },
          "account_status_url": {
            "type": "string",
            "format": "uri"
          },
          "api_key_status_url": {
            "type": "string",
            "format": "uri"
          },
          "session_status_url": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "NextAction": {
        "type": "object",
        "required": [
          "id",
          "kind",
          "method",
          "url",
          "requires_bearer_token",
          "description"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "http_request",
              "payment_link",
              "documentation"
            ]
          },
          "method": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "GET",
              "POST",
              null
            ]
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "requires_bearer_token": {
            "type": "boolean"
          },
          "description": {
            "type": "string"
          }
        }
      },
      "ApiKeyIdentity": {
        "type": "object",
        "required": [
          "token",
          "actor_label",
          "created_at",
          "revoked_at"
        ],
        "properties": {
          "token": {
            "type": "string"
          },
          "actor_label": {
            "type": "string"
          },
          "actor_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "revoked_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "SessionIdentity": {
        "type": "object",
        "required": [
          "token",
          "actor_label",
          "created_at",
          "revoked_at"
        ],
        "properties": {
          "token": {
            "type": "string"
          },
          "actor_label": {
            "type": "string"
          },
          "actor_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "revoked_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "AccountBootstrap": {
        "type": "object",
        "required": [
          "account_id",
          "balance_cents",
          "usage_state",
          "issued_new_api_key",
          "top_up_links"
        ],
        "properties": {
          "account_id": {
            "type": "string"
          },
          "balance_cents": {
            "type": "integer"
          },
          "usage_state": {
            "type": "string",
            "enum": [
              "payment_required",
              "resource_enabled"
            ]
          },
          "issued_new_api_key": {
            "type": "boolean"
          },
          "api_key": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ApiKeyIdentity"
              },
              {
                "type": "null"
              }
            ]
          },
          "top_up_links": {
            "$ref": "#/components/schemas/PaymentLinks"
          }
        }
      },
      "WatchStartRequest": {
        "type": "object",
        "required": [
          "target_url"
        ],
        "properties": {
          "target_url": {
            "type": "string",
            "format": "uri"
          },
          "mode": {
            "type": "string",
            "enum": [
              "http",
              "html",
              "ai_html",
              "ai_image"
            ],
            "default": "http"
          },
          "interval_seconds": {
            "type": "integer",
            "minimum": 1,
            "default": 60
          },
          "auth_mode": {
            "type": "string",
            "enum": [
              "api_key_only",
              "api_key_plus_email"
            ],
            "default": "api_key_only"
          },
          "watch_name": {
            "type": "string"
          },
          "contact_email": {
            "type": "string",
            "format": "email"
          },
          "webhook_url": {
            "type": "string",
            "format": "uri"
          },
          "expected_text": {
            "type": "string"
          },
          "notes": {
            "type": "string"
          }
        }
      },
      "WatchRequest": {
        "type": "object",
        "required": [
          "watch_name",
          "target_url",
          "mode",
          "interval_seconds",
          "auth_mode",
          "contact_email",
          "webhook_url",
          "expected_text",
          "notes"
        ],
        "properties": {
          "watch_name": {
            "type": "string"
          },
          "target_url": {
            "type": "string",
            "format": "uri"
          },
          "mode": {
            "type": "string"
          },
          "interval_seconds": {
            "type": "integer"
          },
          "auth_mode": {
            "type": "string"
          },
          "contact_email": {
            "type": "string"
          },
          "webhook_url": {
            "type": "string"
          },
          "expected_text": {
            "type": "string"
          },
          "notes": {
            "type": "string"
          }
        }
      },
      "WatchEstimate": {
        "type": "object",
        "required": [
          "checks_per_month",
          "credits_per_month",
          "estimated_monthly_usd",
          "recommended_extra_packs",
          "recommended_monthly_packs",
          "next_step",
          "next_step_label",
          "pilot_included_credits",
          "warning"
        ],
        "properties": {
          "checks_per_month": {
            "type": "integer"
          },
          "credits_per_month": {
            "type": "integer"
          },
          "estimated_monthly_usd": {
            "type": "number"
          },
          "recommended_extra_packs": {
            "type": "integer"
          },
          "recommended_monthly_packs": {
            "type": "integer"
          },
          "next_step": {
            "type": "string"
          },
          "next_step_label": {
            "type": "string"
          },
          "pilot_included_credits": {
            "type": "integer"
          },
          "warning": {
            "type": "string"
          }
        }
      },
      "WatchStartResponse": {
        "type": "object",
        "required": [
          "request_id",
          "created_at",
          "remote_addr",
          "request_type",
          "request",
          "estimate",
          "account",
          "payment_links",
          "machine_surfaces",
          "next_actions"
        ],
        "properties": {
          "request_id": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "remote_addr": {
            "type": "string"
          },
          "request_type": {
            "type": "string",
            "const": "watch"
          },
          "request": {
            "$ref": "#/components/schemas/WatchRequest"
          },
          "estimate": {
            "$ref": "#/components/schemas/WatchEstimate"
          },
          "account": {
            "$ref": "#/components/schemas/AccountBootstrap"
          },
          "payment_links": {
            "$ref": "#/components/schemas/PaymentLinks"
          },
          "machine_surfaces": {
            "$ref": "#/components/schemas/MachineSurfaces"
          },
          "next_actions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NextAction"
            }
          }
        }
      },
      "QaStartRequest": {
        "type": "object",
        "required": [
          "site_url"
        ],
        "properties": {
          "site_url": {
            "type": "string",
            "format": "uri"
          },
          "qa_focus": {
            "type": "string",
            "enum": [
              "visual",
              "copy",
              "visual_copy",
              "recurring"
            ],
            "default": "visual"
          },
          "cadence": {
            "type": "string",
            "enum": [
              "one_time",
              "on_deploy",
              "daily"
            ],
            "default": "one_time"
          },
          "contact_email": {
            "type": "string",
            "format": "email"
          },
          "page_paths": {
            "type": "string",
            "description": "Newline-delimited route hints."
          },
          "repo_url": {
            "type": "string",
            "format": "uri"
          },
          "priority_concern": {
            "type": "string"
          }
        }
      },
      "QaRequest": {
        "type": "object",
        "required": [
          "site_url",
          "qa_focus",
          "cadence",
          "contact_email",
          "page_paths",
          "repo_url",
          "priority_concern"
        ],
        "properties": {
          "site_url": {
            "type": "string",
            "format": "uri"
          },
          "qa_focus": {
            "type": "string"
          },
          "cadence": {
            "type": "string"
          },
          "contact_email": {
            "type": "string"
          },
          "page_paths": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "repo_url": {
            "type": "string"
          },
          "priority_concern": {
            "type": "string"
          }
        }
      },
      "QaPricingUnit": {
        "type": "object",
        "required": [
          "name",
          "label",
          "unit",
          "unit_price_usd",
          "quantity",
          "subtotal_usd"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "unit": {
            "type": "string"
          },
          "unit_price_usd": {
            "type": "number"
          },
          "quantity": {
            "type": "integer"
          },
          "subtotal_usd": {
            "type": "number"
          }
        }
      },
      "QaOptionalAddOn": {
        "type": "object",
        "required": [
          "name",
          "label",
          "unit_price_usd",
          "when"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "unit_price_usd": {
            "type": "number"
          },
          "when": {
            "type": "string"
          }
        }
      },
      "QaEstimate": {
        "type": "object",
        "required": [
          "path_count",
          "estimated_scope_count",
          "focus_summary",
          "cadence_summary",
          "next_step",
          "next_step_label",
          "response_target",
          "pricing_model",
          "starting_price_usd",
          "pricing_summary",
          "pricing_units",
          "optional_add_ons",
          "requires_repo_integration",
          "payment_timing"
        ],
        "properties": {
          "path_count": {
            "type": "integer"
          },
          "estimated_scope_count": {
            "type": "integer"
          },
          "focus_summary": {
            "type": "string"
          },
          "cadence_summary": {
            "type": "string"
          },
          "next_step": {
            "type": "string"
          },
          "next_step_label": {
            "type": "string"
          },
          "response_target": {
            "type": "string"
          },
          "pricing_model": {
            "type": "string"
          },
          "starting_price_usd": {
            "type": "number"
          },
          "pricing_summary": {
            "type": "string"
          },
          "pricing_units": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/QaPricingUnit"
            }
          },
          "optional_add_ons": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/QaOptionalAddOn"
            }
          },
          "requires_repo_integration": {
            "type": "boolean"
          },
          "payment_timing": {
            "type": "string"
          }
        }
      },
      "QaStartResponse": {
        "type": "object",
        "required": [
          "request_id",
          "created_at",
          "remote_addr",
          "request_type",
          "request",
          "estimate",
          "account",
          "machine_surfaces",
          "next_actions"
        ],
        "properties": {
          "request_id": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "remote_addr": {
            "type": "string"
          },
          "request_type": {
            "type": "string",
            "const": "qa"
          },
          "request": {
            "$ref": "#/components/schemas/QaRequest"
          },
          "estimate": {
            "$ref": "#/components/schemas/QaEstimate"
          },
          "account": {
            "$ref": "#/components/schemas/AccountBootstrap"
          },
          "machine_surfaces": {
            "$ref": "#/components/schemas/MachineSurfaces"
          },
          "next_actions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NextAction"
            }
          }
        }
      },
      "AuthDecision": {
        "type": "object",
        "required": [
          "allowed",
          "reason"
        ],
        "properties": {
          "allowed": {
            "type": "boolean"
          },
          "reason": {
            "type": "string"
          }
        }
      },
      "ApiKeyStatusResponse": {
        "type": "object",
        "required": [
          "ok",
          "authenticated",
          "transport_kind",
          "account_id",
          "actor_label",
          "actor_id",
          "balance_cents",
          "usage_state",
          "active_api_key_count",
          "entitled_api_key_limit",
          "remaining_issue_count",
          "issue_decision",
          "revoke_decision",
          "machine_surfaces",
          "next_actions"
        ],
        "properties": {
          "ok": {
            "type": "boolean"
          },
          "authenticated": {
            "type": "boolean"
          },
          "transport_kind": {
            "type": "string",
            "enum": [
              "anonymous",
              "api_key",
              "session"
            ]
          },
          "account_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "actor_label": {
            "type": [
              "string",
              "null"
            ]
          },
          "actor_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "balance_cents": {
            "type": "integer"
          },
          "usage_state": {
            "type": "string"
          },
          "active_api_key_count": {
            "type": "integer"
          },
          "entitled_api_key_limit": {
            "type": [
              "integer",
              "null"
            ]
          },
          "remaining_issue_count": {
            "type": "integer"
          },
          "issue_decision": {
            "$ref": "#/components/schemas/AuthDecision"
          },
          "revoke_decision": {
            "$ref": "#/components/schemas/AuthDecision"
          },
          "machine_surfaces": {
            "$ref": "#/components/schemas/MachineSurfaces"
          },
          "next_actions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NextAction"
            }
          }
        }
      },
      "ApiKeyIssueResponse": {
        "type": "object",
        "required": [
          "ok",
          "action",
          "api_key",
          "active_api_key_count",
          "entitled_api_key_limit",
          "remaining_issue_count"
        ],
        "properties": {
          "ok": {
            "type": "boolean"
          },
          "action": {
            "type": "string",
            "const": "issue"
          },
          "api_key": {
            "$ref": "#/components/schemas/ApiKeyIdentity"
          },
          "active_api_key_count": {
            "type": "integer"
          },
          "entitled_api_key_limit": {
            "type": [
              "integer",
              "null"
            ]
          },
          "remaining_issue_count": {
            "type": "integer"
          }
        }
      },
      "ApiKeyRevokeResponse": {
        "type": "object",
        "required": [
          "ok",
          "action",
          "revoked",
          "active_api_key_count",
          "entitled_api_key_limit",
          "remaining_issue_count"
        ],
        "properties": {
          "ok": {
            "type": "boolean"
          },
          "action": {
            "type": "string",
            "const": "revoke"
          },
          "revoked": {
            "type": "boolean"
          },
          "active_api_key_count": {
            "type": "integer"
          },
          "entitled_api_key_limit": {
            "type": [
              "integer",
              "null"
            ]
          },
          "remaining_issue_count": {
            "type": "integer"
          }
        }
      },
      "SessionStatusResponse": {
        "type": "object",
        "required": [
          "ok",
          "authenticated",
          "transport_kind",
          "account_id",
          "actor_label",
          "actor_id",
          "balance_cents",
          "usage_state",
          "session_cookie_name",
          "session_max_age_seconds",
          "issue_decision",
          "revoke_decision",
          "machine_surfaces",
          "next_actions"
        ],
        "properties": {
          "ok": {
            "type": "boolean"
          },
          "authenticated": {
            "type": "boolean"
          },
          "transport_kind": {
            "type": "string",
            "enum": [
              "anonymous",
              "api_key",
              "session"
            ]
          },
          "account_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "actor_label": {
            "type": [
              "string",
              "null"
            ]
          },
          "actor_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "balance_cents": {
            "type": "integer"
          },
          "usage_state": {
            "type": "string"
          },
          "session_cookie_name": {
            "type": "string"
          },
          "session_max_age_seconds": {
            "type": "integer"
          },
          "issue_decision": {
            "$ref": "#/components/schemas/AuthDecision"
          },
          "revoke_decision": {
            "$ref": "#/components/schemas/AuthDecision"
          },
          "machine_surfaces": {
            "$ref": "#/components/schemas/MachineSurfaces"
          },
          "next_actions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NextAction"
            }
          }
        }
      },
      "SessionIssueResponse": {
        "type": "object",
        "required": [
          "ok",
          "action",
          "session",
          "session_cookie_name",
          "session_max_age_seconds"
        ],
        "properties": {
          "ok": {
            "type": "boolean"
          },
          "action": {
            "type": "string",
            "const": "issue"
          },
          "session": {
            "$ref": "#/components/schemas/SessionIdentity"
          },
          "session_cookie_name": {
            "type": "string"
          },
          "session_max_age_seconds": {
            "type": "integer"
          }
        }
      },
      "SessionRevokeResponse": {
        "type": "object",
        "required": [
          "ok",
          "action",
          "revoked"
        ],
        "properties": {
          "ok": {
            "type": "boolean"
          },
          "action": {
            "type": "string",
            "const": "revoke"
          },
          "revoked": {
            "type": "boolean"
          }
        }
      },
      "AccountStatusResponse": {
        "type": "object",
        "required": [
          "ok",
          "authenticated",
          "transport_kind",
          "account_id",
          "actor_label",
          "actor_id",
          "balance_cents",
          "usage_state",
          "top_up_links",
          "machine_surfaces",
          "next_actions"
        ],
        "properties": {
          "ok": {
            "type": "boolean"
          },
          "authenticated": {
            "type": "boolean"
          },
          "transport_kind": {
            "type": "string"
          },
          "account_id": {
            "type": "string"
          },
          "actor_label": {
            "type": [
              "string",
              "null"
            ]
          },
          "actor_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "balance_cents": {
            "type": "integer"
          },
          "usage_state": {
            "type": "string",
            "enum": [
              "payment_required",
              "resource_enabled"
            ]
          },
          "top_up_links": {
            "$ref": "#/components/schemas/PaymentLinks"
          },
          "machine_surfaces": {
            "$ref": "#/components/schemas/MachineSurfaces"
          },
          "next_actions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NextAction"
            }
          }
        }
      },
      "TokenRequest": {
        "type": "object",
        "properties": {
          "token": {
            "type": "string"
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string"
          },
          "details": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "AuthDecisionErrorResponse": {
        "type": "object",
        "required": [
          "error",
          "decision"
        ],
        "properties": {
          "error": {
            "type": "string"
          },
          "decision": {
            "$ref": "#/components/schemas/AuthDecision"
          }
        }
      }
    }
  }
}
