{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/weavz-io/json-schema/weavz-io-workspace-integration-schema.json",
  "title": "WorkspaceIntegration",
  "x-generated": "2026-11-28",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/weavz-io-openapi.json#/components/schemas/WorkspaceIntegration",
  "type": "object",
  "required": [
    "id",
    "workspaceId",
    "integrationName",
    "alias",
    "connectionStrategy",
    "connectionId",
    "displayName",
    "enabledActions",
    "settings",
    "sortOrder",
    "createdAt",
    "updatedAt"
  ],
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "workspaceId": {
      "type": "string",
      "format": "uuid"
    },
    "integrationName": {
      "type": "string",
      "description": "Catalog app slug, such as `slack`."
    },
    "alias": {
      "type": "string",
      "description": "Configured workspace integration alias agents use as the Code Mode namespace and Tool Mode tool prefix, such as `office_slack`."
    },
    "connectionStrategy": {
      "type": "string",
      "enum": [
        "fixed",
        "per_user",
        "per_user_with_fallback"
      ]
    },
    "authMethodKey": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "Selected auth method for this configured integration instance. Required on create when the catalog integration exposes multiple auth options."
    },
    "oauthAppMode": {
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "weavz_managed",
            "custom"
          ]
        },
        {
          "type": "null"
        }
      ],
      "description": "OAuth app policy used when `authMethodKey` selects an OAuth method. Defaults to `weavz_managed`."
    },
    "oauthAppId": {
      "anyOf": [
        {
          "type": "string",
          "format": "uuid"
        },
        {
          "type": "null"
        }
      ],
      "description": "Tenant-owned custom OAuth app UUID when `oauthAppMode` is `custom`; null for Weavz-managed OAuth."
    },
    "connectionId": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid"
    },
    "displayName": {
      "type": [
        "string",
        "null"
      ]
    },
    "enabledActions": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": "string"
      }
    },
    "settings": {
      "$ref": "#/$defs/WorkspaceIntegrationSettings"
    },
    "sortOrder": {
      "type": "integer"
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time"
    },
    "connectionExternalId": {
      "type": [
        "string",
        "null"
      ],
      "description": "Customer-defined external ID of the fixed connection, when available in list responses."
    },
    "connectionDisplayName": {
      "type": [
        "string",
        "null"
      ]
    },
    "connectionStatus": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "ACTIVE",
        "ERROR",
        "EXPIRED",
        null
      ]
    }
  },
  "$defs": {
    "AdvancedCodeWorkspaceSettings": {
      "type": "object",
      "description": "Owner-controlled Sandbox execution policy for the advanced-code workspace integration.",
      "properties": {
        "timeoutSeconds": {
          "type": "integer",
          "minimum": 1,
          "maximum": 300,
          "default": 300,
          "description": "Maximum execution time per Sandbox run."
        },
        "sandboxPersistence": {
          "type": "string",
          "enum": [
            "ephemeral",
            "persistent"
          ],
          "default": "ephemeral",
          "description": "Whether the sandbox is destroyed after each run or reused between runs."
        },
        "storageMountScope": {
          "type": "string",
          "enum": [
            "none",
            "end_user",
            "workspace",
            "external"
          ],
          "default": "none",
          "description": "Filesystem namespace mounted into the Sandbox."
        },
        "storageExternalId": {
          "type": "string",
          "description": "Required when storageMountScope is external."
        }
      }
    },
    "LocalBrowserWorkspaceSettings": {
      "type": "object",
      "description": "Owner-controlled runtime policy for the Local Browser for Agents workspace integration.",
      "properties": {
        "runtime": {
          "type": "string",
          "enum": [
            "chrome_extension",
            "managed_profile"
          ],
          "default": "chrome_extension"
        }
      }
    },
    "PersistenceWorkspaceSettings": {
      "type": "object",
      "description": "Owner-controlled state and session-profile scope for stateful workspace integrations.",
      "properties": {
        "scope": {
          "type": "string",
          "enum": [
            "end_user",
            "workspace",
            "external"
          ],
          "default": "end_user",
          "description": "Persistent state namespace used by Filesystem, State KV, Agent Memory, Agent Scratchpad, Sequential Thinking, Agent Browser, Agent Browser (Stealth), Agent Browser AI, Agent Browser (Stealth AI), and Local Browser for Agents. Browser integrations use this scope for durable browser profiles and live session reuse."
        },
        "externalId": {
          "type": "string",
          "description": "Required when scope is external."
        }
      }
    },
    "WorkspaceIntegrationSettings": {
      "type": "object",
      "properties": {
        "advancedCode": {
          "$ref": "#/$defs/AdvancedCodeWorkspaceSettings"
        },
        "persistence": {
          "$ref": "#/$defs/PersistenceWorkspaceSettings"
        },
        "localBrowser": {
          "$ref": "#/$defs/LocalBrowserWorkspaceSettings"
        }
      }
    }
  }
}