{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/wasync-app/json-schema/wasync-app-connection-detail-response-schema.json",
  "title": "ConnectionDetailResponse",
  "description": "Canonical keys are camelCase. Deprecated snake_case aliases (`phone`, `license_status`, `license_expires`) remain present for backward compatibility.",
  "x-generated": "2026-11-28",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/wasync-app-openapi.json#/components/schemas/ConnectionDetailResponse",
  "type": "object",
  "required": [
    "connection"
  ],
  "properties": {
    "connection": {
      "type": "object",
      "required": [
        "id",
        "status"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "status": {
          "type": "string",
          "description": "Session status, e.g. `connecting` / `connected` / `disconnected`."
        },
        "phoneNumber": {
          "type": [
            "string",
            "null"
          ],
          "description": "The connection's own WhatsApp number (intl digits, no `+`). Null until paired. Canonical camelCase key."
        },
        "label": {
          "type": [
            "string",
            "null"
          ],
          "description": "Human-readable label."
        },
        "provider": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "qr",
            "cloud_api"
          ],
          "description": "WhatsApp transport: `qr` (WAPP/QR, no Meta account needed) or `cloud_api` (WABA, official Cloud API)."
        },
        "licenseStatus": {
          "type": [
            "string",
            "null"
          ],
          "description": "WASync license status, e.g. `trial` / `active` / `expired`. Canonical camelCase key."
        },
        "licenseExpires": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time",
          "description": "ISO 8601 expiry timestamp of the WASync license. Canonical camelCase key."
        },
        "qr": {
          "type": [
            "string",
            "null"
          ],
          "description": "Data-URI PNG of the current QR code. Non-null (and refreshing) while `status` is `\"connecting\"`; null once connected."
        },
        "reason": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "number_already_connected",
            null
          ],
          "description": "Why this connection is not paired, when WASync refused it. `number_already_connected` = the scan was refused because the same WhatsApp number already belongs to another connection of this workspace (connected or not); this connection stays `disconnected` with no number — reconnect the existing connection instead, or delete that one and pair the number again. `null` otherwise. Treat values you do not know like `null`."
        },
        "phone": {
          "type": [
            "string",
            "null"
          ],
          "description": "Deprecated alias of `phoneNumber`. Same value; still returned for backward compatibility."
        },
        "license_status": {
          "type": [
            "string",
            "null"
          ],
          "description": "Deprecated alias of `licenseStatus`. Same value; still returned for backward compatibility."
        },
        "license_expires": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time",
          "description": "Deprecated alias of `licenseExpires`. Same value; still returned for backward compatibility."
        }
      }
    }
  }
}