openapi: 3.0.0
info:
  title: Websms
  description: Inofficial OpenAPI Schema for websms.ch
  license:
    name: Copyrighted
    url: https://developer.websms.com/rest-api
  version: dev
servers:
  - url: https://api.websms.com/json/
paths:
  /smsmessaging/binary:
    post:
      tags:
        - sms
      summary: Send binary message
      description: Sends a binary message to a list of recipients
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BinarySmsSendRequest'
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SmsSendResponse'
        '401':
          description: Unauthorized
      callbacks:
        receive:
          '{$request.body#/notificationCallbackUrl}':
            post:
              requestBody:
                required: true
                content:
                  application/json:
                    schema:
                      $ref: '#/components/schemas/ReceiveSmsRequest'
              responses:
                '200':
                  description: Ok
                  content:
                    application/json:
                      schema:
                        $ref: '#/components/schemas/ReceiveSmsResponse'
  /smsmessaging/simple:
    get:
      tags:
        - sms
      summary: Send text message
      description: Sends a text message to a list of recipients with a simple GET request
      parameters:
        - in: query
          name: clientMessageId
          description: May contain a freely definable message id
          schema:
            type: string
        - in: query
          name: contentCategory
          description: 'The content category that is used to categorize the message (used for blacklisting). The following content categories are supported: informational or advertisement. If no content category is provided, the default setting is used (may be changed inside the onlinesms web interface).'
          schema:
            $ref: '#/components/schemas/ContentCategory'
        - in: query
          name: maxSmsPerMessage
          description: 'Specifies the maximum number of SMS to be generated. If the system generates more than this number of SMS, the status code 4026 is returned. The default value is 0.If set to 0, no limitation is applied.'
          schema:
            type: integer
            minimum: 0
        - in: query
          name: messageContent
          description: 'Latin1 URL-encoded message content'
          required: true
          schema:
            type: string
        - in: query
          name: messageType
          description: Specifies the message type.
          schema:
            $ref: '#/components/schemas/MessageType'
        - in: query
          name: notificationCallbackUrl
          description: When setting a notificationCallbackUrl all delivery reports are forwarded to this URL.
          schema:
            type: string
            format: uri
        - in: query
          name: priority
          description: Priority of the message. Must not exceed the value configured for the account used to send the message. For more information please contact our customer service.
          schema:
            type: integer
        - in: query
          name: recipientAddressList
          description: List of recipients to whom the message should be sent.
          required: true
          schema:
            type: array
            minItems: 1
            maxItems: 1000
            items:
              $ref: '#/components/schemas/E164'
        - in: query
          name: sendAsFlashSms
          description: 'true: The message is sent as flash SMS (displayed directly on the screen of the mobile phone). false (default): The message is sent as standard text SMS'
          schema:
            type: boolean
        - in: query
          name: senderAddress
          description: 'Address of the sender (assigned to the account) from which the message is sent.'
          schema:
            $ref: '#/components/schemas/E164'
        - in: query
          name: senderAddressType
          description: 'The sender address type.'
          schema:
            $ref: '#/components/schemas/AddressType'
        - in: query
          name: test
          description: '`true`: The transmission is only simulated, no SMS is sent. Depending on the number of recipients the status code 2000 or 2001 is returned. `false` (default): No simulation is done. The SMS is sent via the SMS Gateway.'
          schema:
            type: boolean
        - in: query
          name: validityPeriode
          description: 'Specifies the validity periode (in seconds) in which the message is tried to be delivered to the recipient. A minimum of 1 minute and a maximum of 3 days are allowed.'
          schema:
            type: integer
            minimum: 60
            maximum: 259200
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SmsSendResponse'
        '401':
          description: Unauthorized
      callbacks:
        receive:
          '{$request.parameters#/notificationCallbackUrl}':
            post:
              requestBody:
                required: true
                content:
                  application/json:
                    schema:
                      $ref: '#/components/schemas/ReceiveSmsRequest'
              responses:
                '200':
                  description: Ok
                  content:
                    application/json:
                      schema:
                        $ref: '#/components/schemas/ReceiveSmsResponse'
    post:
      tags:
        - sms
      summary: Send binary message
      description: Sends a text message to a list of recipients with a simple POST request
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/SimpleSmsSendRequest'
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SmsSendResponse'
        '401':
          description: Unauthorized
      callbacks:
        receive:
          '{$request.body#/notificationCallbackUrl}':
            post:
              requestBody:
                required: true
                content:
                  application/json:
                    schema:
                      $ref: '#/components/schemas/ReceiveSmsRequest'
              responses:
                '200':
                  description: Ok
                  content:
                    application/json:
                      schema:
                        $ref: '#/components/schemas/ReceiveSmsResponse'
  /smsmessaging/text:
    post:
      tags:
        - sms
      summary: Send text message
      description: Sends a text message to a list of recipients
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TextSmsSendRequest'
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SmsSendResponse'
        '401':
          description: Unauthorized
      callbacks:
        receive:
          '{$request.body#/notificationCallbackUrl}':
            post:
              requestBody:
                required: true
                content:
                  application/json:
                    schema:
                      $ref: '#/components/schemas/ReceiveSmsRequest'
              responses:
                '200':
                  description: Ok
                  content:
                    application/json:
                      schema:
                        $ref: '#/components/schemas/ReceiveSmsResponse'
components:
  schemas:
    AddressType:
      type: string
      enum:
        - national
        - international
        - alphanumeric
        - shortcode
    BinarySmsSendRequest:
      properties:
        recipientAddressList:
          description: 'List of recipients to whom the message should be sent.'
          type: array
          minItems: 1
          maxItems: 1000
          items:
            $ref: '#/components/schemas/E164'
        senderAddress:
          allOf:
            - description: Address of the sender (assigned to the account) from which the message is sent.
            - $ref: '#/components/schemas/E164'
        senderAddressType:
          allOf:
            - description: 'The sender address type.'
            - $ref: '#/components/schemas/AddressType'
        contentCategory:
          allOf:
            - description: 'The content category that is used to categorize the message (used for blacklisting). If no content category is provided, the default setting is used (may be changed inside the onlinesms web interface).'
            - $ref: '#/components/schemas/ContentCategory'
        notificationCallbackUrl:
          description: When setting a notificationCallbackUrl all delivery reports are forwarded to this URL.
          type: string
          format: uri
        clientMessageId:
          description: May contain a freely definable message id.
          format: string
        priority:
          description: Priority of the message. Must not exceed the value configured for the account used to send the message. For more information please contact our customer service.
          type: integer
        test:
          description: '`true`: The transmission is only simulated, no SMS is sent. Depending on the number of recipients the status code 2000 or 2001 is returned. `false` (default): No simulation is done. The SMS is sent via the SMS Gateway.'
          type: boolean
        validityPeriode:
          description: 'Specifies the validity periode (in seconds) in which the message is tried to be delivered to the recipient. A minimum of 1 minute and a maximum of 3 days are allowed.'
          type: integer
          minimum: 60
          maximum: 259200
        sendAsFlashSms:
          description: '`true`: The message is sent as flash SMS (displayed directly on the screen of the mobile phone). `false` (default): The message is sent as standard text SMS'
          type: boolean
        messageContent:
          description: 'Array of Base64 encoded binary data. Every element of the array corresponds to a message segment. The binary data is transmitted without being changed (using 8 bit alphabet)'
          type: array
          items:
            type: string
            format: base64
        userDataHeaderPresent:
          description: ' true`: Indicates the presence of a user data header in the messageContent property. `false` (default): Indicates the absence of a user data header in the messageContent property.'
          type: boolean
      required:
        - recipientAddressList
    ContentCategory:
      type: string
      enum:
        - informational
        - advertisement
    E164:
      type: string
      pattern: '^\d+$'
      description: 'E164 formatted MSISDNs – see Wikipedia https://en.wikipedia.org/wiki/MSISDN'
    MessageType:
      type: string
      description: 'Allowed values are default and voice. When using the message type default, the outgoing message type is determined based on account settings. Using the message type voice triggers a voice call.'
      enum:
        - default
        - voice
    ReceiveMessageType:
      type: string
      enum:
        - text
        - binary
        - deliveryReport
    ReceiveSmsBinaryRequest:
      properties:
        messageFlashSms:
          type: boolean
          description: 'true|false – indicates whether you received message is a SMS or a flash-SMS'
        senderAddressType:
          allOf:
            - description: 'The sender address type.'
            - $ref: '#/components/schemas/AddressType'
        recipientAddressType:
          allOf:
            - description: 'The recipient address type.'
            - $ref: '#/components/schemas/AddressType'
        userDataHeaderPresent:
          description: ' true`: Indicates the presence of a user data header in the messageContent property. `false` (default): Indicates the absence of a user data header in the messageContent property.'
          type: boolean
        binaryMessageContent:
          description: 'Content of a binary SMS in an Array of Byte64 Strings (URL safe).'
          type: array
          items:
            type: string
            format: base64
      required:
        - messageFlashSms
        - senderAddressType
        - recipientAddressType
        - userDataHeaderPresent
        - binaryMessageContent
    ReceiveSmsDeliveryReportRequest:
      properties:
        transferId:
          type: string
          description: 'Unique transfer-id to connect the deliveryReport to the initial message.'
        deliveryReportMessageStatus:
          type: string
          enum:
            - delivered
            - undelivered
            - expired
            - deleted
            - accepted
            - rejected
        sentOn:
          type: string
          format: date-time
          description: Point of time sending the message to recipients address.
        deliveredOn:
          type: string
          format: date-time
          description: Point of time of submitting the message to the mobile operators network.
        deliveredAs:
          type: string
          enum:
            - sms
            - push
            - failover-sms
            - voice
        clientMessageId:
          type: string
          description: In the case of a delivery report, the clientMessageId contains the optional submitted message id.
      required:
        - transferId
        - deliveryReportMessageStatus
    ReceiveSmsTextRequest:
      properties:
        messageFlashSms:
          type: boolean
          description: 'true|false – indicates whether you received message is a SMS or a flash-SMS'
        senderAddressType:
          allOf:
            - description: 'The sender address type.'
            - $ref: '#/components/schemas/AddressType'
        recipientAddressType:
          allOf:
            - description: 'The recipient address type.'
            - $ref: '#/components/schemas/AddressType'
        textMessageContent:
          type: string
          description: Text body of the message encoded in UTF-8. In the case of concatenated SMS it will contain the complete content of all segments.
      required:
        - messageFlashSms
        - senderAddressType
        - recipientAddressType
        - textMessageContent
    ReceiveSmsRequest:
      allOf:
        - oneOf:
            - $ref: '#/components/schemas/ReceiveSmsTextRequest'
            - $ref: '#/components/schemas/ReceiveSmsBinaryRequest'
            - $ref: '#/components/schemas/ReceiveSmsDeliveryReportRequest'
          discriminator:
            propertyName: messageType
            mapping:
              text: '#/components/schemas/ReceiveSmsTextRequest'
              binary: '#/components/schemas/ReceiveSmsBinaryRequest'
              deliveryReport: '#/components/schemas/ReceiveSmsDeliveryReportRequest'
        - properties:
            notificationId:
              type: string
              minLength: 20
              maxLength: 20
            senderAddress:
              allOf:
                - description: Originator of the sender, eg:4366012345678
                - $ref: '#/components/schemas/E164'
            recipientAddress:
              allOf:
                - description: Senders Address
                - $ref: '#/components/schemas/E164'
          required:
            - notificationId
            - senderAddress
            - recipientAddress
    ReceiveSmsResponse:
      properties:
        statusCode:
          type: integer
        statusMessage:
          type: string
      required:
        - statusCode
        - statusMessage
    SimpleSmsSendRequest:
      properties:
        clientMessageId:
          description: May contain a freely definable message id.
          format: string
        contentCategory:
          allOf:
            - description: 'The content category that is used to categorize the message (used for blacklisting). If no content category is provided, the default setting is used (may be changed inside the onlinesms web interface).'
            - $ref: '#/components/schemas/ContentCategory'
        maxSmsPerMessage:
          description: 'Specifies the maximum number of SMS to be generated. If the system generates more than this number of SMS, the status code 4026 is returned. The default value is 0.If set to 0, no limitation is applied.'
          type: integer
          minimum: 0
        messageContent:
          description: 'Latin1 URL-encoded message content'
          type: string
        messageType:
          allOf:
            - description: Specifies the message type.
            - $ref: '#/components/schemas/MessageType'
        notificationCallbackUrl:
          description: When setting a notificationCallbackUrl all delivery reports are forwarded to this URL.
          type: string
          format: uri
        priority:
          description: Priority of the message. Must not exceed the value configured for the account used to send the message. For more information please contact our customer service.
          type: integer
        recipientAddressList:
          description: 'List of recipients to whom the message should be sent.'
          type: array
          minItems: 1
          maxItems: 1000
          items:
            $ref: '#/components/schemas/E164'
        sendAsFlashSms:
          description: '`true`: The message is sent as flash SMS (displayed directly on the screen of the mobile phone). `false` (default): The message is sent as standard text SMS'
          type: boolean
        senderAddress:
          allOf:
            - description: Address of the sender (assigned to the account) from which the message is sent.
            - $ref: '#/components/schemas/E164'
        senderAddressType:
          allOf:
            - description: 'The sender address type.'
            - $ref: '#/components/schemas/AddressType'
        test:
          description: '`true`: The transmission is only simulated, no SMS is sent. Depending on the number of recipients the status code 2000 or 2001 is returned. `false` (default): No simulation is done. The SMS is sent via the SMS Gateway.'
          type: boolean
        validityPeriode:
          description: 'Specifies the validity periode (in seconds) in which the message is tried to be delivered to the recipient. A minimum of 1 minute and a maximum of 3 days are allowed.'
          type: integer
          minimum: 60
          maximum: 259200
      required:
        - recipientAddressList
        - messageContent
    SmsSendResponse:
      properties:
        statusCode:
          type: integer
        statusMessage:
          type: string
        clientMessageId:
          type: string
        transferId:
          type: string
        smsCount:
          type: integer
      required:
        - statusCode
        - statusMessage
        - clientMessageId
        - transferId
        - smsCount
    TextSmsSendRequest:
      properties:
        recipientAddressList:
          description: 'List of recipients to whom the message should be sent.'
          type: array
          minItems: 1
          maxItems: 1000
          items:
            $ref: '#/components/schemas/E164'
        senderAddress:
          allOf:
            - description: Address of the sender (assigned to the account) from which the message is sent.
            - $ref: '#/components/schemas/E164'
        senderAddressType:
          allOf:
            - description: 'The sender address type.'
            - $ref: '#/components/schemas/AddressType'
        contentCategory:
          allOf:
            - description: 'The content category that is used to categorize the message (used for blacklisting). If no content category is provided, the default setting is used (may be changed inside the onlinesms web interface).'
            - $ref: '#/components/schemas/ContentCategory'
        notificationCallbackUrl:
          description: When setting a notificationCallbackUrl all delivery reports are forwarded to this URL.
          type: string
          format: uri
        clientMessageId:
          description: May contain a freely definable message id.
          format: string
        priority:
          description: Priority of the message. Must not exceed the value configured for the account used to send the message. For more information please contact our customer service.
          type: integer
        test:
          description: '`true`: The transmission is only simulated, no SMS is sent. Depending on the number of recipients the status code 2000 or 2001 is returned. `false` (default): No simulation is done. The SMS is sent via the SMS Gateway.'
          type: boolean
        validityPeriode:
          description: 'Specifies the validity periode (in seconds) in which the message is tried to be delivered to the recipient. A minimum of 1 minute and a maximum of 3 days are allowed.'
          type: integer
          minimum: 60
          maximum: 259200
        sendAsFlashSms:
          description: '`true`: The message is sent as flash SMS (displayed directly on the screen of the mobile phone). `false` (default): The message is sent as standard text SMS'
          type: boolean
        messageContent:
          description: 'UTF-8 encoded message content'
          type: string
        maxSmsPerMessage:
          description: 'Specifies the maximum number of SMS to be generated. If the system generates more than this number of SMS, the status code 4026 is returned. The default value is 0.If set to 0, no limitation is applied.'
          type: integer
          minimum: 0
        messageType:
          allOf:
            - description: Specifies the message type.
            - $ref: '#/components/schemas/MessageType'
      required:
        - recipientAddressList
        - messageContent
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: key
    basicAuth:
      type: http
      scheme: basic
security:
  - bearerAuth: []
  - basicAuth: []