{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/weavz-io/json-schema/weavz-io-connect-session-schema.json",
  "title": "ConnectSession",
  "x-generated": "2026-11-28",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/weavz-io-openapi.json#/components/schemas/ConnectSession",
  "type": "object",
  "required": [
    "id",
    "integrationName",
    "connectionName",
    "externalId",
    "status",
    "connectionId",
    "error",
    "expiresAt",
    "createdAt"
  ],
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "integrationName": {
      "type": "string",
      "description": "Integration being connected"
    },
    "workspaceIntegrationId": {
      "anyOf": [
        {
          "type": "string",
          "format": "uuid"
        },
        {
          "type": "null"
        }
      ],
      "description": "Configured workspace integration whose auth selection this session inherits."
    },
    "authMethodKey": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "Selected integration auth method key for this hosted connect session."
    },
    "oauthAppMode": {
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "weavz_managed",
            "custom"
          ]
        },
        {
          "type": "null"
        }
      ],
      "description": "OAuth app policy used when the selected auth method is OAuth."
    },
    "oauthAppId": {
      "anyOf": [
        {
          "type": "string",
          "format": "uuid"
        },
        {
          "type": "null"
        }
      ],
      "description": "Resolved OAuth app UUID used by this session when OAuth is selected. This may be a Weavz-managed platform app or a tenant-owned custom app."
    },
    "connectionName": {
      "type": "string",
      "description": "Display name for the connection"
    },
    "externalId": {
      "type": "string",
      "description": "Customer-defined connection.externalId selector"
    },
    "status": {
      "type": "string",
      "enum": [
        "PENDING",
        "CONNECTING",
        "COMPLETED",
        "FAILED"
      ],
      "description": "Current session status"
    },
    "connectionId": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid",
      "description": "ID of the created connection (set when COMPLETED)"
    },
    "error": {
      "type": [
        "string",
        "null"
      ],
      "description": "Error message (set when FAILED)"
    },
    "expiresAt": {
      "type": "string",
      "format": "date-time"
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    }
  }
}