openapi: 3.0.0
info:
  title: SMS Campaigns
  description: >-
    You can use the SMS campaign endpoints to send an SMS campaign, check the
    cost of sending an SMS campaign, view SMS campaign history, and cancel a
    scheduled SMS campaign. Add these endpoints as part of your workflow.


    Relevant guides: <a
    href="https://help.clicksend.com/article/u9w7ewqpv0-sms-campaign-analytics"
    target="_blank">SMS campaign analytics</a>, <a
    href="https://help.clicksend.com/article/wluq0xv78o-can-we-shorten-a-url-automatically"
    target="_blank">Can we shorten a URL manually?</a>, and <a
    href="https://help.clicksend.com/article/nx6gjc0wmi-how-to-send-a-sms-campaign"
    target="_blank">How to send a SMS campaign?</a>.
servers:
  - url: https://rest.clicksend.com
components:
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
  schemas:
    senders:
      type: array
      description: >
        The `senders` property specifies sender IDs for each recipient country.

        - **Want to leverage the default sender settings:**
          - If the `senders` property is missing or left empty, the system uses the default sender settings configured for each recipient country.

        - **Want to override the default sender settings:**
          - When the `senders` property is provided, it should contain valid sender IDs for each recipient country listed under recipients. These IDs will override the default sender settings for the specified countries.
          - If an invalid sender ID is provided, or a sender ID for a specific recipient country is missing, the system will revert to using the default sender settings for that country.

        <div class="info-box">

        The <strong>senders</strong> parameter is currently in beta and
        available only to beta testing users. 

        <p><strong>Join the BETA Program:</strong></p>

        <p>Early access to Smart Assign is available. <a
        href="https://www.clicksend.com/gb/help/"><strong>Contact the sales
        team</strong></a> to opt-in and participate in the BETA program.</p>

        </div>
      items:
        type: object
        required:
          - recipient_country_code
        properties:
          recipient_country_code:
            type: string
            description: Recipient ISO country code
          sender_id:
            type: string
            description: >
              The sender ID must be either an alpha tag or a phone number. It is
              a required field unless the sender type is a `shared_longcode`. 


              If the sender ID is an **alpha tag**, it must be between 3 and 11
              characters long and contains only letters, numbers, and pluses.
          sender_type:
            type: string
            description: >-
              The type of sender ID, it only supports `shared_longcode` at the
              moment.
            enum:
              - shared_longcode
          sender_country_code:
            type: string
            description: >
              The ISO 3166-1 alpha-2 country code that identifies the country
              associated with the sender’s number in a shared pool.

              This is affected only when `sender_type` is set to
              `shared_longcode` to determine the appropriate number based on the
              sender’s geographic location.

              If this field is not provided or left empty, it will default to
              the recipient's country code.
    sms_campaign:
      type: object
      description: The parameters related to the SMS campaign.
      properties:
        sms_campaign_id:
          type: integer
          description: The ID of the SMS campaign.
          example: 7
        name:
          type: string
          description: The name of the SMS campaign.
          example: My Campaign 1
        user_id:
          type: integer
          description: The unique user ID of the sender.
          example: 1
        subaccount_id:
          type: integer
          description: The sub-account of the user. A user can have multiple sub-accounts.
          example: 1
        list_id:
          type: integer
          description: >-
            The _list_id_ of the contact list to which the SMS campaign was sent
            or will be sent to.
          example: 428
        from:
          type: string
          description: >-
            The sender of the message. This is also referred to as the **Sender
            ID**. If your **Sender ID** has a different country code to the
            recipient’s, it'll be replaced by a local number, except in <a
            href="https://help.clicksend.com/category/mfdctha7f0-country-specific-features-and-restrictions"
            target="_blank">certain countries</a>. If the sender number is
            blocked, a different number will replace it.
          example: '+61353787448'
        body:
          type: string
          description: The message body of the SMS campaign sent.
          example: This is my new campaign message. StopMsg.me/xxxxx
        schedule:
          type: string
          description: >-
            The scheduled date of the message. It is in <a
            href="http://help.clicksend.com/what-is-a-unix-timestamp"
            target="_blank">Unix format</a>.
          example: '1444821615'
        status:
          type: string
          description: |-
            The status of the SMS. Available statuses are:

              - _Approved_: The SMS campaign has been approved and is ready to be sent.
              - _Cancelled_: The SMS campaign was scheduled but has been cancelled before sending.
              - _Draft_: The SMS campaign is saved as a draft and has not been sent.
              - _Failed_: The SMS campaign failed to send due to an issue.
              - _Queued_: The SMS campaign is waiting to be sent.
              - _Scheduled_: The SMS campaign is set to be sent at a later time.
              - _Sending_: The SMS campaign is currently being sent.
              - _Sent_: The SMS campaign has been sent, but this does not guarantee that all messages were successfully delivered.
              - _WaitApproval_: The SMS campaign is awaiting approval from ClickSend, which may take a few minutes.
          example: Queued
        date_added:
          type: string
          description: >-
            The date you created the SMS campaign. It is in <a
            href="http://help.clicksend.com/what-is-a-unix-timestamp"
            target="_blank">Unix format</a>.
          example: '1444962630'
        custom_string:
          type: string
          nullable: true
          description: >-
            The custom note that was added when creating or updating the SMS
            campaign.
          example: null
        url_to_shorten:
          type: string
          description: >-
            The original URL that had been shorten. It will return an **empty**
            value if the SMS campaign didn’t include any shortened URL.
        unsubscribe_link:
          type: integer
          description: >-
            Indicates whether an unsubscribe link has been included in the
            message. To provide the option to unsubscribe, you can add the
            literal `StopMsg.me/xxxxx` in the message body. This parameter
            specifies whether the link was added:

              - **0**: The unsubscribe option was not provided.
              - **1**: The unsubscribe option was provided.
        source:
          type: string
          nullable: true
          description: >-
            The source of the request. For example, the name of your
            application. It's used to identify messages sent from various
            applications. It will return a **null** value if the source was not
            specified in the SMS campaign.
          example: null
        senders:
          type: array
          description: >-
            The specific sender IDs for each recipient country. It will return a
            **null** value if you did not specify the sender in the SMS
            campaign.


            <div class="info-box">
              The <strong>senders</strong> parameter is currently in beta and available only to beta testing users. 
              <p><strong>Join the BETA Program:</strong></p>
              <p>Early access to Smart Assign is available. <a href="https://www.clicksend.com/gb/help/"><strong>Contact the sales team</strong></a> to opt-in and participate in the BETA program.</p>
            </div>
          items:
            type: object
            properties:
              recipient_country_code:
                type: string
                description: Recipient ISO country code
              sender_id:
                type: string
                description: >-
                  The sender ID you specified in the request. This parameter
                  would not be returned if you did specify it in the SMS
                  campaign.
              sender_type:
                type: string
                description: >-
                  The type of sender ID you specified in the request. This
                  parameter would not be returned if you did specify it in the
                  SMS campaign.
              sender_country_code:
                type: string
                description: >-
                  The country code of the sender you specified in the request.
                  It is in two-letter format (e.g. US, UK, AU, NZ, <a
                  href="https://help.clicksend.com/article/7wtbhhy6sy-country-code-calling-code-list"
                  target="_blank">etc</a>). 

                  For certain countries, you can receive SMS from abroad. This
                  parameter would not be returned if you did specify it in the
                  SMS campaign.
        _total_count:
          type: integer
          description: The total number of messages sent in the SMS campaign.
          example: 10
        _list_name:
          type: string
          description: >-
            The name of the contact list of the SMS campaign. This is related of
            the _list_id_ parameter.
    send-sms-campaign:
      type: object
      properties:
        http_code:
          type: integer
          description: The HTTP status code of the response.
          example: 200
        response_code:
          type: string
          description: The response code indicating the status of the operation.
          example: SUCCESS
        response_msg:
          type: string
          description: A message describing the outcome of the operation.
          example: Your new campaign has been added.
        data:
          $ref: '#/components/schemas/sms_campaign'
    currency:
      type: object
      description: The parameters related to currency.
      properties:
        currency_name_short:
          type: string
          description: >-
            The currency used for the sender in three-letter format (e.g. USD,
            EUR, AUD, NZD, etc).
          example: AUD
        currency_prefix_d:
          type: string
          description: >-
            The symbol used to indicate the currency of the sender (e.g. $ , €,
            etc).
          example: $
        currency_prefix_c:
          type: string
          description: The currency basic unit (e.g. cents).
          example: c
        currency_name_long:
          type: string
          description: The full name of the currency.
          example: Australian Dollars
    calculate-sms-campaign-price:
      type: object
      properties:
        http_code:
          type: integer
          description: The HTTP status code of the response.
          example: 200
        response_code:
          type: string
          description: The response code indicating the status of the operation.
          example: SUCCESS
        response_msg:
          type: string
          description: A message describing the outcome of the operation.
          example: Here is your price for your SMS Campaign.
        data:
          type: object
          properties:
            total_count:
              type: integer
              example: 1
              description: The total number of records.
            total_price:
              type: number
              example: '0.035'
              description: The total price of the SMS campaign.
            data:
              type: object
              properties:
                from:
                  type: string
                  example: '+61353787448'
                  description: The sender.
                body:
                  type: string
                  example: John, this is your new campaign message.
                  description: The message body.
                schedule:
                  type: string
                  example: '1444381346'
                  description: The schedule timestamp.
            _currency:
              $ref: '#/components/schemas/currency'
    view-specific-sms-campaign:
      type: object
      properties:
        http_code:
          type: integer
          description: >-
            The HTTP code of the response. Visit [this page](/#status-codes) for
            more information.
          example: 200
        response_code:
          type: string
          description: >-
            The response code of the operation. Visit Visit [this
            page](/#status-codes) for more information.
          example: SUCCESS
        response_msg:
          type: string
          description: A message describing the outcome of the operation.
          example: Your SMS Campaign.
        data:
          $ref: '#/components/schemas/sms_campaign'
    update-sms-campaign:
      type: object
      properties:
        http_code:
          type: integer
          description: The HTTP status code of the response.
          example: 200
        response_code:
          type: string
          description: The response code indicating the status of the operation.
          example: SUCCESS
        response_msg:
          type: string
          description: A message describing the outcome of the operation.
          example: Your SMS Campaign has been updated.
        data:
          $ref: '#/components/schemas/sms_campaign'
    cancel-sms-campaign:
      type: object
      properties:
        http_code:
          type: integer
          description: >-
            The HTTP code of the response. Visit [this page](/#status-codes) for
            more information.
          example: 200
        response_code:
          type: string
          description: >-
            The response code of the operation. Visit [this
            page](/#status-codes) for more information.
          example: SUCCESS
        response_msg:
          type: string
          description: A message describing the outcome of the operation.
          example: Your SMS Campaign has been cancelled.
        data:
          $ref: '#/components/schemas/sms_campaign'
      example:
        http_code: 200
        response_code: SUCCESS
        response_msg: Your SMS Campaign.
        data:
          sms_campaign_id: 2135501
          name: kkde
          user_id: 496596
          subaccount_id: 563840
          list_id: 2484219
          from: edwardo3312
          body: 'new message2👍👎  smsu.io/xxxxx Reply STOP to opt-out '
          schedule: 2147483647
          status: Scheduled
          date_added: 1726199079
          custom_string: testz1
          url_to_shorten: https://developers.clicksend.com/docs/
          unsubscribe_link: 0
          source: new_soruce
          senders:
            - sender_id: '+1234'
              sender_country_code: AU
            - sender_type: shared_longcode
              sender_country_code: FR
              recipient_country_code: BG
          _total_count: 5
          _list_name: Opt-Out List
    pagination:
      type: object
      properties:
        total:
          type: integer
          description: The total number of items available for viewing.
          example: 2
        per_page:
          type: integer
          description: >-
            The number of items returned per page. This is specified in the
            limit parameter. You can have 100 items at maximum, and 15 at
            minimum.
          example: 15
        current_page:
          type: integer
          description: The current page number.
          example: 1
        last_page:
          type: integer
          description: The last page number.
          example: 1
        next_page_url:
          type: string
          nullable: true
          description: >-
            A URL of the next page. It will return **null** if there’s no next
            page.
          example: null
        prev_page_url:
          type: string
          nullable: true
          description: >-
            A URL of the previous page. It will return **null** if there’s no
            previous page.
          example: null
        from:
          type: integer
          description: The number of the first result in the current page.
          example: 1
        to:
          type: integer
          description: The number of the last result in the current page.
          example: 2
    view-sms-campaigns:
      type: object
      properties:
        http_code:
          type: integer
          description: >-
            The HTTP code of the response. Visit [this page](/#status-codes) for
            more information.
          example: 200
        response_code:
          type: string
          description: >-
            The response code of the operation. Visit [this
            page](/#status-codes) for more information.
          example: SUCCESS
        response_msg:
          type: string
          description: A message describing the outcome of the operation.
          example: Here are your SMS campaigns.
        data:
          type: object
          description: >-
            The parameters related to the total SMS campaign shown. The response
            will depend on the query parameters.
          allOf:
            - $ref: '#/components/schemas/pagination'
            - type: object
              properties:
                data:
                  type: array
                  description: The parameters related to the SMS campaign.
                  items:
                    $ref: '#/components/schemas/sms_campaign'
      example:
        http_code: 200
        response_code: SUCCESS
        response_msg: Here are your SMS campaign(s) (shared included).
        data:
          total: 1
          per_page: 15
          current_page: 1
          last_page: 1
          next_page_url: null
          prev_page_url: null
          from: 1
          to: 1
          data:
            - sms_campaign_id: 2145880
              name: taz
              user_id: 496596
              subaccount_id: 563840
              list_id: 2760107
              from: '+61428584957'
              body: >-
                Hey (First Name), I want to ask if this is your lastname: (Last
                Name)?
              schedule: 1925594636
              status: Scheduled
              date_added: 1726466470
              custom_string: custom_name
              url_to_shorten: ''
              unsubscribe_link: 0
              source: sample_soruce
              senders:
                - sender_id: '+12124567890'
                  recipient_country_code: US
                - sender_type: shared_longcode
                  sender_country_code: FR
                  recipient_country_code: BG
              _total_count: 1
              _list_name: frrfe
paths:
  /v3/sms-campaigns/send:
    post:
      summary: Send SMS Campaign
      operationId: send-sms-campaign
      description: >-
        ### _SMS Campaign Endpoint_


        You can post to a list with `up to 20000 recipients` with each API call.
        You can only send to a single list containing up to 20,000 recipients.
        The response is far less detailed than the normal Send SMS endpoint. Use
        the [SMS Send](https://developers.clicksend.com/docs/rest/v3/#send-sms)
        endpoint if you would like to send to less than 1000 recipients at once.

        You are required to add an opt-out message to the end of your message
        body if you are sending marketing message. This can be in the form of
        asking users to reply STOP to opt-out or by including `StopMsg.me/xxxxx`
        which is a placeholder that will add a link that can be clicked to
        out-out.

        Refer to [Status Codes](/#status-codes) for definitions of HTTP status
        code responses.

        <div style="background-color: #FF6A4B; padding: 10px; border-radius:
        8px;">
          <span style="color: white;">This endpoint requires authentication,</span> 
          <a href="/#authentication" style="color: white; text-decoration: underline;">more info...</a>
        </div>
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - list_id
                - name
                - body
                - from
                - senders
              properties:
                list_id:
                  type: integer
                  description: >
                    The `list_id` of the contact list to send the message to.
                    Use the 

                    **<a
                    href="https://developers-dev.clicksend.net/docs/rest/v3/contacts/lists/other/view-list-contacts"
                    target="_blank">View Contact List</a>** endpoint to see your
                    contact lists. 

                    You can also use the other **<a
                    href="https://developers-dev.clicksend.net/docs/rest/v3/contacts/lists"
                    target="_blank">list endpoints</a>** to create and manage
                    your contact list. 

                    You need to provide the to parameter or the `list_id`
                    parameter.
                  example: 1
                name:
                  type: string
                  description: The SMS campaign name.
                  example: My Campaign
                from:
                  type: string
                  description: >-
                    The sender of the message. This is also referred to as the
                    **<a
                    href="https://help.clicksend.com/article/4kgj7krx00-what-is-a-sender-id-or-sender-number"
                    target="_blank">Sender ID</a>**. You can use:

                    - **Shared number:** A number that is randomly selected from
                    a pool if no number is specified. This is not available in
                    the US and Canada. You can’t use a shared number if you have
                    a dedicated number.

                    - **Dedicated number:** A number you've purchased from
                    ClickSend. You can purchase a dedicated number using the <a
                    href="https://dashboard.clicksend.com/sender-ids/manage-senders"
                    target="_blank">Dashboard</a> or the [**Purchase Dedicated
                    Number**](/) endpoint. It should be in the international
                    format (<a href="https://en.wikipedia.org/wiki/E.164"
                    target="_blank">E.164</a>).

                    - **Alpha tag:** A sender name, like the name of your
                    business, used as the **Sender ID** instead of a number.
                    Recipients cannot reply to an alpha tag. You can register an
                    alpha tag using the <a
                    href="https://dashboard.clicksend.com/sender-ids/manage-senders"
                    target="_blank">dashboard</a> or the **[Request Alpha
                    Tag](/)** endpoint. Check which countries support alpha tags
                    <a
                    href="https://help.clicksend.com/article/532u04vhaq-which-countries-support-alpha-tags"
                    target="_blank">here</a>.

                    - **Own number:** Your own number that is connected to your
                    account. Replies from recipients are sent directly to your
                    number. You can register your own number using the <a
                    href="https://dashboard.clicksend.com/sender-ids/manage-senders"
                    target="_blank">dashboard</a> or the [**Request Own Number
                    Verification OTP**](/) endpoint to get the _verification_id_
                    and OTP code needed for the [**Verify Own Number OTP**](/)
                    endpoint. This isn't available in the US and Canada.

                    If your **Sender ID** has a different country code to the
                    recipient’s, it'll be replaced by a local number, except in
                    <a
                    href="https://help.clicksend.com/category/mfdctha7f0-country-specific-features-and-restrictions"
                    target="_blank">certain countries</a>. If the sender number
                    is blocked, a different number will replace it.
                body:
                  type: string
                  description: >-
                    The message to send. The price of sending a message depends
                    on the number of characters and the type of message. There
                    are two types:  

                    - Standard message - Contains only characters in the <a
                    href="https://en.wikipedia.org/wiki/GSM_03.38"
                    target="_blank">GSM</a> set, with a maximum of 160
                    characters.  

                    - Unicode message - Contains characters outside the <a
                    href="https://en.wikipedia.org/wiki/GSM_03.38"
                    target="_blank">GSM</a> set, with a maximum of 70
                    characters.  

                    Longer messages will be sent as multiple messages (parts),
                    but the recipient will receive them as a single long
                    message. Visit <a
                    href="https://help.clicksend.com/article/h474eseq3a-how-many-characters-can-i-send-in-an-sms"
                    target="_blank">this page</a> to learn more about the number
                    of characters per message, and <a
                    href="http://smscharactercount.com/#/counter"
                    target="_blank">this page</a> to count the number of
                    characters.
                source:
                  type: string
                  description: >-
                    The source of the request. For example, the name of your
                    application. It's used to identify messages sent from
                    various applications.
                schedule:
                  type: integer
                  description: >-
                    The time you want the message to be sent. It should be in <a
                    href="http://help.clicksend.com/what-is-a-unix-timestamp"
                    target="_blank">Unix format</a>.
                senders:
                  type: array
                  $ref: '#/components/schemas/senders'
                url_to_shorten:
                  type: string
                  description: >
                    The URL you want to shorten. The shortened URL will be
                    appended to the end of the message body. 
              example:
                list_id: '{{listId}}'
                name: My Campaign
                from: '+6141111111'
                body: >-
                  Hey (First Name), I want to ask if this is your lastname:
                  (Last Name)? Visit http://smsg.io/xxxxx for more details.
                url_to_shorten: http://www.google.com/
                subject: New sms campaign test
                senders:
                  - country: AU
                    sender_id: '+6141111111'
                    sender_type: longcode
                  - country: US
                    sender_type': shared_longcode
                    sender_country_code: US
      security:
        - basicAuth: []
      parameters:
        - name: Content-Type
          in: header
          schema:
            type: string
          example: application/json
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/send-sms-campaign'
      x-codeSamples:
        - lang: curl
          source: |-
            curl --include \
                 --header "Authorization: Basic YXBpLXVzZXJuYW1lOmFwaS1wYXNzd29yZA=="  \
                 --request POST \

                 --header "Content-Type: application/json" \
                 --data-binary "{
                \"list_id\":428,
                \"name\":\"My Campaign 1\",
                \"body\":\"This is my new campaign message.\"
            }" \
            'https://rest.clicksend.com/v3/sms-campaigns/send'
        - lang: PHP
          source: >-
            <?php

            require_once(__DIR__ . '/vendor/autoload.php');


            // Configure HTTP basic authorization: BasicAuth

            $config = ClickSend\Configuration::getDefaultConfiguration()
                          ->setUsername('USERNAME')
                          ->setPassword('API_KEY');

            $apiInstance = new ClickSend\Api\SmsCampaignApi(new
            GuzzleHttp\Client(),$config);

            $campaign = new \ClickSend\Model\SmsCampaign(); //
            \ClickSend\Model\SmsCampaign | SmsCampaign model

            $campaign->setListId(185161);

            $campaign->setName("My Campaign 1");

            $campaign->setBody("This is my new campaign message.");


            try {
                $result = $apiInstance->smsCampaignsSendPost($campaign);
                print_r($result);
            } catch (Exception $e) {
                echo 'Exception when calling SmsCampaignApi->smsCampaignsSendPost: ', $e->getMessage(), PHP_EOL;
            }

            ?>
        - lang: C#
          source: |-
            using IO.ClickSend.ClickSend.Api;
            using IO.ClickSend.Client;
            using IO.ClickSend.ClickSend.Model;

            var configuration = new Configuration()
            {
                Username = USERNAME,
                Password = API_KEY  
            };
            var smsCampaignApi = new SmsCampaignApi(configuration);

            var response = smsCampaignApi.SmsCampaignsSendPost(new SmsCampaign(
                listId: LIST_ID,
                name: "Campaign Name",
                body: "Body"
            ));
        - lang: Java
          source: |-
            package ClickSend;

            import ClickSend.Api.SmsCampaignApi;
            import ClickSend.Model.SmsCampaign;

            public class send_sms_campaign {
              public static void main(String[] args) {
                ApiClient defaultClient = new ApiClient();
                defaultClient.setUsername("USERNAME");
                defaultClient.setPassword("API_KEY");
                SmsCampaignApi apiInstance = new SmsCampaignApi(defaultClient);
                SmsCampaign campaign = new SmsCampaign(); // SmsCampaign | SmsCampaign model

                campaign.listId(new Integer(185161));
                campaign.name("campaign");
                campaign.body("campaign body");

                try {
                    String result = apiInstance.smsCampaignsSendPost(campaign);
                    System.out.println(result);
                } catch (ApiException e) {
                    System.err.println("Exception when calling SmsCampaignApi#smsCampaignsSendPost");
                    e.printStackTrace();
                }
              }
            }
        - lang: Node.js
          source: >-
            var api = require('./api.js');


            var smsCampaignApi = new api.SmsCampaignApi("USERNAME", "API_KEY");


            var campaign = new api.SmsCampaign();


            campaign.listId = 185161;

            campaign.name = "My Campaign 1";

            campaign.body = "This is my new campaign message";


            smsCampaignApi.smsCampaignsSendPost(campaign).then(function(response)
            {
              console.log(response.body);
            }).catch(function(err){
              console.error(err.body);
            });
        - lang: Ruby
          source: |-
            # load the gem
            require 'clicksend_client'
            require 'json'

            # setup authorization
            ClickSendClient.configure do |config|
              # Configure HTTP basic authorization: BasicAuth
              config.username = 'USERNAME'
              config.password = 'API_KEY'
            end

            api_instance = ClickSendClient::SmsCampaignApi.new

            # SmsCampaign | SmsCampaign model
            campaign = ClickSendClient::SmsCampaign.new(
              "list_id": 1234,
              "name": "name",
              "body": "body"
            )

            begin
              # Create sms campaign
              result = api_instance.sms_campaigns_send_post(campaign)
              p JSON.parse(result)
            rescue ClickSendClient::ApiError => e
              puts "Exception when calling SmsCampaignApi->sms_campaigns_send_post: #{e.response_body}"
            end
        - lang: Python
          source: >-
            from __future__ import print_function

            import clicksend_client

            from clicksend_client.rest import ApiException


            # Configure HTTP basic authorization: BasicAuth

            configuration = clicksend_client.Configuration()

            configuration.username = 'USERNAME'

            configuration.password = 'API_KEY'


            # create an instance of the API class

            api_instance =
            clicksend_client.SmsCampaignApi(clicksend_client.ApiClient(configuration))

            campaign = clicksend_client.SmsCampaign(
                        list_id=185161,
                        name="My Campaign 1",
                        body="This is my new campaign message."

            try:
                # Create sms campaign
                api_response = api_instance.sms_campaigns_send_post(campaign)
                print(api_response)
            except ApiException as e:
                print("Exception when calling SmsCampaignApi->sms_campaigns_send_post: %s\n" % e)
        - lang: perl
          source: >-
            use WWW::ClickSendClient::SmsCampaignApi;

            use WWW::ClickSendClient::Object::SmsCampaign;


            my $username = 'YOUR_API_USER_NAME';

            my $password = 'YOUR_API_PASSWORD';


            my $api = WWW::ClickSendClient::SmsCampaignApi->new(username =>
            $username, password => $password);


            my %params = (
                'list_id'  => 'contact_list_id',
                'name'     => 'name',
                'body'     => 'body'
            );


            my $campaign_obj =
            WWW::ClickSendClient::Object::SmsCampaign->new(%params);


            my $json_output = $api->sms_campaigns_send_post('campaign' =>
            $campaign_obj);


            print $json_output;
        - lang: objc
          source: >-
            #import "CSSmsCampaignApi.h"

            #import "CSDefaultConfiguration.h"


            CSDefaultConfiguration *apiConfig = [CSDefaultConfiguration
            sharedConfig];

            // Configure HTTP basic authorization (authentication scheme:
            BasicAuth)

            [apiConfig setUsername:@"USERNAME"];

            [apiConfig setPassword:@"PASSWORD"];


            CSSmsCampaign *campaign = [[CSSmsCampaign alloc] init];

            campaign.listId = @(258);

            campaign.name = @"name";

            campaign.body = @"body";


            CSSmsCampaignApi *smsCampaign = [[CSSmsCampaignApi alloc] init];

            [smsCampaign smsCampaignsSendPostWithCampaign:campaign
            completionHandler:^(NSString *output, NSError *error) {
                if (error) {
                    NSLog(@"Error: %@", error);
                } else {
                    NSLog(@"%@", output);
                }
            }];
        - lang: swift
          source: >-
            import Alamofire

            if let authHeader = Request.authorizationHeader(user: "USERNAME",
            password: "PASSWORD") {
                ClickSendClientAPI.customHeaders = [authHeader.key : authHeader.value]
            }


            let campaign = SmsCampaign(
                listId: 258,
                name: "name",
                body: "body")

            SmsCampaignAPI.smsCampaignsSendPost(campaign: campaign) {
            (dataString, error) in
                if let error = error {
                    print(error)
                } else {
                    if let data = dataString!.data(using: String.Encoding.utf8) {
                        do {
                            if let dictonary = try (JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary) {
                                print(dictonary)
                            } else {
                                print("Cannot convert the String value to JSON")
                            }
                        } catch let error as NSError {
                            print(error)
                        }
                    }
                }
            }
  /v3/sms-campaigns/price:
    post:
      summary: Calculate SMS Campaign Price
      operationId: calculate-sms-campaign-price
      description: >-
        _Calculate price for sms campaign_


        ### Properties


        | Name | Type | Required | Restrictions | Description |

        | --- | --- | --- | --- | --- |

        | list_id | integer(int32) | true | none | Your list id. |

        | name | string | true | none | Your campaign name. |

        | body | string | true | none | Your campaign message. |

        | from | string | true |
        [yes](http://help.clicksend.com/SMS/what-is-a-sender-id-or-sender-number)
        | Your sender id |

        | schedule | integer(int32) | false | none | Your schedule timestamp. |



        Refer to [Status Codes](/#status-codes) for definitions of HTTP status
        code responses.



        <div style="background-color: #FF6A4B; padding: 10px; border-radius:
        8px;">
          <span style="color: white;">This endpoint requires authentication,</span> 
          <a href="/#authentication" style="color: white; text-decoration: underline;">more info...</a>
        </div>
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                list_id:
                  type: string
                name:
                  type: string
                from:
                  type: string
                body:
                  type: string
              example:
                list_id: '{{listId}}'
                name: My Campaign
                from: '+61411111111'
                body: >-
                  Hey (First Name), I want to ask if this is your lastname:
                  (Last Name)?
      security:
        - basicAuth: []
      parameters:
        - name: Content-Type
          in: header
          schema:
            type: string
          example: application/json
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/calculate-sms-campaign-price'
      x-codeSamples:
        - lang: curl
          source: |-
            curl --include \
                 --header "Authorization: Basic YXBpLXVzZXJuYW1lOmFwaS1wYXNzd29yZA=="  \
                 --request POST \

                 --header "Content-Type: application/json" \
                 --data-binary "{
                \"list_id\":428,
                \"name\":\"My Campaign 1\",
                \"body\":\"(First Name), this is your new campaign message.\"
            }" \
            'https://rest.clicksend.com/v3/sms-campaigns/price'
        - lang: PHP
          source: >-
            <?php

            require_once(__DIR__ . '/vendor/autoload.php');


            // Configure HTTP basic authorization: BasicAuth

            $config = ClickSend\Configuration::getDefaultConfiguration()
                          ->setUsername('USERNAME')
                          ->setPassword('API_KEY');

            $apiInstance = new ClickSend\Api\SmsCampaignApi(new
            GuzzleHttp\Client(),$config);

            $campaign = new \ClickSend\Model\SmsCampaign(); //
            \ClickSend\Model\SmsCampaign | SmsCampaign model

            $campaign->setListId(185161);

            $campaign->setName("My Campaign 1");

            $campaign->setBody("This is my new campaign message.");


            try {
                $result = $apiInstance->smsCampaignsPricePost($campaign);
                print_r($result);
            } catch (Exception $e) {
                echo 'Exception when calling SmsCampaignApi->smsCampaignsPricePost: ', $e->getMessage(), PHP_EOL;
            }

            ?>
        - lang: C#
          source: |-
            using IO.ClickSend.ClickSend.Api;
            using IO.ClickSend.Client;
            using IO.ClickSend.ClickSend.Model;

            var configuration = new Configuration()
            {
                Username = USERNAME,
                Password = API_KEY  
            };
            var smsCampaignApi = new SmsCampaignApi(configuration);

            var response = smsCampaignApi.SmsCampaignsPricePost(new SmsCampaign(
                listId: 1234,
                name: "Campaign Name",
                body: "Body"
            ));
        - lang: Java
          source: |
            package ClickSend;

            import ClickSend.Api.SmsCampaignApi;
            import ClickSend.Model.SmsCampaign;

            public class calculate_sms_campaign_price {
              public static void main(String[] args) {
                ApiClient defaultClient = new ApiClient();
                defaultClient.setUsername("USERNAME");
                defaultClient.setPassword("API_KEY");
                SmsCampaignApi apiInstance = new SmsCampaignApi(defaultClient);
                SmsCampaign campaign = new SmsCampaign(); // SmsCampaign | SmsCampaign model
                campaign.listId(new Integer(185161));
                campaign.name("campaign");
                campaign.body("campaign body");
                try {
                    String result = apiInstance.smsCampaignsPricePost(campaign);
                    System.out.println(result);
                } catch (ApiException e) {
                    System.err.println("Exception when calling SmsCampaignApi#smsCampaignsPricePost");
                    e.printStackTrace();
                }
              }
            }
        - lang: Node.js
          source: >-
            var api = require('./api.js');


            var smsCampaignApi = new api.SmsCampaignApi("USERNAME", "API_KEY");


            var campaign = new api.SmsCampaign();


            campaign.listId = 185161;

            campaign.name = "My Campaign 1";

            campaign.body = "This is my new campaign message";


            smsCampaignApi.smsCampaignsPricePost(campaign).then(function(response)
            {
              console.log(response.body);
            }).catch(function(err){
              console.error(err.body);
            });
        - lang: Ruby
          source: |-
            # load the gem
            require 'clicksend_client'
            require 'json'

            # setup authorization
            ClickSendClient.configure do |config|
              # Configure HTTP basic authorization: BasicAuth
              config.username = 'USERNAME'
              config.password = 'API_KEY'
            end

            api_instance = ClickSendClient::SmsCampaignApi.new

            # SmsCampaign | SmsCampaign model
            campaign = ClickSendClient::SmsCampaign.new(
              "list_id": 1234,
              "name": "name",
              "body": "body"
            )

            begin
              # Calculate price for sms campaign
              result = api_instance.sms_campaigns_price_post(campaign)
              p JSON.parse(result)
            rescue ClickSendClient::ApiError => e
              puts "Exception when calling SmsCampaignApi->sms_campaigns_price_post: #{e.response_body}"
            end
        - lang: Python
          source: >-
            from __future__ import print_function

            import clicksend_client

            from clicksend_client.rest import ApiException


            # Configure HTTP basic authorization: BasicAuth

            configuration = clicksend_client.Configuration()

            configuration.username = 'USERNAME'

            configuration.password = 'API_KEY'


            # create an instance of the API class

            api_instance =
            clicksend_client.SmsCampaignApi(clicksend_client.ApiClient(configuration))

            campaign = clicksend_client.SmsCampaign(
                        list_id=185161,
                        name="My Campaign 1",
                        body="This is my new campaign message."

            try:
                # Calculate price for sms campaign
                api_response = api_instance.sms_campaigns_price_post(campaign)
                print(api_response)
            except ApiException as e:
                print("Exception when calling SmsCampaignApi->sms_campaigns_price_post: %s\n" % e)
        - lang: perl
          source: >-
            use WWW::ClickSendClient::SmsCampaignApi;

            use WWW::ClickSendClient::Object::SmsCampaign;


            my $username = 'YOUR_API_USER_NAME';

            my $password = 'YOUR_API_PASSWORD';


            my $api = WWW::ClickSendClient::SmsCampaignApi->new(username =>
            $username, password => $password);


            my %params = (
                'list_id'  => 'contact_list_id',
                'name'     => 'name',
                'body'     => 'body'
            );


            my $campaign_obj =
            WWW::ClickSendClient::Object::SmsCampaign->new(%params);


            my $json_output = $api->sms_campaigns_price_post('campaign' =>
            $campaign_obj);


            print $json_output;
        - lang: objc
          source: >-
            #import "CSSmsCampaignApi.h"

            #import "CSDefaultConfiguration.h"


            CSDefaultConfiguration *apiConfig = [CSDefaultConfiguration
            sharedConfig];

            // Configure HTTP basic authorization (authentication scheme:
            BasicAuth)

            [apiConfig setUsername:@"USERNAME"];

            [apiConfig setPassword:@"PASSWORD"];


            CSSmsCampaign *campaign = [[CSSmsCampaign alloc] init];

            campaign.listId = @(258);

            campaign.name = @"name";

            campaign.body = @"body";


            CSSmsCampaignApi *smsCampaign = [[CSSmsCampaignApi alloc] init];

            [smsCampaign smsCampaignsPricePostWithCampaign:campaign
            completionHandler:^(NSString *output, NSError *error) {
                if (error) {
                    NSLog(@"Error: %@", error);
                } else {
                    NSLog(@"%@", output);
                }
            }];
        - lang: swift
          source: >-
            import Alamofire

            if let authHeader = Request.authorizationHeader(user: "USERNAME",
            password: "PASSWORD") {
                ClickSendClientAPI.customHeaders = [authHeader.key : authHeader.value]
            }


            let campaign = SmsCampaign(
                                listId: 258,
                                name: "name",
                                body: "body"
                            )

            SmsCampaignAPI.smsCampaignsPricePost(campaign: campaign) {
            (dataString, error) in
                if let error = error {
                    print(error)
                } else {
                    if let data = dataString!.data(using: String.Encoding.utf8) {
                        do {
                            if let dictonary = try (JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary) {
                                print(dictonary)
                            } else {
                                print("Cannot convert the String value to JSON")
                            }
                        } catch let error as NSError {
                            print(error)
                        }
                    }
                }
            }
  /v3/sms-campaigns/{sms_campaign_id}:
    put:
      summary: Update SMS Campaign
      operationId: update-sms-campaign
      description: >-
        _Update sms campaign_


        ### Parameters


        | Parameter | In | Type | Required | Description |

        | --- | --- | --- | --- | --- |

        | sms_campaign_id | path | integer(int32) | true | ID of SMS campaign to
        update |


        ### Properties


        | Name | Type | Required | Restrictions | Description |

        | --- | --- | --- | --- | --- |

        | list_id | integer(int32) | true | none | Your list id. |

        | name | string | true | none | Your campaign name. |

        | body | string | true | none | Your campaign message. |

        | from | string | true |
        [yes](http://help.clicksend.com/SMS/what-is-a-sender-id-or-sender-number)
        | Your sender id |

        | schedule | integer(int32) | false | none | Your schedule timestamp. |


        Refer to [Status Codes](/#status-codes) for definitions of HTTP status
        code responses.


        <div style="background-color: #FF6A4B; padding: 10px; border-radius:
        8px;">
          <span style="color: white;">This endpoint requires authentication,</span> 
          <a href="/#authentication" style="color: white; text-decoration: underline;">more info...</a>
        </div>
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                list_id:
                  type: string
                name:
                  type: string
                from:
                  type: string
                body:
                  type: string
              example:
                list_id: '{{listId}}'
                name: My Campaign2
                from: '+61411111111'
                body: >-
                  Hey (First Name), I want to ask if this is your lastname:
                  (Last Name)?
      security:
        - basicAuth: []
      parameters:
        - name: Content-Type
          in: header
          schema:
            type: string
          example: application/json
        - name: sms_campaign_id
          in: path
          schema:
            type: string
          required: true
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/update-sms-campaign'
      x-codeSamples:
        - lang: curl
          source: |-
            curl --include \
                 --header "Authorization: Basic YXBpLXVzZXJuYW1lOmFwaS1wYXNzd29yZA=="  \
                 --request PUT \

                 --header "Content-Type: application/json" \
                 --data-binary "{
                \"list_id\":428,
                \"name\":\"Awesome campaign.\",
                \"body\":\"his is an awesome message.\"
            }" \
            'https://rest.clicksend.com/v3/sms-campaigns/{sms_campaign_id}'
        - lang: PHP
          source: >-
            <?php

            require_once(__DIR__ . '/vendor/autoload.php');


            // Configure HTTP basic authorization: BasicAuth

            $config = ClickSend\Configuration::getDefaultConfiguration()
                          ->setUsername('USERNAME')
                          ->setPassword('API_KEY');

            $apiInstance = new ClickSend\Api\SmsCampaignApi(new
            GuzzleHttp\Client(),
                $config
            );

            $sms_campaign_id = 134574; // int | ID of SMS campaign to update

            $campaign = new \ClickSend\Model\SmsCampaign(); //
            \ClickSend\Model\SmsCampaign | SmsCampaign model

            $campaign->setListId(185161);

            $campaign->setName("My Campaign 1");

            $campaign->setBody("This is my new campaign message.");


            try {
                $result = $apiInstance->smsCampaignsBySmsCampaignIdPut($sms_campaign_id, $campaign);
                print_r($result);
            } catch (Exception $e) {
                echo 'Exception when calling SmsCampaignApi->smsCampaignsBySmsCampaignIdPut: ', $e->getMessage(), PHP_EOL;
            }

            ?>
        - lang: C#
          source: >-
            using IO.ClickSend.ClickSend.Api;

            using IO.ClickSend.Client;

            using IO.ClickSend.ClickSend.Model;


            var configuration = new Configuration()

            {
                Username = USERNAME,
                Password = API_KEY  
            };

            var smsCampaignApi = new SmsCampaignApi(configuration);


            var response =
            smsCampaignApi.SmsCampaignsBySmsCampaignIdPut(CAMPAIGN_ID, new
            SmsCampaign(
                listId: LIST_ID,
                name: "Campaign Name",
                body: "Body"
            ));
        - lang: Java
          source: |-
            package ClickSend;

            import ClickSend.Api.SmsCampaignApi;
            import ClickSend.Model.SmsCampaign;

            public class update_sms_campaign {
              public static void main(String[] args) {
                ApiClient defaultClient = new ApiClient();
                defaultClient.setUsername("USERNAME");
                defaultClient.setPassword("API_KEY");
                SmsCampaignApi apiInstance = new SmsCampaignApi(defaultClient);
                Integer smsCampaignId = 121337; // Integer | ID of SMS campaign to update
                SmsCampaign campaign = new SmsCampaign(); // SmsCampaign | SmsCampaign model
                campaign.listId(new Integer(185161));
                campaign.name("campaign2");
                campaign.body("campaign body");
                try {
                    String result = apiInstance.smsCampaignsBySmsCampaignIdPut(smsCampaignId, campaign);
                    System.out.println(result);
                } catch (ApiException e) {
                    System.err.println("Exception when calling SmsCampaignApi#smsCampaignsBySmsCampaignIdPut");
                    e.printStackTrace();
                }
              }
            }
        - lang: Node.js
          source: >-
            var api = require('./api.js');


            var smsCampaignApi = new api.SmsCampaignApi("USERNAME", "API_KEY");


            var smsCampaignId = 129227;


            var campaign = new api.SmsCampaign();


            campaign.listId = 185161;

            campaign.name = "My Campaign 1";

            campaign.body = "This is my new campaign message";

            campaign.from = "+61353787448";


            smsCampaignApi.smsCampaignsBySmsCampaignIdPut(smsCampaignId,
            campaign).then(function(response) {
              console.log(response.body);
            }).catch(function(err){
              console.error(err.body);
            });
        - lang: Ruby
          source: |-
            # load the gem
            require 'clicksend_client'
            require 'json'

            # setup authorization
            ClickSendClient.configure do |config|
              # Configure HTTP basic authorization: BasicAuth
              config.username = 'USERNAME'
              config.password = 'API_KEY'
            end

            api_instance = ClickSendClient::SmsCampaignApi.new

            sms_campaign_id = 119000 # Integer | ID of SMS campaign to update

            # SmsCampaign | SmsCampaign model
            campaign = ClickSendClient::SmsCampaign.new(
              "list_id": 1234,
              "name": "name",
              "body": "body"
            )

            begin
              # Update sms campaign
              result = api_instance.sms_campaigns_by_sms_campaign_id_put(sms_campaign_id, campaign)
              p JSON.parse(result)
            rescue ClickSendClient::ApiError => e
              puts "Exception when calling SmsCampaignApi->sms_campaigns_by_sms_campaign_id_put: #{e.response_body}"
            end
        - lang: Python
          source: >-
            from __future__ import print_function

            import clicksend_client

            from clicksend_client.rest import ApiException


            # Configure HTTP basic authorization: BasicAuth

            configuration = clicksend_client.Configuration()

            configuration.username = 'USERNAME'

            configuration.password = 'API_KEY'


            # create an instance of the API class

            api_instance =
            clicksend_client.SmsCampaignApi(clicksend_client.ApiClient(configuration))

            sms_campaign_id = 119317 # int | ID of SMS campaign to update

            campaign = clicksend_client.SmsCampaign(
                        list_id=185161,
                        name="My Campaign updated",
                        body="This is my new campaign message."

            try:
                # Update sms campaign
                api_response = api_instance.sms_campaigns_by_sms_campaign_id_put(sms_campaign_id, campaign)
                print(api_response)
            except ApiException as e:
                print("Exception when calling SmsCampaignApi->sms_campaigns_by_sms_campaign_id_put: %s\n" % e)
        - lang: perl
          source: >-
            use WWW::ClickSendClient::SmsCampaignApi;

            use WWW::ClickSendClient::Object::SmsCampaign;


            my $username = 'YOUR_API_USER_NAME';

            my $password = 'YOUR_API_PASSWORD';


            my $api = WWW::ClickSendClient::SmsCampaignApi->new(username =>
            $username, password => $password);


            my %params = (
                'list_id'  => 'contact_list_id',
                'name'     => 'name',
                'body'     => 'body'
            );


            my $campaign_obj =
            WWW::ClickSendClient::Object::SmsCampaign->new(%params);


            my $json_output =
            $api->sms_campaigns_by_sms_campaign_id_put('campaign' =>
            $campaign_obj , 'sms_campaign_id' => '1234');


            print $json_output;
        - lang: objc
          source: >-
            #import "CSSmsCampaignApi.h"

            #import "CSDefaultConfiguration.h"


            CSDefaultConfiguration *apiConfig = [CSDefaultConfiguration
            sharedConfig];

            // Configure HTTP basic authorization (authentication scheme:
            BasicAuth)

            [apiConfig setUsername:@"USERNAME"];

            [apiConfig setPassword:@"PASSWORD"];


            CSSmsCampaign *campaign = [[CSSmsCampaign alloc] init];

            campaign.listId = @(258);

            campaign.name = @"name";

            campaign.body = @"body";


            CSSmsCampaignApi *smsCampaign = [[CSSmsCampaignApi alloc] init];

            [smsCampaign smsCampaignsBySmsCampaignIdPutWithSmsCampaignId:@(1)
            campaign:campaign completionHandler:^(NSString *output, NSError
            *error) {
                if (error) {
                    NSLog(@"Error: %@", error);
                } else {
                    NSLog(@"%@", output);
                }
            }];
        - lang: swift
          source: >-
            import Alamofire

            if let authHeader = Request.authorizationHeader(user: "USERNAME",
            password: "PASSWORD") {
                ClickSendClientAPI.customHeaders = [authHeader.key : authHeader.value]
            }


            let campaign = SmsCampaign(
                            listId: 258,
                            name: "name",
                            body: "body"
                        )

            SmsCampaignAPI.smsCampaignsBySmsCampaignIdPut(smsCampaignId: 1,
            campaign: campaign) { (dataString, error) in
                if let error = error {
                    print(error)
                } else {
                    if let data = dataString!.data(using: String.Encoding.utf8) {
                        do {
                            if let dictonary = try (JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary) {
                                print(dictonary)
                            } else {
                                print("Cannot convert the String value to JSON")
                            }
                        } catch let error as NSError {
                            print(error)
                        }
                    }
                }
            }
    get:
      summary: View Specific SMS Campaign
      operationId: view-specific-sms-campaign
      description: Use this endpoint to view a specific SMS campaign.
      security:
        - basicAuth: []
      parameters:
        - name: Content-Type
          in: header
          schema:
            type: string
          example: application/json
        - name: sms_campaign_id
          description: ID of SMS campaign to get
          in: path
          schema:
            type: string
          required: true
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/view-specific-sms-campaign'
      x-codeSamples:
        - lang: curl
          source: |-
            curl --include \
                 --header "Authorization: Basic YXBpLXVzZXJuYW1lOmFwaS1wYXNzd29yZA=="  \

            'https://rest.clicksend.com/v3/sms-campaigns/{sms_campaign_id}'
        - lang: PHP
          source: >-
            <?php

            require_once(__DIR__ . '/vendor/autoload.php');


            // Configure HTTP basic authorization: BasicAuth

            $config = ClickSend\Configuration::getDefaultConfiguration()
                          ->setUsername('USERNAME')
                          ->setPassword('API_KEY');

            $apiInstance = new ClickSend\Api\SmsCampaignApi(new
            GuzzleHttp\Client(),$config);

            $sms_campaign_id = 121918; // int | ID of SMS campaign to retrieve


            try {
                $result = $apiInstance->smsCampaignBySmsCampaignIdGet($sms_campaign_id);
                print_r($result);
            } catch (Exception $e) {
                echo 'Exception when calling SmsCampaignApi->smsCampaignBySmsCampaignIdGet: ', $e->getMessage(), PHP_EOL;
            }

            ?>
        - lang: C#
          source: >-
            using IO.ClickSend.ClickSend.Api;

            using IO.ClickSend.Client;

            using IO.ClickSend.ClickSend.Model;


            var configuration = new Configuration()

            {
                Username = USERNAME,
                Password = API_KEY  
            };

            var smsCampaignApi = new SmsCampaignApi(configuration);

            var response =
            smsCampaignApi.SmsCampaignBySmsCampaignIdGet(CAMPAIGN_ID);
        - lang: Java
          source: |-
            package ClickSend;

            import ClickSend.Api.SmsCampaignApi;

            public class view_specific_sms_campaign {
              public static void main(String[] args) {
                ApiClient defaultClient = new ApiClient();
                defaultClient.setUsername("USERNAME");
                defaultClient.setPassword("API_KEY");
                SmsCampaignApi apiInstance = new SmsCampaignApi(defaultClient);
                Integer smsCampaignId = 121337; // Integer | ID of SMS campaign to retrieve
                try {
                    String result = apiInstance.smsCampaignBySmsCampaignIdGet(smsCampaignId);
                    System.out.println(result);
                } catch (ApiException e) {
                    System.err.println("Exception when calling SmsCampaignApi#smsCampaignBySmsCampaignIdGet");
                    e.printStackTrace();
                }
              }
            }
        - lang: Node.js
          source: >-
            var api = require('./api.js');


            var smsCampaignApi = new api.SmsCampaignApi("USERNAME", "API_KEY");


            var smsCampaignId = 129227;


            smsCampaignApi.smsCampaignBySmsCampaignIdGet(smsCampaignId).then(function(response)
            {
              console.log(response.body);
            }).catch(function(err){
              console.error(err.body);
            });
        - lang: Ruby
          source: |-
            # load the gem
            require 'clicksend_client'
            require 'json'

            # setup authorization
            ClickSendClient.configure do |config|
              # Configure HTTP basic authorization: BasicAuth
              config.username = 'USERNAME'
              config.password = 'API_KEY'
            end

            api_instance = ClickSendClient::SmsCampaignApi.new

            sms_campaign_id = 56 # Integer | ID of SMS campaign to retrieve

            begin
              # Get specific sms campaign
              result = api_instance.sms_campaign_by_sms_campaign_id_get(sms_campaign_id)
              p JSON.parse(result)
            rescue ClickSendClient::ApiError => e
              puts "Exception when calling SmsCampaignApi->sms_campaign_by_sms_campaign_id_get: #{e.response_body}"
            end
        - lang: Python
          source: >-
            from __future__ import print_function

            import clicksend_client

            from clicksend_client.rest import ApiException


            # Configure HTTP basic authorization: BasicAuth

            configuration = clicksend_client.Configuration()

            configuration.username = 'USERNAME'

            configuration.password = 'API_KEY'


            # create an instance of the API class

            api_instance =
            clicksend_client.SmsCampaignApi(clicksend_client.ApiClient(configuration))

            sms_campaign_id = 119321 # int | ID of SMS campaign to retrieve


            try:
                # Get specific sms campaign
                api_response = api_instance.sms_campaign_by_sms_campaign_id_get(sms_campaign_id)
                print(api_response)
            except ApiException as e:
                print("Exception when calling SmsCampaignApi->sms_campaign_by_sms_campaign_id_get: %s\n" % e)
        - lang: perl
          source: >-
            use WWW::ClickSendClient::SmsCampaignApi;


            my $username = 'YOUR_API_USER_NAME';

            my $password = 'YOUR_API_PASSWORD';


            my $api = WWW::ClickSendClient::SmsCampaignApi->new(username =>
            $username, password => $password);


            my $json_output =
            $api->sms_campaign_by_sms_campaign_id_get('sms_campaign_id' =>
            '1234');


            print $json_output;
        - lang: objc
          source: >-
            #import "CSSmsCampaignApi.h"

            #import "CSDefaultConfiguration.h"


            CSDefaultConfiguration *apiConfig = [CSDefaultConfiguration
            sharedConfig];

            // Configure HTTP basic authorization (authentication scheme:
            BasicAuth)

            [apiConfig setUsername:@"USERNAME"];

            [apiConfig setPassword:@"PASSWORD"];


            CSSmsCampaignApi *smsCampaign = [[CSSmsCampaignApi alloc] init];

            [smsCampaign smsCampaignBySmsCampaignIdGetWithSmsCampaignId:@(1)
            completionHandler:^(NSString *output, NSError *error) {
                if (error) {
                    NSLog(@"Error: %@", error);
                } else {
                NSLog(@"%@", output);
                }
            }];
        - lang: swift
          source: >-
            import Alamofire

            if let authHeader = Request.authorizationHeader(user: "USERNAME",
            password: "PASSWORD") {
                ClickSendClientAPI.customHeaders = [authHeader.key : authHeader.value]
            }


            SmsCampaignAPI.smsCampaignBySmsCampaignIdGet(smsCampaignId: 1) {
            (dataString, error) in
                if let error = error {
                    print(error)
                } else {
                    if let data = dataString!.data(using: String.Encoding.utf8) {
                        do {
                            if let dictonary = try (JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary) {
                                print(dictonary)
                            } else {
                                print("Cannot convert the String value to JSON")
                            }
                        } catch let error as NSError {
                            print(error)
                        }
                    }
                }
            }
  /v3/sms-campaigns/{sms_campaign_id}/cancel:
    put:
      summary: Cancel SMS Campaign
      operationId: cancel-sms-campaign
      description: Use this endpoint to cancel a scheduled SMS campaign.
      security:
        - basicAuth: []
      parameters:
        - name: Content-Type
          in: header
          schema:
            type: string
          example: application/json
        - name: sms_campaign_id
          in: path
          description: ID of the scheduled SMS campaign to cancel.
          schema:
            type: string
          required: true
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/cancel-sms-campaign'
      x-codeSamples:
        - lang: curl
          source: >-
            curl --include \
                 --header "Authorization: Basic YXBpLXVzZXJuYW1lOmFwaS1wYXNzd29yZA=="  \
                 --request PUT \

            'https://rest.clicksend.com/v3/sms-campaigns/{sms_campaign_id}/cancel'
        - lang: PHP
          source: >-
            <?php

            require_once(__DIR__ . '/vendor/autoload.php');


            // Configure HTTP basic authorization: BasicAuth

            $config = ClickSend\Configuration::getDefaultConfiguration()
                          ->setUsername('USERNAME')
                          ->setPassword('API_KEY');

            $apiInstance = new ClickSend\Api\SmsCampaignApi(new
            GuzzleHttp\Client(),$config);

            $sms_campaign_id = 134574; // int | ID of SMS Campaign to cancel


            try {
                $result = $apiInstance->smsCampaignsCancelBySmsCampaignIdPut($sms_campaign_id);
                print_r($result);
            } catch (Exception $e) {
                echo 'Exception when calling SmsCampaignApi->smsCampaignsCancelBySmsCampaignIdPut: ', $e->getMessage(), PHP_EOL;
            }

            ?>
        - lang: C#
          source: >-
            using IO.ClickSend.ClickSend.Api;

            using IO.ClickSend.Client;

            using IO.ClickSend.ClickSend.Model;


            var configuration = new Configuration()

            {
                Username = USERNAME,
                Password = API_KEY  
            };

            var smsCampaignApi = new SmsCampaignApi(configuration);

            var response =
            smsCampaignApi.SmsCampaignsCancelBySmsCampaignIdPut(CAMPAIGN_ID);
        - lang: Java
          source: |-
            package ClickSend;

            import ClickSend.Api.SmsCampaignApi;

            public class cancel_sms_campaign {
              public static void main(String[] args) {
                ApiClient defaultClient = new ApiClient();
                defaultClient.setUsername("USERNAME");
                defaultClient.setPassword("API_KEY");
                SmsCampaignApi apiInstance = new SmsCampaignApi(defaultClient);
                Integer smsCampaignId = 121337; // Integer | ID of SMS Campaign to cancel
                try {
                    String result = apiInstance.smsCampaignsCancelBySmsCampaignIdPut(smsCampaignId);
                    System.out.println(result);
                } catch (ApiException e) {
                    System.err.println("Exception when calling SmsCampaignApi#smsCampaignsCancelBySmsCampaignIdPut");
                    e.printStackTrace();
                }
              }
            }
        - lang: Node.js
          source: >-
            var api = require('./api.js');


            var smsCampaignApi = new api.SmsCampaignApi("USERNAME", "API_KEY");


            var smsCampaignId = 129239;


            smsCampaignApi.smsCampaignsCancelBySmsCampaignIdPut(smsCampaignId).then(function(response)
            {
              console.log(response.body);
            }).catch(function(err){
              console.error(err.body);
            });
        - lang: Ruby
          source: |-
            # load the gem
            require 'clicksend_client'
            require 'json'

            # setup authorization
            ClickSendClient.configure do |config|
              # Configure HTTP basic authorization: BasicAuth
              config.username = 'USERNAME'
              config.password = 'API_KEY'
            end

            api_instance = ClickSendClient::SmsCampaignApi.new

            sms_campaign_id = 119007 # Integer | ID of SMS Campaign to cancel

            begin
              # Cancel sms campaign
              result = api_instance.sms_campaigns_cancel_by_sms_campaign_id_put(sms_campaign_id)
              p JSON.parse(result)
            rescue ClickSendClient::ApiError => e
              puts "Exception when calling SmsCampaignApi->sms_campaigns_cancel_by_sms_campaign_id_put: #{e.response_body}"
            end
        - lang: Python
          source: >-
            from __future__ import print_function

            import clicksend_client

            from clicksend_client.rest import ApiException


            # Configure HTTP basic authorization: BasicAuth

            configuration = clicksend_client.Configuration()

            configuration.username = 'USERNAME'

            configuration.password = 'API_KEY'


            # create an instance of the API class

            api_instance =
            clicksend_client.SmsCampaignApi(clicksend_client.ApiClient(configuration))

            sms_campaign_id = 119316 # int | ID of SMS Campaign to cancel


            try:
                # Cancel sms campaign
                api_response = api_instance.sms_campaigns_cancel_by_sms_campaign_id_put(sms_campaign_id)
                print(api_response)
            except ApiException as e:
                print("Exception when calling SmsCampaignApi->sms_campaigns_cancel_by_sms_campaign_id_put: %s\n" % e)
        - lang: perl
          source: >-
            use WWW::ClickSendClient::SmsCampaignApi;


            my $username = 'YOUR_API_USER_NAME';

            my $password = 'YOUR_API_PASSWORD';


            my $api = WWW::ClickSendClient::SmsCampaignApi->new(username =>
            $username, password => $password);


            my $json_output =
            $api->sms_campaigns_cancel_by_sms_campaign_id_put('sms_campaign_id'
            => '1234');


            print $json_output;
        - lang: objc
          source: >-
            #import "CSSmsCampaignApi.h"

            #import "CSDefaultConfiguration.h"


            CSDefaultConfiguration *apiConfig = [CSDefaultConfiguration
            sharedConfig];

            // Configure HTTP basic authorization (authentication scheme:
            BasicAuth)

            [apiConfig setUsername:@"USERNAME"];

            [apiConfig setPassword:@"PASSWORD"];


            CSSmsCampaignApi *smsCampaign = [[CSSmsCampaignApi alloc] init];

            [smsCampaign
            smsCampaignsCancelBySmsCampaignIdPutWithSmsCampaignId:@(1)
            completionHandler:^(NSString *output, NSError *error) {
                if (error) {
                    NSLog(@"Error: %@", error);
                } else {
                    NSLog(@"%@", output);
                }
            }];
        - lang: swift
          source: >-
            import Alamofire


            if let authHeader = Request.authorizationHeader(user: "USERNAME",
            password: "PASSWORD") {
                ClickSendClientAPI.customHeaders = [authHeader.key : authHeader.value]
            }


            SmsCampaignAPI.smsCampaignsCancelBySmsCampaignIdPut(smsCampaignId:
            1) { (dataString, error) in
                if let error = error {
                    print(error)
                } else {
                    if let data = dataString!.data(using: String.Encoding.utf8) {
                        do {
                            if let dictonary = try (JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary) {
                                print(dictonary)
                            } else {
                                print("Cannot convert the String value to JSON")
                            }
                        } catch let error as NSError {
                            print(error)
                        }
                    }
                }
            }
  /v3/sms-campaigns:
    get:
      summary: View SMS Campaigns
      operationId: view-sms-campaigns
      description: Use this endpoint to view SMS campaigns.
      security:
        - basicAuth: []
      parameters:
        - name: Content-Type
          in: header
          schema:
            type: string
          example: application/json
        - name: page
          in: query
          description: >-
            The page number to retrieve. Use this parameter to navigate through
            the [pagination]/#pagination) results. The default value is 1.
          schema:
            type: integer
            default: 1
            example: 1
        - name: limit
          in: query
          description: >-
            The number of items to return per page. This parameter controls the
            size of each page of results. The default value is 15.
          schema:
            type: integer
            minimum: 15
            maximum: 100
            default: 15
        - name: q
          in: query
          description: >-
            Allows filtering of results based on your search criteria. The query
            should be in the format `field_name:value`.


            1. **Field Name**: The field within the SMS campaign you want to
            filter by. You can use the following fields:

                - sms_campaign_id,name,user_id,subaccount_id,list_id,from,body,schedule,status,date_added,custom_string,url_to_shorten,unsubscribe_link,source


            2. **Value**: The text or keyword you're searching for within the
            specified field. If left empty after the colon, the filter will look
            for all templates with any value in the **Field Name**.


            For example, if you are searching for a SMS campaign with the status
            of _Scheduled_, the final query would look like this:

              - `q=status:Scheduled`

            <div class="info-box">
              <h4><i class="fas fa-info-circle"></i> Note:</h4>
              <p>
              Some characters have to be encoded. For example, if you are searching for SMS sent from the phone number +61437085284, your search query q would be:<br/>

              <ul>
                <li>q=from:%2B61437085284</li>
              </ul>

              You can use the <a href="https://www.urlencoder.org/" target="_blank">URL encoder</a> to encode the text. If a character is not an alphanumeric character (A-Z, a-z, 0-9), it is typically either reserved or unsafe and should be encoded.
              
              </p>
            </div>
          schema:
            type: string
        - name: order_by
          in: query
          description: >-
            Specifies the field and order to sort the results by. The value is
            composed of the field name followed by a colon and the sort
            direction (_asc_ for ascending or _desc_ for descending). 

            The default sort order is by _date_added_ in ascending order. You
            can use the following fields:

              - _name_: The name of the SMS campaign.
              - _status_: The status of the SMS campaign.
              - _schedule_: The schedule send date of the SMS campaign in the <a href="http://help.clicksend.com/what-is-a-unix-timestamp" target="_blank">Unix format</a>.
              - _from_: The sender of the SMS campaign.
              - _date_added_: This is the date you created or updated the SMS campaign in the <a href="http://help.clicksend.com/what-is-a-unix-timestamp" target="_blank">Unix format</a>.

            For example, if you want to order by the most recently sent or
            scheduled SMS, you should sort by date in descending order. The
            query would look like this:

              - `order_by=schedule:desc`

            <div class="info-box">
              <h4><i class="fas fa-info-circle"></i> Note:</h4>
              <p>
                You can also sort by these fields: <br/> 

              <ul>
                <li>sms_campaign_id,user_id,subaccount_id,list_id,body,custom_string,url_to_shorten,unsubscribe_link, and source.</li>
              </ul>
              <br/>
              But this is less common in practice.
              </p>
            </div>
          schema:
            type: string
        - name: date_from
          in: query
          description: >-
            Start date to filter results. It should be in <a
            href="http://help.clicksend.com/what-is-a-unix-timestamp"
            target="_blank">Unix format</a>.
          schema:
            type: integer
        - name: date_to
          in: query
          description: >-
            End date to filter results. It should be in <a
            href="http://help.clicksend.com/what-is-a-unix-timestamp"
            target="_blank">Unix format</a>.
          schema:
            type: integer
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/view-sms-campaigns'
      x-codeSamples:
        - lang: curl
          source: |-
            curl --include \
                 --header "Authorization: Basic YXBpLXVzZXJuYW1lOmFwaS1wYXNzd29yZA=="  \

            'https://rest.clicksend.com/v3/sms-campaigns'
        - lang: PHP
          source: >-
            <?php

            require_once(__DIR__ . '/vendor/autoload.php');


            // Configure HTTP basic authorization: BasicAuth

            $config = ClickSend\Configuration::getDefaultConfiguration()
                          ->setUsername('USERNAME')
                          ->setPassword('API_KEY');

            $apiInstance = new ClickSend\Api\SmsCampaignApi(new
            GuzzleHttp\Client(),$config);

            $page = 1; // int | Page number

            $limit = 10; // int | Number of records per page


            try {
                $result = $apiInstance->smsCampaignsGet($page, $limit);
                print_r($result);
            } catch (Exception $e) {
                echo 'Exception when calling SmsCampaignApi->smsCampaignsGet: ', $e->getMessage(), PHP_EOL;
            }

            ?>
        - lang: C#
          source: |-
            using IO.ClickSend.ClickSend.Api;
            using IO.ClickSend.Client;
            using IO.ClickSend.ClickSend.Model;

            var configuration = new Configuration()
            {
                Username = USERNAME,
                Password = API_KEY  
            };
            var smsCampaignApi = new SmsCampaignApi(configuration);
            var response = smsCampaignApi.SmsCampaignsGet();
        - lang: Java
          source: |-
            package ClickSend;

            import ClickSend.Api.SmsCampaignApi;

            public class view_all_sms_campaign {
              public static void main(String[] args) {
                ApiClient defaultClient = new ApiClient();
                defaultClient.setUsername("USERNAME");
                defaultClient.setPassword("API_KEY");
                SmsCampaignApi apiInstance = new SmsCampaignApi(defaultClient);
                Integer page = 1; // Integer | Page number
                Integer limit = 10; // Integer | Number of records per page
                try {
                    String result = apiInstance.smsCampaignsGet(page, limit);
                    System.out.println(result);
                } catch (ApiException e) {
                    System.err.println("Exception when calling SmsCampaignApi#smsCampaignsGet");
                    e.printStackTrace();
                }
              }
            }
        - lang: Node.js
          source: >-
            var api = require('./api.js');


            var smsCampaignApi = new api.SmsCampaignApi("USERNAME", "API_KEY");


            var page = 1;

            var limit = 10;


            smsCampaignApi.smsCampaignsGet(page, limit).then(function(response)
            {
              console.log(response.body);
            }).catch(function(err){
              console.error(err.body);
            });
        - lang: Ruby
          source: |-
            # load the gem
            require 'clicksend_client'
            require 'json'

            # setup authorization
            ClickSendClient.configure do |config|
              # Configure HTTP basic authorization: BasicAuth
              config.username = 'USERNAME'
              config.password = 'API_KEY'
            end

            api_instance = ClickSendClient::SmsCampaignApi.new

            opts = {
              page: 1,  # Integer | Page number
              limit: 10 # Integer | Number of records per page
            }

            begin
              # Get list of sms campaigns
              result = api_instance.sms_campaigns_get(opts)
              p JSON.parse(result)
            rescue ClickSendClient::ApiError => e
              puts "Exception when calling SmsCampaignApi->sms_campaigns_get: #{e.response_body}"
            end
        - lang: Python
          source: >-
            from __future__ import print_function

            import clicksend_client

            from clicksend_client.rest import ApiException


            # Configure HTTP basic authorization: BasicAuth

            configuration = clicksend_client.Configuration()

            configuration.username = 'USERNAME'

            configuration.password = 'API_KEY'


            # create an instance of the API class

            api_instance =
            clicksend_client.SmsCampaignApi(clicksend_client.ApiClient(configuration))

            page = 1 # int | Page number (optional) (default to 1)

            limit = 10 # int | Number of records per page (optional) (default to
            10)


            try:
                # Get list of sms campaigns
                api_response = api_instance.sms_campaigns_get(page=page, limit=limit)
                print(api_response)
            except ApiException as e:
                print("Exception when calling SmsCampaignApi->sms_campaigns_get: %s\n" % e)
        - lang: perl
          source: >-
            use WWW::ClickSendClient::SmsCampaignApi;


            my $username = 'YOUR_API_USER_NAME';

            my $password = 'YOUR_API_PASSWORD';


            my $api = WWW::ClickSendClient::SmsCampaignApi->new(username =>
            $username, password => $password);


            my $json_output = $api->sms_campaigns_get('page' => '1','limit' =>
            '30');


            print $json_output;
        - lang: objc
          source: >-
            #import "CSSmsCampaignApi.h"

            #import "CSDefaultConfiguration.h"


            CSDefaultConfiguration *apiConfig = [CSDefaultConfiguration
            sharedConfig];

            // Configure HTTP basic authorization (authentication scheme:
            BasicAuth)

            [apiConfig setUsername:@"USERNAME"];

            [apiConfig setPassword:@"PASSWORD"];


            CSSmsCampaignApi *smsCampaign = [[CSSmsCampaignApi alloc] init];

            [smsCampaign smsCampaignsGetWithPage:@(1) limit:@(15)
            completionHandler:^(NSString *output, NSError *error) {
                if (error) {
                    NSLog(@"Error: %@", error);
                } else {
                    NSLog(@"%@", output);
                }
            }];
        - lang: swift
          source: >-
            import Alamofire

            if let authHeader = Request.authorizationHeader(user: "USERNAME",
            password: "PASSWORD") {
                ClickSendClientAPI.customHeaders = [authHeader.key : authHeader.value]
            }


            SmsCampaignAPI.smsCampaignsGet(page: 1, limit: 15) { (dataString,
            error) in
                if let error = error {
                    print(error)
                } else {
                    if let data = dataString!.data(using: String.Encoding.utf8) {
                        do {
                            if let dictonary = try (JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary) {
                                print(dictonary)
                            } else {
                                print("Cannot convert the String value to JSON")
                            }
                        } catch let error as NSError {
                            print(error)
                        }
                    }
                }
            }
