{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/flowra-dev/json-schema/flowra-dev-create-connected-account-dto-schema.json",
  "title": "CreateConnectedAccountDto",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/flowra-dev-connected-accounts-api-openapi.yml#/components/schemas/CreateConnectedAccountDto",
  "type": "object",
  "properties": {
    "authConfig": {
      "$ref": "#/$defs/CreateConnectedAccountAuthConfigDto"
    },
    "connection": {
      "$ref": "#/$defs/CreateConnectedAccountConnectionDto"
    },
    "validateCredentials": {
      "type": "boolean",
      "description": "Validate credentials flag",
      "default": false
    },
    "connectedAccountId": {
      "type": "string",
      "description": "Internal Flowra connected account id"
    },
    "consentLinkToken": {
      "type": "string",
      "description": "Consent link token (`oauth:consent:v1:*`). Used after the user returns from `/connect/:token`."
    }
  },
  "required": [
    "authConfig",
    "connection"
  ],
  "$defs": {
    "CreateConnectedAccountAuthConfigDto": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "Auth config ID"
        }
      },
      "required": [
        "id"
      ]
    },
    "CreateConnectedAccountConnectionDto": {
      "type": "object",
      "properties": {
        "state": {
          "$ref": "#/$defs/CreateConnectedAccountConnectionStateDto"
        },
        "eUID": {
          "type": "string",
          "description": "User ID"
        },
        "callbackUrl": {
          "type": "string",
          "description": "Callback URL"
        }
      },
      "required": [
        "state",
        "eUID"
      ]
    },
    "CreateConnectedAccountConnectionStateDto": {
      "type": "object",
      "properties": {
        "authScheme": {
          "enum": [
            "OAUTH1",
            "OAUTH2",
            "S2S_OAUTH2",
            "API_KEY",
            "BASIC",
            "BEARER_TOKEN",
            "BILLCOM_AUTH",
            "GOOGLE_SERVICE_ACCOUNT",
            "NO_AUTH",
            "BASIC_WITH_JWT",
            "CALCOM_AUTH",
            "SERVICE_ACCOUNT",
            "SAML",
            "DCR_OAUTH",
            "COOKIE",
            "WHATSAPP_QR"
          ],
          "type": "string",
          "description": "Authentication scheme"
        },
        "val": {
          "type": "object",
          "description": "State value - connection/credentials data (Composio); structure depends on auth scheme and toolkit",
          "additionalProperties": true
        }
      },
      "required": [
        "authScheme",
        "val"
      ]
    }
  }
}