{
  "openapi": "3.1.0",
  "info": {
    "title": "AlphaSMS JSON API",
    "version": "1.0.0",
    "description": "Machine-readable contract for the AlphaSMS JSON API.\n\nEvery request is a POST with `Content-Type: application/json` and the same envelope: `auth` carries the API key, `data` carries one or more operation objects. The operation is chosen by `data[].type`.\n\nThis document covers the JSON transport only, and within it only the publicly documented operations. XML, HTTP and SOAP transports are described in the documentation pages, not here.",
    "contact": {
      "url": "https://docs.alphasms.net/"
    }
  },
  "servers": [
    {
      "url": "https://alphasms.net",
      "description": "Synchronous API"
    }
  ],
  "tags": [
    {
      "name": "JSON API",
      "description": "Single-endpoint JSON transport"
    }
  ],
  "paths": {
    "/api/json.php": {
      "post": {
        "operationId": "jsonApiSync",
        "summary": "Send a synchronous JSON API request",
        "description": "One endpoint for every operation. The operation is selected by `data[].type`. Several operations may be sent in one request — `data` is an array. The response returns `msg_id` per message immediately.",
        "tags": [
          "JSON API"
        ],
        "security": [
          {
            "ApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Request"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Always 200, including on failure. Check `success` at the top level, then `success` inside each `data[]` item.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          }
        }
      }
    }
  },
  "webhooks": {
    "messageStatus": {
      "post": {
        "operationId": "messageStatusWebhook",
        "summary": "Delivery status callback",
        "security": [],
        "description": "Sent to the URL given in the `hook` field of a send operation, once the message reaches a final state.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StatusWebhook"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Acknowledged."
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "auth",
        "description": "The API key is NOT sent as a header. It is the `auth` field of the request body. This scheme is declared so tools show the key as a credential; put the value into `auth`."
      }
    },
    "schemas": {
      "Request": {
        "type": "object",
        "required": [
          "auth",
          "data"
        ],
        "properties": {
          "auth": {
            "type": "string",
            "description": "API key from the personal cabinet.",
            "example": "bb56a4369eb19***cfec6d1776bd25"
          },
          "data": {
            "type": "array",
            "minItems": 1,
            "description": "One or more operation objects.",
            "items": {
              "$ref": "#/components/schemas/Operation"
            }
          }
        }
      },
      "Operation": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/OpBalance"
          },
          {
            "$ref": "#/components/schemas/OpCallOtp"
          },
          {
            "$ref": "#/components/schemas/OpHlr"
          },
          {
            "$ref": "#/components/schemas/OpPipeline"
          },
          {
            "$ref": "#/components/schemas/OpRcs"
          },
          {
            "$ref": "#/components/schemas/OpRcsSms"
          },
          {
            "$ref": "#/components/schemas/OpRcsViberSms"
          },
          {
            "$ref": "#/components/schemas/OpSender"
          },
          {
            "$ref": "#/components/schemas/OpSms"
          },
          {
            "$ref": "#/components/schemas/OpStatus"
          },
          {
            "$ref": "#/components/schemas/OpTelegram"
          },
          {
            "$ref": "#/components/schemas/OpTemplateCreate"
          },
          {
            "$ref": "#/components/schemas/OpTemplateDelete"
          },
          {
            "$ref": "#/components/schemas/OpTemplateList"
          },
          {
            "$ref": "#/components/schemas/OpTemplateViberCreate"
          },
          {
            "$ref": "#/components/schemas/OpTemplateViberDelete"
          },
          {
            "$ref": "#/components/schemas/OpTemplateViberList"
          },
          {
            "$ref": "#/components/schemas/OpViber"
          },
          {
            "$ref": "#/components/schemas/OpViberSms"
          },
          {
            "$ref": "#/components/schemas/OpVoice"
          }
        ],
        "discriminator": {
          "propertyName": "type",
          "mapping": {
            "balance": "#/components/schemas/OpBalance",
            "call/otp": "#/components/schemas/OpCallOtp",
            "hlr": "#/components/schemas/OpHlr",
            "pipeline": "#/components/schemas/OpPipeline",
            "rcs": "#/components/schemas/OpRcs",
            "rcs+sms": "#/components/schemas/OpRcsSms",
            "rcs+viber+sms": "#/components/schemas/OpRcsViberSms",
            "sender": "#/components/schemas/OpSender",
            "sms": "#/components/schemas/OpSms",
            "status": "#/components/schemas/OpStatus",
            "telegram": "#/components/schemas/OpTelegram",
            "template/create": "#/components/schemas/OpTemplateCreate",
            "template/delete": "#/components/schemas/OpTemplateDelete",
            "template/list": "#/components/schemas/OpTemplateList",
            "template/viber/create": "#/components/schemas/OpTemplateViberCreate",
            "template/viber/delete": "#/components/schemas/OpTemplateViberDelete",
            "template/viber/list": "#/components/schemas/OpTemplateViberList",
            "viber": "#/components/schemas/OpViber",
            "viber+sms": "#/components/schemas/OpViberSms",
            "voice": "#/components/schemas/OpVoice"
          }
        }
      },
      "Response": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "description": "Whether the envelope itself was accepted. Note: this is a boolean, even though some documentation tables call it an integer."
          },
          "error": {
            "type": "string",
            "description": "Present when the envelope was rejected, e.g. `Access denied`."
          },
          "data": {
            "type": "array",
            "description": "One result per operation sent, in the same order.",
            "items": {
              "$ref": "#/components/schemas/ResponseItem"
            }
          }
        }
      },
      "ResponseItem": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "description": "Result of this single operation."
          },
          "error": {
            "type": "string",
            "description": "Present when this operation failed."
          },
          "data": {
            "type": "object",
            "description": "Operation payload. Shape depends on the operation type.",
            "additionalProperties": true,
            "properties": {
              "id": {
                "type": [
                  "string",
                  "number"
                ],
                "description": "Your own message identifier."
              },
              "msg_id": {
                "type": [
                  "string",
                  "number"
                ],
                "description": "Identifier assigned by the gateway."
              },
              "parts": {
                "type": "number",
                "description": "Number of message parts billed."
              }
            }
          }
        }
      },
      "AsyncResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "request_id": {
            "type": "string",
            "description": "Identifier of the queued request; repeated in the webhook.",
            "example": "cf-ray-1234567890-ABC"
          }
        }
      },
      "StatusWebhook": {
        "type": "object",
        "required": [
          "success"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "Your own message identifier."
          },
          "msg_id": {
            "type": "string",
            "description": "Identifier assigned by the gateway."
          },
          "type": {
            "type": "string",
            "enum": [
              "sms",
              "viber",
              "voice",
              "rcs"
            ]
          },
          "status": {
            "type": "string",
            "description": "Message status."
          },
          "success": {
            "type": "boolean",
            "description": "True when the message was delivered or read."
          },
          "error": {
            "type": "string",
            "description": "Reason the message was rejected."
          },
          "updated": {
            "type": "string",
            "format": "date-time"
          },
          "reply": {
            "type": "string",
            "description": "Digit entered by the recipient (DTMF)."
          },
          "duration": {
            "type": "number",
            "description": "Call duration in seconds."
          },
          "request_id": {
            "type": "string",
            "description": "Matches the async response."
          },
          "replies": {
            "type": "array",
            "description": "Replies to the message.",
            "items": {
              "type": "object",
              "properties": {
                "datetime": {
                  "type": "string",
                  "format": "date-time"
                },
                "message": {
                  "type": "string"
                },
                "media": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "filename": {
                      "type": "string"
                    },
                    "filesize": {
                      "type": "number"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "OpBalance": {
        "type": "object",
        "title": "Get the current balance of the user's account",
        "description": "Documented at docs/api/json/balance.md",
        "properties": {
          "type": {
            "description": "Request type",
            "enum": [
              "balance"
            ],
            "example": "balance",
            "type": "string"
          }
        },
        "required": [
          "type"
        ],
        "additionalProperties": true
      },
      "OpCallOtp": {
        "type": "object",
        "title": "Voice OTP: places a call to the subscriber from a number whose last 4 digits are the one-time code; returns the code and the fee.",
        "description": "Documented at docs/api/json/voice/otp.md",
        "properties": {
          "type": {
            "description": "Request type",
            "enum": [
              "call/otp"
            ],
            "example": "call/otp",
            "type": "string"
          },
          "id": {
            "description": "Unique message identifier in the client system",
            "example": 100500,
            "type": "number"
          },
          "phone": {
            "description": "Phone number to be checked",
            "example": 380971234567,
            "type": "number"
          }
        },
        "required": [
          "id",
          "phone",
          "type"
        ],
        "additionalProperties": true
      },
      "OpHlr": {
        "type": "object",
        "title": "HLR lookup: check number validity and get operator/porting details without notifying the subscriber",
        "description": "Documented at docs/api/json/hlr.md",
        "properties": {
          "type": {
            "description": "Request type",
            "enum": [
              "hlr"
            ],
            "example": "hlr",
            "type": "string"
          },
          "id": {
            "description": "Unique message identifier in the client system",
            "example": 100500,
            "type": "number"
          },
          "phone": {
            "description": "Phone number of the recipient of the message",
            "example": 380971234567,
            "type": "number"
          }
        },
        "required": [
          "id",
          "phone",
          "type"
        ],
        "additionalProperties": true
      },
      "OpPipeline": {
        "type": "object",
        "title": "Multi-channel delivery: one request, several channels tried in the order given in `pipeline` (voice, telegram, viber, rcs, sms, whatsapp). Telegram only for OTP, voice recommended only for OTP; SMS/Viber for OTP and transactional. WhatsApp exists ONLY as a pipeline stage — `type: \"whatsapp\"` is rejected with `Invalid message type`.",
        "description": "Documented at docs/api/json/multi_channel.md, docs/api/json/whatsapp/otp.md",
        "properties": {
          "type": {
            "description": "Request type. For WhatsApp it is always `pipeline`",
            "enum": [
              "pipeline"
            ],
            "example": "pipeline",
            "type": "string"
          },
          "hook": {
            "description": "URL address of the script where the message delivery status will be sent. whatsapp/otp.md warns: the gateway does not store `hook` for type `pipeline` — the status goes to the notification address from API settings; on the async API `hook` still receives a refusal webhook with status REJECTED",
            "example": "https://example.org/webhook/url.php",
            "type": "string"
          },
          "id": {
            "description": "Unique message identifier in the client system — REQUIREDNESS CONFLICT: marked required in multi_channel.md, NOT marked required in whatsapp/otp.md",
            "example": 100500,
            "type": "number"
          },
          "phone": {
            "description": "Phone number of the recipient of the messages. Digits only, without `+` (whatsapp/otp.md)",
            "example": 380971234567,
            "type": "number"
          },
          "pipeline": {
            "description": "Sequence of use of communication channels / channels in the order they are tried; values may not repeat",
            "type": "array"
          },
          "rcs": {
            "description": "NOT IN THE PARAMETERS TABLE — present only in the multi_channel.md request example as {\"signature\": \"SenderID\", \"message\": \"Your code is 1234\"}, with \"rcs\" listed in the pipeline array. No documented requiredness, no documented sub-field table",
            "type": "object"
          },
          "sms": {
            "description": "SMS message parameters",
            "properties": {
              "message": {
                "description": "Message text to be sent via SMS",
                "example": "Your code is 100500",
                "type": "string"
              },
              "signature": {
                "description": "Signature in the message",
                "example": "SenderID",
                "type": "string"
              }
            },
            "required": [
              "message",
              "signature"
            ],
            "type": "object"
          },
          "telegram": {
            "description": "Telegram message parameters",
            "properties": {
              "message": {
                "description": "Message text to be sent via Telegram",
                "example": "100500",
                "type": "string"
              }
            },
            "required": [
              "message"
            ],
            "type": "object"
          },
          "viber": {
            "description": "Viber message parameters",
            "properties": {
              "message": {
                "description": "Message text to be sent via Viber",
                "example": "Your code is 100500",
                "type": "string"
              },
              "signature": {
                "description": "Signature in the message",
                "example": "SenderID",
                "type": "string"
              },
              "type": {
                "description": "Viber message type",
                "example": "text",
                "type": "string"
              }
            },
            "required": [
              "message",
              "signature",
              "type"
            ],
            "type": "object"
          },
          "voice": {
            "description": "Voice message options",
            "properties": {
              "gender": {
                "description": "Voice type (male or female)",
                "enum": [
                  "male",
                  "female"
                ],
                "example": "female",
                "type": "string"
              },
              "language": {
                "description": "Voice language",
                "example": "en-GB",
                "type": "string"
              },
              "name": {
                "description": "Language model name",
                "example": "en-GB-Standard-A",
                "type": "string"
              }
            },
            "required": [
              "gender",
              "language",
              "name"
            ],
            "type": "object"
          },
          "whatsapp": {
            "description": "WhatsApp message parameters (multi_channel.md) / Parameters of the WhatsApp stage (whatsapp/otp.md)",
            "properties": {
              "message": {
                "description": "Message text to be sent via WhatsApp (multi_channel.md) / Message with one-time password (whatsapp/otp.md). Not validated by the API",
                "example": "Your code is 1234",
                "type": "string"
              },
              "signature": {
                "description": "Signature in the message (multi_channel.md) / Registered sender name (whatsapp/otp.md). Not validated by the API: if missing, the request is still accepted and charged",
                "example": "SenderID",
                "type": "string"
              }
            },
            "required": [
              "message",
              "signature"
            ],
            "type": "object"
          }
        },
        "required": [
          "id",
          "phone",
          "pipeline",
          "sms",
          "telegram",
          "type",
          "viber",
          "voice",
          "whatsapp"
        ],
        "additionalProperties": true
      },
      "OpRcs": {
        "type": "object",
        "title": "Send an RCS message with text, image and a button leading to the given link.",
        "description": "Documented at docs/api/json/rcs/send.md",
        "properties": {
          "type": {
            "description": "Request type",
            "enum": [
              "rcs"
            ],
            "example": "rcs",
            "type": "string"
          },
          "hook": {
            "description": "URL address of the script where the message delivery status will be sent",
            "example": "https://example.org/webhook/url.php",
            "type": "string"
          },
          "id": {
            "description": "Unique message identifier in the client system",
            "example": 100500,
            "type": "number"
          },
          "phone": {
            "description": "Phone number of the recipient of the message",
            "example": 380971234567,
            "type": "number"
          },
          "rcs_button": {
            "description": "Caption to be displayed on the button",
            "example": "Button caption",
            "type": "string"
          },
          "rcs_image": {
            "description": "Link to the image to be sent in the message",
            "example": "https://url.com/storage/images/image.png",
            "type": "string"
          },
          "rcs_lifetime": {
            "description": "RCS message lifetime in seconds. Minimum value: 60 seconds. Default: 2 days (172800 seconds)",
            "example": 172800,
            "type": "number"
          },
          "rcs_link": {
            "description": "Link that will be followed after pressing the button",
            "example": "https://redirect.url",
            "type": "string"
          },
          "rcs_message": {
            "description": "Message text to be sent via SMS (verbatim from the table — copy-paste artefact; the example calls it \"Message text to be sent via RCS\")",
            "example": "Message text to be sent via RCS",
            "type": "string"
          },
          "rcs_signature": {
            "description": "Signature in the message",
            "example": "RCSTest",
            "type": "string"
          },
          "short_link": {
            "description": "Shorter and track links (according to the tariff)",
            "example": true,
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "phone",
          "rcs_button",
          "rcs_image",
          "rcs_link",
          "rcs_message",
          "rcs_signature",
          "type"
        ],
        "additionalProperties": true
      },
      "OpRcsSms": {
        "type": "object",
        "title": "Send an RCS message (text, image, button) with automatic resending by SMS if RCS delivery fails.",
        "description": "Documented at docs/api/json/rcs/resending_sms.md",
        "properties": {
          "type": {
            "description": "Request type",
            "enum": [
              "rcs+sms"
            ],
            "example": "rcs+sms",
            "type": "string"
          },
          "hook": {
            "description": "URL address of the script where the message delivery status will be sent",
            "example": "https://example.org/webhook/url.php",
            "type": "string"
          },
          "id": {
            "description": "Unique message identifier in the client system",
            "example": 100500,
            "type": "number"
          },
          "phone": {
            "description": "Phone number of the recipient of the message",
            "example": 380971234567,
            "type": "number"
          },
          "rcs_button": {
            "description": "Caption to be displayed on the button",
            "example": "Button caption",
            "type": "string"
          },
          "rcs_image": {
            "description": "Link to the image to be sent in the message",
            "example": "https://url.com/storage/images/image.png",
            "type": "string"
          },
          "rcs_lifetime": {
            "description": "RCS message lifetime in seconds. Minimum value: 60 seconds. Default: 2 days (172800 seconds)",
            "example": 172800,
            "type": "number"
          },
          "rcs_link": {
            "description": "Link that will be followed after pressing the button",
            "example": "https://redirect.url",
            "type": "string"
          },
          "rcs_message": {
            "description": "Message text to be sent via SMS (verbatim from the table — copy-paste artefact; the example calls it \"Message text to be sent via RCS\")",
            "example": "Message text to be sent via RCS",
            "type": "string"
          },
          "rcs_signature": {
            "description": "Signature in the message",
            "example": "RCSTest",
            "type": "string"
          },
          "short_link": {
            "description": "Shorter and track links (according to the tariff)",
            "example": true,
            "type": "boolean"
          },
          "sms_message": {
            "description": "Message text to be sent via SMS",
            "example": "Message text to be sent via SMS",
            "type": "string"
          },
          "sms_signature": {
            "description": "Signature in the message",
            "example": "SMSTest",
            "type": "string"
          }
        },
        "required": [
          "id",
          "phone",
          "rcs_button",
          "rcs_image",
          "rcs_link",
          "rcs_message",
          "rcs_signature",
          "sms_message",
          "sms_signature",
          "type"
        ],
        "additionalProperties": true
      },
      "OpRcsViberSms": {
        "type": "object",
        "title": "Send an RCS message (text, image, button) with fallback resending by Viber and then SMS if delivery fails.",
        "description": "Documented at docs/api/json/rcs/resending_viber.md",
        "properties": {
          "type": {
            "description": "Request type",
            "enum": [
              "rcs+viber+sms"
            ],
            "example": "rcs+viber+sms",
            "type": "string"
          },
          "hook": {
            "description": "URL address of the script where the message delivery status will be sent",
            "example": "https://example.org/webhook/url.php",
            "type": "string"
          },
          "id": {
            "description": "Unique message identifier in the client system",
            "example": 100500,
            "type": "number"
          },
          "phone": {
            "description": "Phone number of the recipient of the message",
            "example": 380971234567,
            "type": "number"
          },
          "rcs_button": {
            "description": "Caption to be displayed on the button",
            "example": "Button caption",
            "type": "string"
          },
          "rcs_image": {
            "description": "Link to the image to be sent in the message",
            "example": "https://url.com/storage/images/image.png",
            "type": "string"
          },
          "rcs_lifetime": {
            "description": "RCS message lifetime in seconds. Minimum value: 60 seconds. Default: 2 days (172800 seconds)",
            "example": 172800,
            "type": "number"
          },
          "rcs_link": {
            "description": "Link that will be followed after pressing the button",
            "example": "https://redirect.url",
            "type": "string"
          },
          "rcs_message": {
            "description": "Message text to be sent via SMS (verbatim from the table — copy-paste artefact; the example calls it \"Message text to be sent via RCS\")",
            "example": "Message text to be sent via RCS",
            "type": "string"
          },
          "rcs_signature": {
            "description": "Signature in the message",
            "example": "RCSTest",
            "type": "string"
          },
          "short_link": {
            "description": "Shorter and track links (according to the tariff)",
            "example": true,
            "type": "boolean"
          },
          "sms_message": {
            "description": "Message text to be sent via SMS",
            "example": "Message text to be sent via SMS",
            "type": "string"
          },
          "sms_signature": {
            "description": "Signature in the message",
            "example": "SMSTest",
            "type": "string"
          },
          "viber_button": {
            "description": "Caption to be displayed on the button",
            "example": "Button caption",
            "type": "string"
          },
          "viber_image": {
            "description": "Link to the image to be sent in the message",
            "example": "https://url.com/storage/images/image.png",
            "type": "string"
          },
          "viber_link": {
            "description": "Link that will be followed after pressing the button",
            "example": "https://redirect.url",
            "type": "string"
          },
          "viber_message": {
            "description": "Message text to be sent via Viber",
            "example": "Message text to send via Viber",
            "type": "string"
          },
          "viber_signature": {
            "description": "Signature in the message",
            "example": "ViberTest",
            "type": "string"
          },
          "viber_type": {
            "description": "Viber message type",
            "example": "text+image+link",
            "type": "string"
          }
        },
        "required": [
          "id",
          "phone",
          "rcs_button",
          "rcs_image",
          "rcs_link",
          "rcs_message",
          "rcs_signature",
          "sms_message",
          "sms_signature",
          "type",
          "viber_signature",
          "viber_type"
        ],
        "additionalProperties": true,
        "oneOf": [
          {
            "title": "rcs+viber+sms — viber_type: carousel",
            "properties": {
              "viber_type": {
                "const": "carousel"
              }
            },
            "required": [
              "viber_carousel",
              "viber_message",
              "viber_type"
            ]
          },
          {
            "title": "rcs+viber+sms — viber_type: image",
            "properties": {
              "viber_type": {
                "const": "image"
              }
            },
            "required": [
              "viber_image",
              "viber_type"
            ]
          },
          {
            "title": "rcs+viber+sms — viber_type: text",
            "properties": {
              "viber_type": {
                "const": "text"
              }
            },
            "required": [
              "viber_message",
              "viber_type"
            ]
          },
          {
            "title": "rcs+viber+sms — viber_type: text+image+link",
            "properties": {
              "viber_type": {
                "const": "text+image+link"
              }
            },
            "required": [
              "viber_button",
              "viber_image",
              "viber_link",
              "viber_message",
              "viber_type"
            ]
          },
          {
            "title": "rcs+viber+sms — viber_type: text+link",
            "properties": {
              "viber_type": {
                "const": "text+link"
              }
            },
            "required": [
              "viber_button",
              "viber_link",
              "viber_message",
              "viber_type"
            ]
          }
        ]
      },
      "OpSender": {
        "type": "object",
        "title": "Get the list of senders (alpha-names) available for sending messages",
        "description": "Documented at docs/api/json/sender.md",
        "properties": {
          "type": {
            "description": "Request type",
            "enum": [
              "sender"
            ],
            "example": "sender",
            "type": "string"
          }
        },
        "required": [
          "type"
        ],
        "additionalProperties": true
      },
      "OpSms": {
        "type": "object",
        "title": "Send an SMS message to a phone number",
        "description": "Documented at docs/api/json/send_sms.md",
        "properties": {
          "type": {
            "description": "Request type",
            "enum": [
              "sms"
            ],
            "example": "sms",
            "type": "string"
          },
          "hook": {
            "description": "URL address of the script where the message delivery status will be sent",
            "example": "https://example.org/webhook/url.php",
            "type": "string"
          },
          "id": {
            "description": "Unique message identifier in the client system",
            "example": 100500,
            "type": "number"
          },
          "phone": {
            "description": "Phone number of the recipient of the message",
            "example": 380971234567,
            "type": "number"
          },
          "short_link": {
            "description": "Shorter and track links (according to the tariff)",
            "example": true,
            "type": "boolean"
          },
          "sms_lifetime": {
            "description": "SMS message lifetime in seconds; min. value 1 hour (3600 seconds), max. value 3 days (259200 seconds), default 2 days (172800 seconds)",
            "example": 172800,
            "type": "number"
          },
          "sms_message": {
            "description": "Message text to be sent via SMS",
            "example": "Message text to be sent via SMS",
            "type": "string"
          },
          "sms_signature": {
            "description": "Signature in the message",
            "example": "SMSTest",
            "type": "string"
          },
          "unsubscribe_link": {
            "description": "Customers can unsubscribe by clicking the link (according to the tariff)",
            "example": true,
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "phone",
          "sms_message",
          "sms_signature",
          "type"
        ],
        "additionalProperties": true
      },
      "OpStatus": {
        "type": "object",
        "title": "Get the current status of a previously sent message",
        "description": "Documented at docs/api/json/message_status.md",
        "properties": {
          "type": {
            "description": "Request type",
            "enum": [
              "status"
            ],
            "example": "status",
            "type": "string"
          },
          "id": {
            "description": "Unique message identifier in the client system",
            "example": 100500,
            "type": "number"
          }
        },
        "required": [
          "id",
          "type"
        ],
        "additionalProperties": true
      },
      "OpTelegram": {
        "type": "object",
        "title": "Send a one-time password (OTP) via Telegram.",
        "description": "Documented at docs/api/json/telegram/otp.md",
        "properties": {
          "type": {
            "description": "Request type",
            "enum": [
              "telegram"
            ],
            "example": "telegram",
            "type": "string"
          },
          "hook": {
            "description": "URL address of the script where the message delivery status will be sent",
            "example": "https://example.org/webhook/url.php",
            "type": "string"
          },
          "id": {
            "description": "Unique message identifier in the client system",
            "example": 100500,
            "type": "number"
          },
          "message": {
            "description": "Message with one-time password. Contains from 4 to 8 digits",
            "example": "123456",
            "type": "string"
          },
          "phone": {
            "description": "Phone number of the recipient of the message",
            "example": 380971234567,
            "type": "number"
          },
          "telegram_lifetime": {
            "description": "Telegram message lifetime in seconds. Minimum value: 60 seconds. Default: 2 days (172800 seconds)",
            "example": 172800,
            "type": "number"
          }
        },
        "required": [
          "id",
          "message",
          "phone",
          "type"
        ],
        "additionalProperties": true
      },
      "OpTemplateCreate": {
        "type": "object",
        "title": "Creates a new SMS message template and returns its id, text, name and character/parts count.",
        "description": "Documented at docs/api/json/template/create.md",
        "properties": {
          "type": {
            "description": "Request type",
            "enum": [
              "template/create"
            ],
            "example": "template/create",
            "type": "string"
          },
          "name": {
            "description": "Template name",
            "example": "First",
            "type": "string"
          },
          "template": {
            "description": "Template text",
            "example": "New template text",
            "type": "string"
          }
        },
        "required": [
          "template",
          "type"
        ],
        "additionalProperties": true
      },
      "OpTemplateDelete": {
        "type": "object",
        "title": "Deletes SMS template(s) by identifier and/or by exact template text; returns the number of deleted templates.",
        "description": "Documented at docs/api/json/template/delete.md",
        "properties": {
          "type": {
            "description": "Request type",
            "enum": [
              "template/delete"
            ],
            "example": "template/delete",
            "type": "string"
          },
          "id": {
            "description": "Message Template identifier",
            "example": "1",
            "type": "string"
          },
          "template": {
            "description": "Message Template Text",
            "example": "Template text",
            "type": "string"
          }
        },
        "required": [
          "type"
        ],
        "additionalProperties": true
      },
      "OpTemplateList": {
        "type": "object",
        "title": "Returns the list of the client's SMS templates with id, name, text, character/parts count and creation timestamp.",
        "description": "Documented at docs/api/json/template/list.md",
        "properties": {
          "type": {
            "description": "Request type",
            "enum": [
              "template/list"
            ],
            "example": "template/list",
            "type": "string"
          }
        },
        "required": [
          "type"
        ],
        "additionalProperties": true
      },
      "OpTemplateViberCreate": {
        "type": "object",
        "title": "Creates a new Viber message template (text plus sender signature) and returns its id and moderation status.",
        "description": "Documented at docs/api/json/template/viber/create.md",
        "properties": {
          "type": {
            "description": "Request type",
            "enum": [
              "template/viber/create"
            ],
            "example": "template/viber/create",
            "type": "string"
          },
          "signature": {
            "description": "Signature in the message",
            "example": "ViberTest",
            "type": "string"
          },
          "template": {
            "description": "Request type (verbatim from the docs — evidently a copy-paste error; the field carries the template text)",
            "example": "New template text",
            "type": "string"
          }
        },
        "required": [
          "template",
          "type"
        ],
        "additionalProperties": true
      },
      "OpTemplateViberDelete": {
        "type": "object",
        "title": "Deletes Viber template(s) by identifier and/or by exact template text; returns the number of deleted templates.",
        "description": "Documented at docs/api/json/template/viber/delete.md",
        "properties": {
          "type": {
            "description": "Request type",
            "enum": [
              "template/viber/delete"
            ],
            "example": "template/viber/delete",
            "type": "string"
          },
          "id": {
            "description": "Message Template identifier",
            "example": 1,
            "type": "integer"
          },
          "template": {
            "description": "Request type (verbatim from the docs — evidently a copy-paste error; the field carries the template text)",
            "example": "Template text",
            "type": "string"
          }
        },
        "required": [
          "type"
        ],
        "additionalProperties": true
      },
      "OpTemplateViberList": {
        "type": "object",
        "title": "Returns the list of the client's Viber templates with id, text, signature and moderation status.",
        "description": "Documented at docs/api/json/template/viber/list.md",
        "properties": {
          "type": {
            "description": "Request type",
            "enum": [
              "template/viber/list"
            ],
            "example": "template/viber/list",
            "type": "string"
          }
        },
        "required": [
          "type"
        ],
        "additionalProperties": true
      },
      "OpViber": {
        "type": "object",
        "title": "Отправка Viber-сообщения. Одна операция data[].type=\"viber\", пять разновидностей задаются полем viber_type: text, image, text+link, text+image+link, carousel — каждой посвящена своя страница доки; набор viber_*-полей и их обязательность зависят от viber_type.",
        "description": "Documented at docs/api/json/viber/text.md, docs/api/json/viber/image.md, docs/api/json/viber/text_link.md, docs/api/json/viber/text_link_image.md, docs/api/json/viber/carousel.md",
        "properties": {
          "type": {
            "description": "Request type",
            "enum": [
              "viber"
            ],
            "example": "viber",
            "type": "string"
          },
          "hook": {
            "description": "URL address of the script where the message delivery status will be sent",
            "example": "https://example.org/webhook/url.php",
            "type": "string"
          },
          "id": {
            "description": "Unique message identifier in the client system",
            "example": 100500,
            "type": "number"
          },
          "phone": {
            "description": "Phone number of the recipient of the message",
            "example": 380971234567,
            "type": "number"
          },
          "short_link": {
            "description": "Shorter and track links (according to the tariff)",
            "example": true,
            "type": "boolean"
          },
          "viber_button": {
            "description": "Caption to be displayed on the button — в таблице помечено required на страницах viber_type=text+link и text+image+link; на остальных страницах поля нет",
            "example": "Button caption",
            "type": "string"
          },
          "viber_carousel": {
            "description": "List of objects with parameters for carousel slides (2-5 slides) — в таблице помечено required только на странице viber_type=carousel; на остальных страницах поля нет",
            "items": {
              "properties": {
                "button": {
                  "description": "Caption to be displayed on the slide button",
                  "example": "Button caption",
                  "type": "string"
                },
                "button2": {
                  "description": "Caption to be displayed on the slide additional button",
                  "type": "string"
                },
                "caption": {
                  "description": "Carousel slide caption to be sent via Viber",
                  "example": "Title 1",
                  "type": "string"
                },
                "image": {
                  "description": "Link to the image to be sent in the message",
                  "example": "https://url.com/storage/images/image1.png",
                  "type": "string"
                },
                "url": {
                  "description": "Link that will be followed after pressing the slide button",
                  "example": "https://example.org",
                  "type": "string"
                },
                "url2": {
                  "description": "Link that will be followed after pressing the slide additional button",
                  "type": "string"
                }
              },
              "required": [
                "button",
                "caption",
                "image",
                "url"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "viber_image": {
            "description": "Link to the image to be sent in the message — в таблице помечено required на страницах viber_type=image и text+image+link; на остальных страницах поля нет",
            "example": "https://url.com/storage/images/image.png",
            "type": "string"
          },
          "viber_lifetime": {
            "description": "Viber message lifetime in seconds. Min. value: 60 seconds. Default: 1 day (86400 seconds)",
            "example": 86400,
            "type": "number"
          },
          "viber_link": {
            "description": "Link that will be followed after pressing the button — в таблице помечено required на страницах viber_type=text+link и text+image+link; на остальных страницах поля нет",
            "example": "https://redirect.url",
            "type": "string"
          },
          "viber_message": {
            "description": "Message text to be sent via Viber — в таблице помечено required на страницах viber_type=text, text+link, text+image+link, carousel; на странице viber_type=image поля нет вовсе",
            "example": "Message text to send via Viber",
            "type": "string"
          },
          "viber_signature": {
            "description": "Signature in the message",
            "example": "ViberTest",
            "type": "string"
          },
          "viber_type": {
            "description": "Viber message type",
            "enum": [
              "text",
              "image",
              "text+link",
              "text+image+link",
              "carousel"
            ],
            "example": "text",
            "type": "string"
          }
        },
        "required": [
          "id",
          "phone",
          "type",
          "viber_signature",
          "viber_type"
        ],
        "additionalProperties": true,
        "oneOf": [
          {
            "title": "viber — viber_type: carousel",
            "properties": {
              "viber_type": {
                "const": "carousel"
              }
            },
            "required": [
              "viber_carousel",
              "viber_message",
              "viber_type"
            ]
          },
          {
            "title": "viber — viber_type: image",
            "properties": {
              "viber_type": {
                "const": "image"
              }
            },
            "required": [
              "viber_image",
              "viber_type"
            ]
          },
          {
            "title": "viber — viber_type: text",
            "properties": {
              "viber_type": {
                "const": "text"
              }
            },
            "required": [
              "viber_message",
              "viber_type"
            ]
          },
          {
            "title": "viber — viber_type: text+image+link",
            "properties": {
              "viber_type": {
                "const": "text+image+link"
              }
            },
            "required": [
              "viber_button",
              "viber_image",
              "viber_link",
              "viber_message",
              "viber_type"
            ]
          },
          {
            "title": "viber — viber_type: text+link",
            "properties": {
              "viber_type": {
                "const": "text+link"
              }
            },
            "required": [
              "viber_button",
              "viber_link",
              "viber_message",
              "viber_type"
            ]
          }
        ]
      },
      "OpViberSms": {
        "type": "object",
        "title": "Отправка Viber-сообщения с автоматической переотправкой по SMS, если Viber не доставлен. Один объект data[] несёт и viber_*-, и sms_*-поля.",
        "description": "Documented at docs/api/json/viber/resending_sms.md",
        "properties": {
          "type": {
            "description": "Request type",
            "enum": [
              "viber+sms"
            ],
            "example": "viber+sms",
            "type": "string"
          },
          "hook": {
            "description": "URL address of the script where the message delivery status will be sent",
            "example": "https://example.org/webhook/url.php",
            "type": "string"
          },
          "id": {
            "description": "Unique message identifier in the client system",
            "example": 100500,
            "type": "number"
          },
          "phone": {
            "description": "Phone number of the recipient of the message",
            "example": 380971234567,
            "type": "number"
          },
          "short_link": {
            "description": "Shorter and track links (according to the tariff)",
            "example": true,
            "type": "boolean"
          },
          "sms_message": {
            "description": "Message text to be sent via SMS",
            "example": "Message text to be sent via SMS",
            "type": "string"
          },
          "sms_signature": {
            "description": "Signature in the message",
            "example": "SMSTest",
            "type": "string"
          },
          "viber_button": {
            "description": "Caption to be displayed on the button",
            "example": "Button caption",
            "type": "string"
          },
          "viber_image": {
            "description": "Link to the image to be sent in the message",
            "example": "https://url.com/storage/images/image.png",
            "type": "string"
          },
          "viber_lifetime": {
            "description": "Viber message lifetime in seconds. Min. value: 60 seconds. Default: 1 day (86400 seconds)",
            "example": 86400,
            "type": "number"
          },
          "viber_link": {
            "description": "Link that will be followed after pressing the button",
            "example": "https://redirect.url",
            "type": "string"
          },
          "viber_message": {
            "description": "Message text to be sent via Viber",
            "example": "Message text to send via Viber",
            "type": "string"
          },
          "viber_signature": {
            "description": "Signature in the message",
            "example": "ViberTest",
            "type": "string"
          },
          "viber_type": {
            "description": "Viber message type",
            "enum": [
              "text+image+link"
            ],
            "example": "text+image+link",
            "type": "string"
          }
        },
        "required": [
          "id",
          "phone",
          "sms_message",
          "sms_signature",
          "type",
          "viber_signature",
          "viber_type"
        ],
        "additionalProperties": true,
        "oneOf": [
          {
            "title": "viber+sms — viber_type: carousel",
            "properties": {
              "viber_type": {
                "const": "carousel"
              }
            },
            "required": [
              "viber_carousel",
              "viber_message",
              "viber_type"
            ]
          },
          {
            "title": "viber+sms — viber_type: image",
            "properties": {
              "viber_type": {
                "const": "image"
              }
            },
            "required": [
              "viber_image",
              "viber_type"
            ]
          },
          {
            "title": "viber+sms — viber_type: text",
            "properties": {
              "viber_type": {
                "const": "text"
              }
            },
            "required": [
              "viber_message",
              "viber_type"
            ]
          },
          {
            "title": "viber+sms — viber_type: text+image+link",
            "properties": {
              "viber_type": {
                "const": "text+image+link"
              }
            },
            "required": [
              "viber_button",
              "viber_image",
              "viber_link",
              "viber_message",
              "viber_type"
            ]
          },
          {
            "title": "viber+sms — viber_type: text+link",
            "properties": {
              "viber_type": {
                "const": "text+link"
              }
            },
            "required": [
              "viber_button",
              "viber_link",
              "viber_message",
              "viber_type"
            ]
          }
        ]
      },
      "OpVoice": {
        "type": "object",
        "title": "Voice call: text-to-speech a message to a phone number, with voice model selection and optional DTMF tone collection.",
        "description": "Documented at docs/api/json/voice/call.md",
        "properties": {
          "type": {
            "description": "Request type",
            "enum": [
              "voice"
            ],
            "example": "voice",
            "type": "string"
          },
          "dtmf": {
            "description": "Tone set (DTMF) usage flag",
            "example": false,
            "type": "boolean"
          },
          "id": {
            "description": "Unique message identifier in the client system",
            "example": 100500,
            "type": "number"
          },
          "message": {
            "description": "The text of the message to be voiced",
            "example": "Your code is 100500",
            "type": "string"
          },
          "phone": {
            "description": "Phone number to be checked",
            "example": 380971234567,
            "type": "number"
          },
          "voice": {
            "description": "Voice parameters",
            "properties": {
              "gender": {
                "description": "Voice type (male or female)",
                "enum": [
                  "male",
                  "female"
                ],
                "example": "female",
                "type": "string"
              },
              "language": {
                "description": "Voice language",
                "example": "en-GB",
                "type": "string"
              },
              "name": {
                "description": "Language model name",
                "example": "en-GB-Standard-A",
                "type": "string"
              }
            },
            "required": [
              "gender",
              "language",
              "name"
            ],
            "type": "object"
          }
        },
        "required": [
          "dtmf",
          "id",
          "message",
          "phone",
          "type",
          "voice"
        ],
        "additionalProperties": true
      }
    }
  }
}
