{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/usestring-ai/json-schema/usestring-ai-browser-session-schema.json",
  "title": "BrowserSession",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/usestring-ai-sessions-api-openapi.yml#/components/schemas/BrowserSession",
  "type": "object",
  "required": [
    "id",
    "status",
    "contextId",
    "persist",
    "proxy",
    "record",
    "frameCount",
    "attempts",
    "closeCode",
    "closeReason",
    "createdAt",
    "startedAt",
    "endedAt"
  ],
  "properties": {
    "id": {
      "type": "string",
      "pattern": "^ses_[0-9a-f]{32}$"
    },
    "status": {
      "type": "string",
      "enum": [
        "pending",
        "connecting",
        "running",
        "ended",
        "failed",
        "expired"
      ],
      "description": "`expired` is a created session that was never connected within its ten minutes."
    },
    "connectUrl": {
      "type": "string",
      "description": "Present while `pending`: the `/wss` URL that connects this session, once. Send the API key as the `Authorization` header."
    },
    "connectBy": {
      "type": "string",
      "format": "date-time",
      "description": "Present while `pending`: the session expires unconnected after this."
    },
    "contextId": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid"
    },
    "persist": {
      "type": [
        "boolean",
        "null"
      ]
    },
    "proxy": {
      "type": "object",
      "required": [
        "tier",
        "countryCode",
        "provider",
        "zone"
      ],
      "properties": {
        "tier": {
          "type": "string",
          "enum": [
            "standard",
            "premium"
          ]
        },
        "countryCode": {
          "type": [
            "string",
            "null"
          ]
        },
        "provider": {
          "type": [
            "string",
            "null"
          ],
          "description": "The exit provider the session was routed through, once it connected."
        },
        "zone": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "record": {
      "type": "boolean",
      "description": "Whether a screencast replay is recorded."
    },
    "frameCount": {
      "type": "integer",
      "description": "Replay frames stored so far."
    },
    "attempts": {
      "type": "integer",
      "description": "Browser launches it took to connect; capacity retries add one each."
    },
    "closeCode": {
      "type": [
        "integer",
        "null"
      ]
    },
    "closeReason": {
      "type": [
        "string",
        "null"
      ]
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "startedAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "endedAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    }
  }
}