{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/cm-com/main/json-schema/cm-com-create-otp-push-schema.json",
  "title": "Create OTP (Push)",
  "x-generated": "2026-10-13",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/cm-com-verification-otp-v2-openapi.yml#/components/schemas/CreateOtpPush",
  "type": "object",
  "allOf": [
    {
      "$ref": "#/$defs/CreateOtpMessage"
    }
  ],
  "properties": {
    "channel": {
      "enum": [
        "push"
      ]
    },
    "pushAppKey": {
      "type": "string",
      "description": "The app key.",
      "format": "uuid"
    }
  },
  "required": [
    "pushAppKey"
  ],
  "$defs": {
    "CreateOtpBase": {
      "type": "object",
      "properties": {
        "channel": {
          "type": "string",
          "description": "The channel to send the code."
        },
        "digits": {
          "type": "integer",
          "description": "The length of the code.",
          "minimum": 4,
          "maximum": 10,
          "default": 5
        },
        "expiry": {
          "type": "integer",
          "description": "The expiry of the code in seconds.",
          "minimum": 10,
          "maximum": 3600,
          "default": 60
        }
      },
      "required": [
        "channel"
      ]
    },
    "CreateOtpMessage": {
      "type": "object",
      "allOf": [
        {
          "$ref": "#/$defs/CreateOtpBase"
        }
      ],
      "properties": {
        "from": {
          "type": "string",
          "description": "The number or name of the sender. This must be a valid phone number in E.164 format or an alphanumeric string between 3 and 11 characters. Please note that alphanumeric senders are not supported in all countries."
        },
        "to": {
          "type": "string",
          "description": "The receiver of the code. This must be a valid phone number in E.164 format."
        },
        "message": {
          "type": "string",
          "description": "Set a custom message. You can use the placeholder {code}, this will be replaced by the actual code.",
          "maxLength": 160
        }
      },
      "required": [
        "from",
        "to"
      ]
    }
  }
}