{
  "openapi": "3.1.0",
  "info": {
    "title": "Cloudbrowser REST API",
    "version": "0.6.0",
    "description": "Cloudbrowser REST API. Use a scoped personal API token for workspace browser operations or use the existing CLI sign-in credential. See https://cloudbrowser.tv/docs/api-tokens for supported scopes and endpoints. Billing endpoints require configured Stripe. Lifecycle operations are asynchronous; fork requires a paused source."
  },
  "servers": [
    {
      "url": "http://localhost:3000/api/v1",
      "description": "Local development server"
    },
    {
      "url": "https://cloudbrowser.tv/api/v1",
      "description": "Production API"
    }
  ],
  "security": [
    {
      "ApiKey": []
    }
  ],
  "paths": {
    "/playground": {
      "get": {
        "operationId": "getPlayground",
        "summary": "Read the temporary session and initialize its HttpOnly browser proof cookie",
        "description": "Read the temporary session, signed-in state and whether the guest allowance is exhausted (guestTrialUsed) and the remaining guest runtime known from that proof in seconds (guestRemainingSeconds, null when signed in). Initializes its HttpOnly browser proof cookie. The response also includes linksEnabled, indicating whether temporary CDP and Live View link creation is available.",
        "security": [
          {}
        ],
        "responses": {
          "200": {
            "description": "Successful response"
          },
          "409": {
            "description": "Session unavailable"
          },
          "429": {
            "description": "Quota or capacity limit"
          }
        }
      },
      "post": {
        "operationId": "startPlayground",
        "parameters": [
          {
            "name": "browserType",
            "in": "query",
            "required": false,
            "description": "Select an available browser for a new temporary session; existing sessions retain their browser. The Playground status response lists availableBrowserTypes.",
            "schema": {
              "type": "string",
              "enum": ["chrome", "edge", "chromium", "brave"],
              "default": "chrome"
            }
          }
        ],
        "summary": "Start a temporary browser session",
        "description": "Start a temporary browser. Guests receive 30 minutes of cumulative browser runtime across sessions in a rolling 30-day window, with at most one active session per recognized guest. The guest allowance uses the browser proof and existing device signals. Global guest capacity and allocation budgets remain separate. Signed-in sessions use normal workspace quota and concurrency. Requires a browser proof cookie and the application Origin.",
        "security": [
          {}
        ],
        "responses": {
          "202": {
            "description": "Successful response"
          },
          "409": {
            "description": "Session unavailable"
          },
          "429": {
            "description": "Guest trial limit (playground_guest_limit), temporary guest capacity (playground_guest_capacity), or signed-in workspace quota"
          }
        }
      }
    },
    "/playground/{browserId}/open-url": {
      "post": {
        "operationId": "openPlaygroundUrl",
        "summary": "Open an HTTP or HTTPS website in a new foreground tab on a running temporary desktop",
        "description": "Requires the initiating browser proof, application Origin and matching runtime generation. Billed sessions also require the initiating account.",
        "parameters": [{ "in": "path", "name": "browserId", "required": true, "schema": { "type": "string" } }],
        "security": [{}],
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/OpenPlaygroundUrl" } } } },
        "responses": {
          "200": { "description": "Tab opened" },
          "400": { "description": "Invalid destination or proof cookie missing" },
          "403": { "description": "Account or origin mismatch" },
          "409": { "description": "Session or generation unavailable" }
        }
      }
    },
    "/playground/{browserId}/ticket": {
      "post": {
        "operationId": "getPlaygroundTicket",
        "summary": "Issue a short-lived viewer ticket for an active trial using its browser proof",
        "description": "Issue a short-lived viewer ticket for an active trial using its browser proof.",
        "security": [
          {}
        ],
        "responses": {
          "200": {
            "description": "Successful response"
          },
          "409": {
            "description": "Session unavailable"
          },
          "425": {
            "description": "The requested generation is still starting. Retry the ticket request."
          },
          "429": {
            "description": "Quota or capacity limit"
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "browserId",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "generation",
            "description": "Wait up to 20 seconds for this explicitly launched runtime generation before issuing a ticket.",
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ]
      }
    },
    "/playground/{browserId}/claim": {
      "post": {
        "operationId": "claimPlayground",
        "summary": "Claim the same running browser or begin the verified sign-in flow",
        "description": "Claim the same running browser or begin the verified sign-in flow. Requires the browser proof and application Origin.",
        "security": [
          {}
        ],
        "responses": {
          "200": {
            "description": "Successful response"
          },
          "409": {
            "description": "Session unavailable"
          },
          "429": {
            "description": "Quota or capacity limit"
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "browserId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/playground/{browserId}/end": {
      "post": {
        "operationId": "endPlayground",
        "summary": "End the trial and schedule deletion",
        "description": "End the trial and schedule deletion. Requires the browser proof and application Origin.",
        "security": [
          {}
        ],
        "responses": {
          "200": {
            "description": "Successful response"
          },
          "409": {
            "description": "Session unavailable"
          },
          "429": {
            "description": "Quota or capacity limit"
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "browserId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/playground/{browserId}/links/{audience}": {
      "get": {
        "operationId": "getPlaygroundLink",
        "summary": "Get the active temporary link",
        "description": "Requires initiating proof cookie and original account for billed sessions. Returns link:null or a link with id, permission, url and activeConnections (CDP only).",
        "security": [
          {}
        ],
        "responses": {
          "200": {
            "description": "Successful response"
          },
          "403": {
            "description": "Access denied"
          },
          "410": {
            "description": "Temporary session ended"
          },
          "429": {
            "description": "Temporary connection limit"
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "browserId",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "audience",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "cdp",
                "live-view"
              ]
            }
          }
        ]
      },
      "post": {
        "operationId": "managePlaygroundLink",
        "summary": "Create, change permission, or revoke a temporary link",
        "description": "Requires initiating proof cookie, application Origin and original account for billed sessions. One active link per audience per runtime. Live View defaults to view; CDP is always control. Updating permission ends existing viewer sessions. All temporary links end at claim or deletion.",
        "security": [
          {}
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlaygroundLinkChange"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response"
          },
          "403": {
            "description": "Access denied"
          },
          "410": {
            "description": "Temporary session ended"
          },
          "429": {
            "description": "Temporary connection limit"
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "browserId",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "audience",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "cdp",
                "live-view"
              ]
            }
          }
        ]
      }
    },
    "/playground-share/{linkId}/{action}": {
      "post": {
        "operationId": "openTemporaryShare",
        "summary": "Resolve a temporary Live View or issue a viewer ticket",
        "description": "Requires the application Origin and temporary Live View secret. No account or library acceptance. Resolve returns browser metadata and permission; ticket additionally returns a short-lived viewer ticket and isolated viewer URL. Never resumes or extends the browser.",
        "security": [
          {}
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TemporaryShareCredential"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response"
          },
          "403": {
            "description": "Access denied"
          },
          "410": {
            "description": "Temporary session ended"
          },
          "429": {
            "description": "Temporary connection limit"
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "linkId",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "action",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "resolve",
                "ticket"
              ]
            }
          }
        ]
      }
    },
    "/browsers": {
      "post": {
        "operationId": "createBrowser",
        "summary": "Create a browser",
        "description": "Reserves running capacity atomically and queues an on-demand browser creation. Returns the lifecycle operation. Links can be created before the browser is running. Connecting requires a running browser.",
        "x-cli": "cloudbrowser create --name research --wait",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Replays with the same payload return the same operation. Different payload returns 409."
          }
        ],
        "responses": {
          "202": {
            "description": "Accepted asynchronous operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Operation"
                }
              }
            }
          },
          "default": {
            "description": "Structured error; HTTP 400/401/403/404/409/429/503 as applicable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateBrowser"
              }
            }
          }
        },
        "x-implementation": "local"
      },
      "get": {
        "operationId": "listBrowsers",
        "summary": "List browsers",
        "description": "",
        "x-cli": "cloudbrowser list --output json",
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Browser"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Structured error; HTTP 400/401/403/404/409/429/503 as applicable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-implementation": "local"
      }
    },
    "/browsers/{browserId}": {
      "get": {
        "operationId": "getBrowser",
        "summary": "Get a browser",
        "description": "",
        "x-cli": "cloudbrowser get br_123",
        "parameters": [
          {
            "name": "browserId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Browser"
                }
              }
            }
          },
          "default": {
            "description": "Structured error; HTTP 400/401/403/404/409/429/503 as applicable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-implementation": "local"
      },
      "delete": {
        "operationId": "deleteBrowser",
        "summary": "Delete a browser",
        "description": "Revoke all grants and stop connections. Deletion is terminal.",
        "x-cli": "cloudbrowser delete br_123 --yes",
        "parameters": [
          {
            "name": "browserId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "202": {
            "description": "Accepted asynchronous operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Operation"
                }
              }
            }
          },
          "default": {
            "description": "Structured error; HTTP 400/401/403/404/409/429/503 as applicable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-implementation": "local"
      },
      "patch": {
        "operationId": "updateBrowserSettings",
        "summary": "Update browser settings",
        "description": "Owner workspace only. Save auto-pause immediately. Re-enabling grants a fresh 5-minute connection window. Returns 409 while pausing or deleting. Never resumes a browser.",
        "parameters": [
          {
            "name": "browserId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateBrowserSettings"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Browser"
                }
              }
            }
          },
          "default": {
            "description": "Structured error; HTTP 400/401/403/404/409/429/503 as applicable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-implementation": "local"
      }
    },
    "/browsers/{browserId}/pause": {
      "post": {
        "operationId": "pauseBrowser",
        "summary": "Pause a browser",
        "description": "Pause disconnects active transports and invalidates runtime viewer sessions/tickets. CDP and reusable Live View links remain valid. After resume reconnect with the same URL. Chrome profiles persist; live page memory is not guaranteed. No implicit resume on access. Pause flushes Chrome profile writes before requesting provider pause. Owners can retry pause for a failed browser with a previous runtime. Admission immediately sets browser status to pausing. Operation success requires the provider to confirm paused; HTTP 202 alone is not completion.",
        "x-cli": "cloudbrowser pause br_123 --wait",
        "parameters": [
          {
            "name": "browserId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "202": {
            "description": "Accepted asynchronous operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Operation"
                }
              }
            }
          },
          "default": {
            "description": "Structured error; HTTP 400/401/403/404/409/429/503 as applicable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-implementation": "local"
      }
    },
    "/browsers/{browserId}/resume": {
      "post": {
        "operationId": "resumeBrowser",
        "summary": "Resume a browser",
        "description": "Pause disconnects active transports and invalidates runtime viewer sessions/tickets. CDP and reusable Live View links remain valid. After resume reconnect with the same URL. Chrome profiles persist; live page memory is not guaranteed. No implicit resume on access. Pause flushes Chrome profile writes before requesting provider pause. Admission immediately sets browser status to resuming. Operation success requires a new running runtime generation and responsive desktop/CDP services; reconnect only after success. HTTP 202 alone is not completion.",
        "x-cli": "cloudbrowser resume br_123 --wait",
        "parameters": [
          {
            "name": "browserId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "202": {
            "description": "Accepted asynchronous operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Operation"
                }
              }
            }
          },
          "default": {
            "description": "Structured error; HTTP 400/401/403/404/409/429/503 as applicable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-implementation": "local"
      }
    },
    "/browsers/{browserId}/restart": {
      "post": {
        "operationId": "restartBrowser",
        "summary": "Restart a browser",
        "description": "Owner workspace only. Requires a running browser or a failed browser with an existing runtime. Saves the profile and starts Chrome again on the same browser. Existing grants survive. Web caches and managed downloads are cleared. Unsaved work and in-memory state can be lost. Existing sessions disconnect. The operation reapplies the network policy and waits for a new generation with healthy desktop and CDP endpoints. Compute allowance and concurrency apply.",
        "x-cli": "cloudbrowser restart br_123 --wait",
        "parameters": [
          {
            "name": "browserId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "202": {
            "description": "Accepted asynchronous operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Operation"
                }
              }
            }
          },
          "default": {
            "description": "Structured error; HTTP 400/401/403/404/409/429/503 as applicable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-implementation": "local"
      }
    },
    "/browsers/{browserId}/fork": {
      "post": {
        "operationId": "forkBrowser",
        "summary": "Fork a browser",
        "description": "Creates an independent browser from a paused source checkpoint. Cookies and site storage are inherited. The child starts with empty web caches and managed downloads. The child receives its own browser ID. Create access grants for the child as needed. A running source returns 409 pause_required. Multiple forks can share a paused source. Resume or deletion of the source returns 409 busy until its forks finish. Completed children can be operated independently.",
        "x-cli": "cloudbrowser fork br_123 --name research-copy --wait",
        "parameters": [
          {
            "name": "browserId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Replays with the same payload return the same operation. Different payload returns 409."
          }
        ],
        "responses": {
          "202": {
            "description": "Accepted asynchronous operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Operation"
                }
              }
            }
          },
          "default": {
            "description": "Structured error; HTTP 400/401/403/404/409/429/503 as applicable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ForkBrowser"
              }
            }
          }
        },
        "x-implementation": "local"
      }
    },
    "/browsers/{browserId}/grants": {
      "post": {
        "operationId": "createGrant",
        "summary": "Create connection access",
        "description": "Create a permanent browser-scoped link, valid until revoked. CDP provides full control. Live View requires sign-in and defaults to read-only. URLs survive pause/resume; runtime connections must reconnect. The URL is returned on creation and can be revealed again by the owner; listings never expose it.",
        "x-cli": "cloudbrowser links create br_123 --audience cdp --name research --output json",
        "parameters": [
          {
            "name": "browserId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GrantIssue"
                }
              }
            }
          },
          "default": {
            "description": "Structured error; HTTP 400/401/403/404/409/429/503 as applicable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateGrant"
              },
              "examples": {
                "cdp": {
                  "value": {
                    "audience": "cdp",
                    "permission": "control"
                  }
                },
                "liveView": {
                  "value": {
                    "audience": "live-view",
                    "mode": "share",
                    "permission": "view"
                  }
                }
              }
            }
          }
        },
        "x-implementation": "local"
      },
      "get": {
        "operationId": "listGrants",
        "summary": "List access grants",
        "description": "List metadata only, never bearer URLs, share secrets, refresh cookies or entry tickets. Live View metadata includes permission, expiresAt (null for never), lastOpenedAt, activeSessions and revision. Filter by audience/status; paginate with cursor/limit. Local implementation returns all matching entries with nextCursor=null; pagination is pending.",
        "x-cli": "cloudbrowser links list br_123",
        "parameters": [
          {
            "name": "browserId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "audience",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "cdp",
                "live-view"
              ]
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "active",
                "expired",
                "revoked",
                "used"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Grant"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Structured error; HTTP 400/401/403/404/409/429/503 as applicable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-implementation": "local"
      }
    },
    "/browsers/{browserId}/grants/{grantId}": {
      "delete": {
        "operationId": "revokeGrant",
        "summary": "Revoke access",
        "description": "Permanently revoke this grant, close its streams, and invalidate all tickets and refresh families. Reusable URL can no longer create sessions. Idempotent; revoked grants cannot be revived. Does not delete the browser.",
        "x-cli": "cloudbrowser links revoke br_123 grant_123 --yes",
        "parameters": [
          {
            "name": "browserId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "grantId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "default": {
            "description": "Structured error; HTTP 400/401/403/404/409/429/503 as applicable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Grant"
                }
              }
            }
          }
        },
        "x-implementation": "local"
      },
      "patch": {
        "operationId": "updateLiveViewLink",
        "summary": "Change a Live View share link policy",
        "description": "Change link name or Live View permission. Policy updates invalidate existing viewer sessions. Only the owner can manage links.",
        "x-cli": "cloudbrowser links update br_123 grant_123 --permission view",
        "parameters": [
          {
            "name": "browserId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "grantId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateLiveViewGrant"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LiveViewGrant"
                }
              }
            }
          },
          "default": {
            "description": "Structured error; HTTP 400/401/403/404/409/429/503 as applicable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-implementation": "local"
      }
    },
    "/operations/{operationId}": {
      "get": {
        "operationId": "getOperation",
        "summary": "Inspect an operation",
        "description": "",
        "parameters": [
          {
            "name": "operationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Operation"
                }
              }
            }
          },
          "default": {
            "description": "Structured error; HTTP 400/401/403/404/409/429/503 as applicable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-implementation": "local"
      }
    },
    "/usage": {
      "get": {
        "operationId": "getUsage",
        "summary": "Get current usage",
        "description": "",
        "x-cli": "cloudbrowser usage --output json",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Usage"
                }
              }
            }
          },
          "default": {
            "description": "Structured error; HTTP 400/401/403/404/409/429/503 as applicable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-implementation": "local"
      }
    },
    "/b/{browserId}/session/exchange": {
      "post": {
        "operationId": "exchangeViewerTicket",
        "summary": "Exchange a Live View link",
        "description": "Consume an account-authorized, runtime-bound ticket once and issue short-lived HttpOnly viewer session cookies. Requires exact Origin and browser binding; rejects revoked source grants, changed permissions and inactive runtimes. Link authorization persists until revoked; session credentials refresh internally. No workspace key or anonymous sharing access is accepted.",
        "servers": [
          {
            "url": "http://localhost:3001",
            "description": "Isolated local viewer"
          },
          {
            "url": "https://view.cloudbrowser.tv",
            "description": "Production viewer"
          }
        ],
        "security": [],
        "parameters": [
          {
            "name": "browserId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "default": {
            "description": "Structured error; HTTP 400/401/403/404/409/429/503 as applicable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "200": {
            "description": "Credentials are returned only via HttpOnly Set-Cookie; invalid/consumed tickets return 401.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ViewerSessionReceipt"
                }
              }
            }
          }
        },
        "x-viewer": true,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExchangeViewerTicket"
              }
            }
          }
        },
        "x-implementation": "local"
      }
    },
    "/b/{browserId}/session/refresh": {
      "post": {
        "operationId": "refreshViewerSession",
        "summary": "Refresh the viewer session",
        "description": "Rotate short-lived viewer cookies with reuse detection. Reject revoked sessions, inactive grants, changed revision/runtime or expired idle deadline. Internal session refresh requires no CLI process. Reopen through the authenticated account library after session inactivity. Does not widen permissions.",
        "servers": [
          {
            "url": "http://localhost:3001",
            "description": "Isolated local viewer"
          },
          {
            "url": "https://view.cloudbrowser.tv",
            "description": "Production viewer"
          }
        ],
        "security": [
          {
            "ViewerRefresh": []
          }
        ],
        "parameters": [
          {
            "name": "browserId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "session",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Non-secret session ID returned by exchange; matching cookies still required."
          }
        ],
        "responses": {
          "200": {
            "description": "Credentials are returned only via HttpOnly Set-Cookie; invalid/consumed tickets return 401.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ViewerSessionReceipt"
                }
              }
            }
          },
          "default": {
            "description": "Structured error; HTTP 400/401/403/404/409/429/503 as applicable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-viewer": true,
        "x-implementation": "local"
      }
    },
    "/b/{browserId}/session/logout": {
      "post": {
        "operationId": "logoutViewerSession",
        "summary": "End the viewer session",
        "description": "End only the current viewer session, revoke its refresh family and close streams; clear cookies using the exact browser-specific path. Does not revoke the share URL: the accepted account can reopen its saved browser for a new session. Direct one-time tickets remain consumed. Missing/expired cookies are cleared and return 200. Closing a page alone is not reliable logout. Use isolated viewer origin, no-store/no-referrer, strict CSP, same-origin credentials, exact Origin/CSRF checks and redacted logs. Check current link authorization, permission, revision, runtime and issuer access on every request and stream. Never accept a workspace API key here. Validate the recipient\u2019s active account/membership as well as the owner\u2019s source grant. Removal from the recipient library invalidates that recipient\u2019s sessions only. Local cookies are independently named per viewer session (cb_access_{sessionId}, cb_refresh_{sessionId}) and omit Secure on localhost HTTP. No anonymous account authorization.",
        "servers": [
          {
            "url": "http://localhost:3001",
            "description": "Isolated local viewer"
          },
          {
            "url": "https://view.cloudbrowser.tv",
            "description": "Production viewer"
          }
        ],
        "security": [
          {
            "ViewerAccess": []
          },
          {
            "ViewerRefresh": []
          }
        ],
        "parameters": [
          {
            "name": "browserId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "session",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Non-secret session ID returned by exchange; matching cookies still required."
          }
        ],
        "responses": {
          "default": {
            "description": "Structured error; HTTP 400/401/403/404/409/429/503 as applicable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        },
        "x-viewer": true,
        "x-implementation": "local"
      }
    },
    "/browsers/{browserId}/grants/{grantId}/sessions": {
      "get": {
        "operationId": "listLiveViewSessions",
        "summary": "List a link\u2019s authorized viewer sessions",
        "description": "Workspace authorization required. Return metadata only; no cookies, tokens or private page content. Expired/ended sessions are excluded. Local implementation returns all matching entries with nextCursor=null; pagination is pending.",
        "parameters": [
          {
            "name": "browserId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "grantId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ViewerSession"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "nextCursor"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Structured error; HTTP 400/401/403/404/409/429/503 as applicable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-implementation": "local"
      },
      "delete": {
        "operationId": "endLiveViewSessions",
        "summary": "End all sessions for a Live View link",
        "description": "Workspace authorization required. Invalidate all current sessions, refresh families and outstanding entry tickets; close streams. The reusable share URL stays valid for future visits. Use revokeGrant to prevent future visits too. Does not operate on CDP.",
        "parameters": [
          {
            "name": "browserId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "grantId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "default": {
            "description": "Structured error; HTTP 400/401/403/404/409/429/503 as applicable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Grant"
                }
              }
            }
          }
        },
        "x-implementation": "local"
      }
    },
    "/library/resources": {
      "post": {
        "operationId": "listBrowserResources",
        "summary": "Read current resource metrics for visible browsers",
        "description": "Account-only, read-only sampling. Accepts up to 32 browser IDs; only authorized running browsers return fresh CPU and RAM measurements. Missing or unauthorized IDs are omitted. An unavailable or stopped runtime returns null or is omitted. Monitoring does not resume browsers or count as a desktop/CDP connection.",
        "x-account": true,
        "security": [
          {
            "AccountSession": []
          },
          {
            "AccountAccess": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BrowserResourceRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Recent samples keyed by browser ID",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BrowserResourceResponse"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required"
          }
        },
        "x-implementation": "local"
      }
    },
    "/library/browsers": {
      "get": {
        "operationId": "listBrowserLibrary",
        "summary": "List my owned and shared browsers",
        "description": "Signed-in account only. Owned and shared entries appear in one grid. A shared entry does not transfer ownership, create a browser, consume the recipient\u2019s browser concurrency, or grant lifecycle/reshare/CDP rights. Every preview subscription rechecks current authorization. Unavailable entries may remain visible without streaming private contents. Compute remains on the owning workspace. Local implementation returns all matching entries with nextCursor=null; pagination is pending.",
        "x-account": true,
        "security": [
          {
            "AccountSession": []
          },
          {
            "AccountAccess": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/BrowserLibraryEntry"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "nextCursor"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Structured error; HTTP 400/401/403/404/409/429/503 as applicable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-implementation": "local"
      }
    },
    "/library/shares/accept": {
      "post": {
        "operationId": "acceptSharedBrowser",
        "summary": "Accept a shared browser into my account",
        "description": "Requires signed-in account and a valid invitation. Reusable share links can be accepted by multiple accounts. Direct one-time invitations atomically bind to the first accepting account; subsequent redemption receives 409, including by the same account; use the saved library entry instead. Validate link expiration, revocation, revision and owner authority before accepting. Save an account-to-browser access reference, not ownership or a raw bearer token. Deduplicate by account/browser and retain a specific authorized source grant; never silently widen rights. Existing owner entries remain owned. Accepted members can later request fresh viewer tickets without replaying the original invite. Entry ticket expiration does not expire accepted membership; parent-link expiration/revocation does. Return the canonical /browsers/{id} URL. A paused browser can be added but must not be resumed automatically.",
        "x-account": true,
        "security": [
          {
            "AccountSession": []
          },
          {
            "AccountAccess": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AcceptSharedBrowser"
              }
            }
          }
        },
        "responses": {
          "default": {
            "description": "Structured error; HTTP 400/401/403/404/409/429/503 as applicable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "browserId"
                  ],
                  "properties": {
                    "browserId": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "x-implementation": "local"
      }
    },
    "/library/browsers/{browserId}": {
      "delete": {
        "operationId": "removeSharedBrowser",
        "summary": "Remove a shared browser from my library",
        "description": "Remove only this recipient\u2019s saved access relationship and end that recipient\u2019s viewer sessions. Do not delete/pause the owner\u2019s browser, revoke the public share link or affect other recipients. Reject owned entries; owner deletion uses the lifecycle API. Re-adding requires a valid reusable invite or new invite if one-time access was removed.",
        "x-account": true,
        "security": [
          {
            "AccountSession": []
          },
          {
            "AccountAccess": []
          }
        ],
        "parameters": [
          {
            "name": "browserId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "default": {
            "description": "Structured error; HTTP 400/401/403/404/409/429/503 as applicable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "removed": {
                      "const": true
                    }
                  }
                }
              }
            }
          }
        },
        "x-implementation": "local"
      }
    },
    "/library/browsers/{browserId}/viewer-ticket": {
      "post": {
        "operationId": "createLibraryViewerTicket",
        "summary": "Open an owned or saved shared browser",
        "description": "Account authorization required. Check ownership or saved membership AND its current parent grant permission, revision, expiration and issuer access; a saved list entry is not authority by itself. Browser must be running to stream; paused view shows an explicitly labeled authorized last frame without implicitly resuming. Mint a short-lived one-use runtime-bound ticket for the isolated viewer origin. The account shell passes only this ticket through a strict origin-checked handshake to the viewer, never its account cookie or workspace API key. Shared control grants no lifecycle, deletion, fork, reshare or CDP rights. Grid and fullscreen use this same authorization path; switching presentation alone does not duplicate runtime sessions.",
        "x-account": true,
        "security": [
          {
            "AccountSession": []
          },
          {
            "AccountAccess": []
          }
        ],
        "parameters": [
          {
            "name": "browserId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "generation",
            "in": "query",
            "description": "Wait up to 20 seconds for this already requested runtime generation. The request never starts or resumes the browser.",
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ViewerTicket"
                }
              }
            }
          },
          "default": {
            "description": "Structured error with HTTP 400/401/403/404/409/425/429/503 as applicable. HTTP 425 indicates the requested generation is still starting.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-implementation": "local"
      }
    },
    "/billing/status": {
      "get": {
        "operationId": "getBillingStatus",
        "summary": "Get plan, runtime, estimated overage and billing access",
        "description": "Only the workspace billing owner can modify billing. ",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Usage"
                }
              }
            }
          },
          "default": {
            "description": "Authentication, ownership, billing state, validation or Stripe configuration error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/billing/checkout": {
      "get": {
        "operationId": "checkoutDetails",
        "summary": "Get the billing email and latest pending checkout for the billing owner",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "email": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "email"
                    },
                    "plan": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "enum": [
                        "starter",
                        "basic",
                        "pro",
                        null
                      ]
                    },
                    "status": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "enum": [
                        "open",
                        "expired",
                        "complete",
                        null
                      ]
                    },
                    "interval": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/BillingInterval"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Authentication, ownership, billing state, validation or Stripe configuration error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "Returns the saved billing email or verified sign-in email and the latest pending Stripe Checkout."
      },
      "post": {
        "operationId": "createCheckout",
        "summary": "Start hosted Stripe Checkout for a new subscription",
        "description": "Only the workspace billing owner can modify billing. Checkout displays the monthly or yearly subscription amount due. Additional usage is billed separately each usage month.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string",
                      "format": "uri"
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Authentication, ownership, billing state, validation or Stripe configuration error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CheckoutRequest"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          }
        ]
      }
    },
    "/billing/checkout/selection": {
      "post": {
        "operationId": "recordCheckoutSelection",
        "summary": "Record a billing owner choosing a paid plan",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CheckoutSelectionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "recorded": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Authentication, ownership, billing state, validation or Stripe configuration error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "Records a deduplicated first-party checkout funnel event without sending account data to analytics providers."
      }
    },
    "/billing/checkout/cancel": {
      "post": {
        "operationId": "recordCheckoutCancel",
        "summary": "Record a return from a canceled hosted checkout",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CheckoutCancelRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "received": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Authentication, ownership, billing state, validation or Stripe configuration error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "Records an unpaid return when the attempt belongs to this workspace."
      }
    },
    "/billing/portal": {
      "post": {
        "operationId": "createBillingPortal",
        "summary": "Open payment methods and invoices",
        "description": "Only the workspace billing owner can modify billing. ",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string",
                      "format": "uri"
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Authentication, ownership, billing state, validation or Stripe configuration error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/billing/refresh": {
      "post": {
        "operationId": "refreshBilling",
        "summary": "Reconcile Stripe payment and subscription status",
        "description": "Only the workspace billing owner can modify billing. ",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Usage"
                }
              }
            }
          },
          "default": {
            "description": "Authentication, ownership, billing state, validation or Stripe configuration error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/billing/upgrade-preview": {
      "post": {
        "operationId": "previewUpgrade",
        "summary": "Preview a paid-plan upgrade; valid for five minutes",
        "description": "Only the workspace billing owner can modify billing. The target defaults to Pro and uses the existing subscription interval. Additional included seconds are for the current usage month.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpgradePreviewRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "amountDueCents": {
                      "type": "integer"
                    },
                    "currency": {
                      "type": "string"
                    },
                    "prorationDate": {
                      "type": "integer"
                    },
                    "additionalIncludedSeconds": {
                      "type": "integer"
                    },
                    "periodEndsAt": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Authentication, ownership, billing state, validation or Stripe configuration error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/billing/plan": {
      "post": {
        "operationId": "changePlan",
        "summary": "Upgrade after payment or schedule changes for renewal",
        "description": "Only the workspace billing owner can modify billing. Downgrades, cancellations and interval changes take effect at subscription renewal.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "enum": [
                        "updated",
                        "scheduled",
                        "payment_pending"
                      ]
                    },
                    "plan": {
                      "type": "string"
                    },
                    "effectiveAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "paymentUrl": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "interval": {
                      "$ref": "#/components/schemas/BillingInterval"
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Authentication, ownership, billing state, validation or Stripe configuration error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlanChangeRequest"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          }
        ]
      }
    },
    "/browsers/{browserId}/grants/{grantId}/secret": {
      "get": {
        "operationId": "revealGrantSecret",
        "summary": "Reveal a saved owner link",
        "description": "Owner-only action. Returns the decrypted URL and, for CDP grants, the short prompt for an agent. List endpoints never return the bearer secret. Grants created before encrypted secret storage may return 409 secret_unavailable.",
        "parameters": [
          {
            "name": "browserId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "grantId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Owner link URL and optional agent prompt",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "url"
                  ],
                  "properties": {
                    "url": {
                      "type": "string"
                    },
                    "prompt": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          },
          "409": {
            "description": "Secret unavailable or revoked"
          }
        },
        "x-cli": "cloudbrowser links reveal br_123 grant_123 --output url"
      }
    },
    "/browsers/{browserId}/network": {
      "get": {
        "operationId": "getBrowserNetwork",
        "summary": "Read browser network controls",
        "description": "Owner workspace only. Reads the effective browser network policy without resuming compute. Shared access does not grant policy access. Unknown upstream rules are reported as unverified.",
        "x-cli": "cloudbrowser network get BROWSER_ID",
        "parameters": [
          {
            "name": "browserId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Requested policy, last confirmed effective policy and application status.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NetworkState"
                }
              }
            }
          },
          "default": {
            "description": "Structured error; HTTP 400/401/403/404/409/429/503 as applicable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "updateBrowserNetwork",
        "summary": "Apply browser network controls",
        "description": "Owner workspace only. Requires Idempotency-Key; poll the returned operation until succeeded. Website connections can disconnect. Paused browsers stay paused. Resume, fork and further network changes wait for confirmation. Pause/delete can interrupt confirmation; resume enforces the requested policy before starting compute. Uncertain responses retry automatically; pending does not mean the requested policy is enforced.",
        "x-cli": "cloudbrowser network update BROWSER_ID --mode allow-list --domains example.com,*.example.org",
        "parameters": [
          {
            "name": "browserId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NetworkPolicy"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Policy change queued.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Operation"
                }
              }
            }
          },
          "default": {
            "description": "Structured error; HTTP 400/401/403/404/409/429/503 as applicable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "Bearer credential for REST. A scoped personal API token authorizes only the operations described at https://cloudbrowser.tv/docs/api-tokens. Existing CLI-issued workspace keys retain their permissions. Per-browser CDP and viewer credentials are separate."
      },
      "ViewerAccess": {
        "type": "apiKey",
        "in": "cookie",
        "name": "__Secure-cb_viewer_access",
        "description": "Viewer-origin HttpOnly cookie; actual name is session-suffixed (cb_access_{sessionId} or cb_refresh_{sessionId}). Exact Origin is required. Local HTTP only omits Secure."
      },
      "ViewerRefresh": {
        "type": "apiKey",
        "in": "cookie",
        "name": "__Secure-cb_viewer_refresh",
        "description": "Viewer-origin HttpOnly cookie; actual name is session-suffixed (cb_access_{sessionId} or cb_refresh_{sessionId}). Exact Origin is required. Local HTTP only omits Secure."
      },
      "AccountSession": {
        "type": "apiKey",
        "in": "cookie",
        "name": "__Host-cb_account",
        "description": "Signed-in account on cloudbrowser.tv; HttpOnly, Secure, host-only, SameSite=Lax; CSRF protection required. Not sent to viewer origin."
      },
      "AccountAccess": {
        "type": "http",
        "scheme": "bearer",
        "description": "User-account access token issued by human CLI login. Not a workspace API key, CDP token or viewer refresh token."
      }
    },
    "schemas": {
      "OpenPlaygroundUrl": {
        "type": "object",
        "required": ["url", "generation"],
        "additionalProperties": false,
        "properties": {
          "url": { "type": "string", "maxLength": 8192 },
          "generation": { "type": "integer", "minimum": 1 }
        }
      },
      "TemporaryShareCredential": {
        "type": "object",
        "required": [
          "shareToken"
        ],
        "additionalProperties": false,
        "properties": {
          "shareToken": {
            "type": "string"
          }
        }
      },
      "PlaygroundLinkChange": {
        "type": "object",
        "required": [
          "action"
        ],
        "additionalProperties": false,
        "properties": {
          "action": {
            "type": "string",
            "enum": [
              "create",
              "update",
              "revoke"
            ]
          },
          "permission": {
            "type": "string",
            "enum": [
              "view",
              "control"
            ],
            "default": "view"
          }
        }
      },
      "BrowserResourceRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "ids"
        ],
        "properties": {
          "ids": {
            "type": "array",
            "maxItems": 32,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          }
        }
      },
      "BrowserResourceResponse": {
        "type": "object",
        "required": [
          "samples"
        ],
        "properties": {
          "samples": {
            "type": "object",
            "additionalProperties": {
              "type": [
                "object",
                "null"
              ],
              "required": [
                "generation",
                "observedAt",
                "cpuPercent",
                "vcpu",
                "memoryBytes",
                "memoryLimitBytes"
              ],
              "properties": {
                "generation": {
                  "type": "integer"
                },
                "observedAt": {
                  "type": "integer",
                  "description": "Unix milliseconds"
                },
                "cpuPercent": {
                  "type": [
                    "number",
                    "null"
                  ],
                  "minimum": 0,
                  "maximum": 100
                },
                "vcpu": {
                  "type": "number"
                },
                "memoryBytes": {
                  "type": "integer",
                  "description": "Working set, excluding inactive file cache"
                },
                "memoryLimitBytes": {
                  "type": "integer"
                }
              }
            }
          }
        }
      },
      "Browser": {
        "type": "object",
        "required": [
          "id",
          "name",
          "status"
        ],
        "properties": {
          "id": {
            "type": "string",
            "example": "br_123"
          },
          "browserType": {
            "type": "string",
            "enum": ["chrome", "edge", "chromium", "brave"],
            "default": "chrome",
            "description": "Browser product. Defaults to Chrome when omitted on creation; inherited on fork. For new allocations, GET /me lists availableBrowserTypes."
          },
          "name": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "starting",
              "running",
              "pausing",
              "paused",
              "resuming",
              "restarting",
              "failed",
              "deleting"
            ]
          },
          "parentId": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "runtimeGeneration": {
            "type": "integer"
          },
          "pauseReason": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "user",
              "free_allowance_exhausted",
              "starter_allowance_exhausted",
              "payment_required",
              "concurrency_limit",
              "upstream",
              "created_paused",
              "idle",
              null
            ],
            "description": "Recorded reason for the most recent pause. Null for unknown historical reasons and shared viewers. Does not indicate whether resume is currently allowed."
          },
          "pausedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Time the pause completed. Null while pausing, for older records or shared viewers."
          },
          "autoPause": {
            "type": "boolean",
            "default": true,
            "description": "Automatically pause after 5 minutes without a live CDP or desktop connection, including Console previews. Disable for disconnected background tasks. Creating, resuming or re-enabling starts a fresh 5-minute window. Does not override billing limits."
          },
          "network": {
            "$ref": "#/components/schemas/NetworkState"
          }
        }
      },
      "CreateBrowser": {
        "type": "object",
        "required": [
          "name"
        ],
        "additionalProperties": false,
        "properties": {
          "browserType": {
            "type": "string",
            "enum": ["chrome", "edge", "chromium", "brave"],
            "default": "chrome",
            "description": "Browser product. Defaults to Chrome when omitted on creation; inherited on fork. For new allocations, GET /me lists availableBrowserTypes."
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 50
          },
          "autoPause": {
            "type": "boolean",
            "default": true,
            "description": "Automatically pause after 5 minutes without a live CDP or desktop connection, including Console previews. Disable for disconnected background tasks. Creating, resuming or re-enabling starts a fresh 5-minute window. Does not override billing limits."
          },
          "network": {
            "$ref": "#/components/schemas/NetworkPolicy",
            "description": "Applied at claim time before website access. Defaults to allow-all without blocked domains."
          }
        }
      },
      "ForkBrowser": {
        "type": "object",
        "required": [
          "name"
        ],
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 50
          },
          "startPaused": {
            "type": "boolean",
            "default": true,
            "description": "Paused forks do not reserve running capacity. They retain independent profile writes."
          },
          "autoPause": {
            "type": "boolean",
            "description": "Inherits the source browser setting when omitted."
          }
        }
      },
      "CreateGrant": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/CreateCdpGrant"
          },
          {
            "$ref": "#/components/schemas/CreateLiveViewGrant"
          }
        ],
        "discriminator": {
          "propertyName": "audience",
          "mapping": {
            "cdp": "#/components/schemas/CreateCdpGrant",
            "live-view": "#/components/schemas/CreateLiveViewGrant"
          }
        }
      },
      "Grant": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/CdpGrant"
          },
          {
            "$ref": "#/components/schemas/LiveViewGrant"
          }
        ]
      },
      "GrantIssue": {
        "oneOf": [
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "grant",
              "cdpUrl"
            ],
            "properties": {
              "grant": {
                "$ref": "#/components/schemas/CdpGrant"
              },
              "cdpUrl": {
                "type": "string",
                "description": "Secret returned only on issuance."
              }
            }
          },
          {
            "type": "object",
            "required": [
              "grant",
              "liveViewUrl"
            ],
            "properties": {
              "grant": {
                "$ref": "#/components/schemas/LiveViewGrant"
              },
              "liveViewUrl": {
                "type": "string",
                "description": "Public account-shell entry URL, returned only at issuance: https://cloudbrowser.tv/view/{grantId}#share=... (reusable) or #ticket=... (one-time invitation). Sign in and accept into your library, then open /browsers/{browserId} fullscreen in the same workspace. Viewer transport remains isolated at view.cloudbrowser.tv. Raw secrets never appear in listings."
              }
            }
          }
        ]
      },
      "Operation": {
        "type": "object",
        "required": [
          "id",
          "browserId",
          "status"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "browserId": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "running",
              "succeeded",
              "failed"
            ]
          },
          "error": {
            "$ref": "#/components/schemas/Error"
          },
          "kind": {
            "type": "string",
            "enum": [
              "create",
              "pause",
              "resume",
              "restart",
              "fork",
              "delete",
              "network"
            ]
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "code",
          "message",
          "requestId"
        ],
        "properties": {
          "code": {
            "type": "string",
            "examples": [
              "CONCURRENCY_LIMIT",
              "ALLOWANCE_EXHAUSTED",
              "BROWSER_NOT_RUNNING",
              "GRANT_EXPIRED",
              "GRANT_REVOKED",
              "RENEWAL_LIMIT",
              "CONFLICT"
            ]
          },
          "message": {
            "type": "string"
          },
          "requestId": {
            "type": "string"
          }
        }
      },
      "Usage": {
        "type": "object",
        "properties": {
          "plan": {
            "type": "string",
            "enum": [
              "free",
              "starter",
              "basic",
              "pro"
            ]
          },
          "includedSeconds": {
            "type": "integer"
          },
          "usedSeconds": {
            "type": "integer"
          },
          "runningBrowsers": {
            "type": "integer",
            "description": "Running or reserved slots, including pending or uncertain operations."
          },
          "activeBrowsers": {
            "type": "integer",
            "minimum": 0,
            "description": "Browsers currently running in this workspace."
          },
          "concurrencyLimit": {
            "type": "integer"
          },
          "periodStartsAt": {
            "type": "string",
            "format": "date-time"
          },
          "periodEndsAt": {
            "type": "string",
            "format": "date-time",
            "description": "End of the current monthly allowance and usage-invoice window."
          },
          "period": {
            "type": "string",
            "description": "UTC calendar month for Free or a subscription-aligned monthly usage period for paid plans."
          },
          "billingEnabled": {
            "type": "boolean"
          },
          "starterBillingEnabled": {
            "type": "boolean",
            "description": "Whether Stripe Checkout and plan changes to Starter are available."
          },
          "remainingSeconds": {
            "type": "integer",
            "minimum": 0
          },
          "estimatedOverageCents": {
            "type": "integer",
            "minimum": 0
          },
          "canManageBilling": {
            "type": "boolean"
          },
          "hasBillingAccount": {
            "type": "boolean"
          },
          "cancelAtPeriodEnd": {
            "type": "boolean",
            "description": "Cancellation at the end of the current subscription term."
          },
          "billingIssue": {
            "type": "boolean"
          },
          "pendingPlan": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "free",
              "starter",
              "basic",
              "pro",
              null
            ]
          },
          "subscriptionStatus": {
            "type": "string"
          },
          "billingMode": {
            "type": "string"
          },
          "computeBlock": {
            "type": [
              "object",
              "null"
            ],
            "description": "Current billing restriction on starting/resuming compute, independent of historical browser pause reasons. Starter and Free block compute when their included hours are exhausted. Basic and Pro allow billable overage. Concurrency admission is checked separately.",
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "free_allowance_exhausted",
                  "starter_allowance_exhausted",
                  "payment_required"
                ]
              },
              "message": {
                "type": "string"
              },
              "resetsAt": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              }
            }
          },
          "billingInterval": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/BillingInterval"
              },
              {
                "type": "null"
              }
            ]
          },
          "pendingBillingInterval": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/BillingInterval"
              },
              {
                "type": "null"
              }
            ]
          },
          "subscriptionPeriodEndsAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Renewal or cancellation date for the current monthly or annual subscription."
          },
          "annualBillingPlans": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "starter",
                "basic",
                "pro"
              ]
            }
          }
        }
      },
      "CreateCdpGrant": {
        "type": "object",
        "required": [
          "audience"
        ],
        "additionalProperties": false,
        "properties": {
          "audience": {
            "const": "cdp"
          },
          "permission": {
            "const": "control"
          },
          "name": {
            "type": "string",
            "maxLength": 80,
            "default": ""
          }
        }
      },
      "CreateLiveViewGrant": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "audience": {
            "const": "live-view"
          },
          "mode": {
            "const": "share",
            "default": "share",
            "description": "New links are reusable. Existing one-time invitations retain their original claim rules."
          },
          "permission": {
            "type": "string",
            "enum": [
              "view",
              "control"
            ],
            "default": "view",
            "description": "view is read-only: stream only, no mouse, keyboard, touch, clipboard writes, uploads, navigation commands or browser control. control allows browser interaction but no workspace, lifecycle or CDP administration. Enforced by the gateway, not just UI."
          },
          "name": {
            "type": "string",
            "maxLength": 80,
            "default": ""
          }
        },
        "required": [
          "audience"
        ]
      },
      "CdpGrant": {
        "type": "object",
        "required": [
          "id",
          "browserId",
          "audience",
          "permission",
          "expiresAt",
          "renewUntil",
          "autoRenew",
          "revoked"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "browserId": {
            "type": "string"
          },
          "audience": {
            "const": "cdp"
          },
          "permission": {
            "const": "control"
          },
          "expiresAt": {
            "type": [
              "string",
              "null"
            ],
            "description": "Null for permanent links. Legacy revoked links may retain their former deadline."
          },
          "renewUntil": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Legacy field, always null for permanent links."
          },
          "autoRenew": {
            "type": "boolean",
            "deprecated": true,
            "description": "Legacy field. No link renewal is needed; viewer credentials refresh internally."
          },
          "revoked": {
            "type": "boolean"
          },
          "name": {
            "type": "string"
          },
          "lastUsedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "visitors": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "accountId": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "avatarUrl": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "lastUsedAt": {
                  "type": "string",
                  "format": "date-time"
                },
                "online": {
                  "type": "boolean"
                }
              }
            }
          },
          "hasSecret": {
            "type": "boolean",
            "description": "Owner metadata: whether repeat-copy is available. The secret is never returned by list endpoints."
          }
        }
      },
      "LiveViewGrant": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string"
          },
          "browserId": {
            "type": "string"
          },
          "audience": {
            "const": "live-view"
          },
          "mode": {
            "type": "string",
            "enum": [
              "share",
              "one-time"
            ]
          },
          "permission": {
            "type": "string",
            "enum": [
              "view",
              "control"
            ],
            "default": "view",
            "description": "view is read-only: stream only, no mouse, keyboard, touch, clipboard writes, uploads, navigation commands or browser control. control allows browser interaction but no workspace, lifecycle or CDP administration. Enforced by the gateway, not just UI."
          },
          "expiresAt": {
            "type": [
              "string",
              "null"
            ],
            "description": "Null for permanent links. Legacy revoked links may retain their former deadline."
          },
          "ticketTtlSeconds": {
            "type": "integer"
          },
          "entryExpiresAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Direct one-time URL only; null for reusable shares."
          },
          "autoRenew": {
            "type": "boolean",
            "deprecated": true,
            "description": "Legacy field. No link renewal is needed; viewer credentials refresh internally."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "lastOpenedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "activeSessions": {
            "type": "integer",
            "minimum": 0,
            "description": "Current authorized viewer sessions, not connected socket count."
          },
          "revision": {
            "type": "integer",
            "minimum": 1
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "expired",
              "revoked",
              "used"
            ]
          },
          "revoked": {
            "type": "boolean"
          },
          "name": {
            "type": "string"
          },
          "lastUsedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "visitors": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "accountId": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "avatarUrl": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "lastUsedAt": {
                  "type": "string",
                  "format": "date-time"
                },
                "online": {
                  "type": "boolean"
                }
              }
            }
          },
          "hasSecret": {
            "type": "boolean",
            "description": "Owner metadata: whether repeat-copy is available. The secret is never returned by list endpoints."
          }
        },
        "required": [
          "id",
          "browserId",
          "audience",
          "mode",
          "permission",
          "expiresAt",
          "ticketTtlSeconds",
          "entryExpiresAt",
          "autoRenew",
          "createdAt",
          "lastOpenedAt",
          "activeSessions",
          "revision",
          "status",
          "revoked"
        ]
      },
      "ViewerSession": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "grantId",
          "browserId",
          "permission",
          "autoRenew",
          "accessExpiresAt",
          "idleExpiresAt",
          "ended",
          "authorizationExpiresAt",
          "accountId"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "grantId": {
            "type": "string"
          },
          "browserId": {
            "type": "string"
          },
          "permission": {
            "type": "string",
            "enum": [
              "view",
              "control"
            ],
            "default": "view",
            "description": "view is read-only: stream only, no mouse, keyboard, touch, clipboard writes, uploads, navigation commands or browser control. control allows browser interaction but no workspace, lifecycle or CDP administration. Enforced by the gateway, not just UI."
          },
          "autoRenew": {
            "type": "boolean"
          },
          "accessExpiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "idleExpiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "ended": {
            "type": "boolean"
          },
          "authorizationExpiresAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "default": null,
            "description": "Absolute link authorization deadline, measured from issuance/update; null means no expiration. Applies to new visits AND all existing sessions. Automatic refresh never moves this deadline."
          },
          "accountId": {
            "type": "string",
            "description": "Recipient account binding; never infer identity from browserId alone."
          }
        }
      },
      "ExchangeViewerTicket": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "ticket"
        ],
        "properties": {
          "ticket": {
            "type": "string",
            "description": "Single-use opaque secret from the URL fragment. Never log it."
          }
        }
      },
      "UpdateLiveViewGrant": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "permission": {
            "type": "string",
            "enum": [
              "view",
              "control"
            ],
            "default": "view",
            "description": "view is read-only: stream only, no mouse, keyboard, touch, clipboard writes, uploads, navigation commands or browser control. control allows browser interaction but no workspace, lifecycle or CDP administration. Enforced by the gateway, not just UI."
          },
          "name": {
            "type": "string",
            "maxLength": 80
          }
        },
        "required": [],
        "minProperties": 1,
        "description": "Share-mode Live View only. At least one property required. Every effective policy change invalidates all old sessions and tickets immediately and increments revision. The same reusable URL can then open a fresh session. Revoked grants cannot be revived. An expired share may be extended by its owner, but previous sessions stay ended."
      },
      "ViewerTicket": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "ticket": {
            "type": "string",
            "description": "One-time secret minted after account/library authorization, bound to recipient account, browser, grant revision, permission and runtime. Return only on ticket issuance."
          },
          "ticketExpiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "url": {
            "type": "string",
            "description": "Isolated viewer URL carrying a single-use ticket in its fragment. The viewer clears the fragment before exchange."
          }
        },
        "required": [
          "ticket",
          "ticketExpiresAt",
          "url"
        ]
      },
      "BrowserLibraryEntry": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "example": "br_123"
          },
          "name": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "starting",
              "running",
              "pausing",
              "paused",
              "resuming",
              "restarting",
              "failed",
              "deleting",
              "unavailable"
            ]
          },
          "parentId": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "runtimeGeneration": {
            "type": "integer"
          },
          "owner": {
            "type": "boolean"
          },
          "permission": {
            "type": "string",
            "enum": [
              "view",
              "control"
            ]
          },
          "ownerName": {
            "type": "string"
          },
          "shared": {
            "type": "boolean",
            "description": "Owned browser has at least one currently active sharing grant."
          },
          "ownerAvatarUrl": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri"
          },
          "pauseReason": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "user",
              "free_allowance_exhausted",
              "starter_allowance_exhausted",
              "payment_required",
              "concurrency_limit",
              "upstream",
              "created_paused",
              null
            ],
            "description": "Recorded reason for the most recent pause. Null for unknown historical reasons and shared viewers. Does not indicate whether resume is currently allowed."
          },
          "pausedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Time the pause completed. Null while pausing, for older records or shared viewers."
          }
        },
        "required": [
          "id",
          "name",
          "status",
          "owner",
          "permission",
          "runtimeGeneration"
        ]
      },
      "AcceptSharedBrowser": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "linkId": {
            "type": "string"
          },
          "shareToken": {
            "type": "string"
          },
          "ticket": {
            "type": "string"
          }
        },
        "required": [
          "linkId"
        ],
        "oneOf": [
          {
            "required": [
              "shareToken"
            ],
            "not": {
              "required": [
                "ticket"
              ]
            }
          },
          {
            "required": [
              "ticket"
            ],
            "not": {
              "required": [
                "shareToken"
              ]
            }
          }
        ],
        "description": "Account authorization plus one invitation credential. Token read from URL fragment and removed immediately. Store a server-side pending authorization handle bound to the login transaction when redirecting to sign-in; never put the bearer secret in OAuth state, returnTo, query strings, analytics or localStorage."
      },
      "ViewerSessionReceipt": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "sessionId",
          "autoRenew",
          "permission",
          "expiresAt"
        ],
        "properties": {
          "sessionId": {
            "type": "string"
          },
          "autoRenew": {
            "type": "boolean"
          },
          "permission": {
            "type": "string",
            "enum": [
              "view",
              "control"
            ]
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "CheckoutSelectionRequest": {
        "type": "object",
        "properties": {
          "plan": {
            "type": "string",
            "enum": [
              "starter",
              "basic",
              "pro"
            ]
          },
          "entry": {
            "type": "string",
            "enum": [
              "pricing",
              "countdown",
              "usage"
            ]
          },
          "flow": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "plan",
          "entry",
          "flow"
        ],
        "additionalProperties": false
      },
      "CheckoutCancelRequest": {
        "type": "object",
        "properties": {
          "flow": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          }
        },
        "required": [
          "flow"
        ],
        "additionalProperties": false
      },
      "CheckoutRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "plan"
        ],
        "properties": {
          "plan": {
            "type": "string",
            "enum": [
              "starter",
              "basic",
              "pro"
            ]
          },
          "email": {
            "type": "string",
            "format": "email",
            "maxLength": 254,
            "description": "Billing email selected by the workspace owner."
          },
          "entry": {
            "type": "string",
            "enum": [
              "pricing",
              "countdown",
              "usage"
            ]
          },
          "flow": {
            "type": "string",
            "format": "uuid"
          },
          "interval": {
            "$ref": "#/components/schemas/BillingInterval",
            "default": "month"
          }
        }
      },
      "UpgradePreviewRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "plan": {
            "type": "string",
            "enum": ["basic", "pro"],
            "default": "pro"
          }
        }
      },
      "PlanChangeRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "plan"
        ],
        "properties": {
          "plan": {
            "type": "string",
            "enum": [
              "free",
              "starter",
              "basic",
              "pro"
            ]
          },
          "prorationDate": {
            "type": "integer",
            "description": "Required when upgrading within the current billing interval. Use the value from upgrade-preview."
          },
          "interval": {
            "$ref": "#/components/schemas/BillingInterval",
            "description": "Defaults to the current interval. A change of interval starts at renewal."
          }
        }
      },
      "UpdateBrowserSettings": {
        "type": "object",
        "required": [
          "autoPause"
        ],
        "additionalProperties": false,
        "properties": {
          "autoPause": {
            "type": "boolean",
            "default": true,
            "description": "Automatically pause after 5 minutes without a live CDP or desktop connection, including Console previews. Disable for disconnected background tasks. Creating, resuming or re-enabling starts a fresh 5-minute window. Does not override billing limits."
          }
        }
      },
      "NetworkPolicy": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "mode"
        ],
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "allow-all",
              "allow-list",
              "block-all"
            ],
            "description": "allow-all permits websites except listed domains; allow-list blocks other websites; block-all blocks website network access. Management connections remain available."
          },
          "domains": {
            "type": "array",
            "maxItems": 100,
            "default": [],
            "items": {
              "type": "string",
              "maxLength": 1024
            },
            "description": "Connection hostnames or *.example.com (apex and all subdomains). HTTP/2 may reuse an allowed connection for another compatible hostname. This does not guarantee a per-URL host allowlist. No URLs, IPs, paths or ports. Nonempty for allow-list; empty for block-all."
          }
        }
      },
      "NetworkState": {
        "type": "object",
        "required": [
          "policy",
          "appliedPolicy",
          "status",
          "error",
          "verifiedAt"
        ],
        "properties": {
          "policy": {
            "$ref": "#/components/schemas/NetworkPolicy"
          },
          "appliedPolicy": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/NetworkPolicy"
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "unverified",
              "applying",
              "applied",
              "failed"
            ]
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "verifiedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "BillingInterval": {
        "type": "string",
        "enum": [
          "month",
          "year"
        ]
      }
    }
  }
}
