openapi: 3.0.0
info:
  title: International Messaging
  description: Endpoints associated with creating and managing user accounts.
servers:
  - url: https://rest.clicksend.com
components:
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
  schemas:
    global_sending:
      type: object
      properties:
        id:
          type: integer
          description: The ID of the country.
          example: 1
        name:
          type: string
          description: The name of the country.
          example: Australia
        code:
          type: string
          description: The country code.
          example: AU
        region:
          type: string
          description: The region of the country.
          example: Oceania
        agreed_at:
          type: string
          nullable: true
          description: The date when the country was agreed upon.
          example: null
        registration_entity:
          type: string
          nullable: true
          description: The entity responsible for the registration.
          example: null
        registration_status:
          type: object
          properties:
            id:
              type: integer
              description: The ID of the registration status.
              example: 1
            name:
              type: string
              description: The name of the registration status.
              example: NOT_INITIATED
        jotform_id:
          type: string
          description: The ID of the country in JotForm.
          example: '12345'
        sms_registration_type:
          type: integer
          description: The type of SMS registration.
          example: 0
        block_registration:
          type: integer
          description: Indicates if registration is blocked.
          example: 0
        block_leads:
          type: integer
          description: Indicates if leads are blocked.
          example: 0
        trial_from_address:
          type: string
          description: The trial from address.
          example: ''
        restricted_sending:
          type: integer
          description: Indicates if sending is restricted.
          example: 0
        trial_sending:
          type: integer
          description: Indicates if trial sending is allowed.
          example: 0
        trial_sending_description:
          type: string
          description: Description of trial sending.
          example: ''
        has_regulation_requirements:
          type: integer
          description: Indicates if there are regulation requirements.
          example: 0
        registration_steps_url:
          type: string
          description: URL for registration steps.
          example: https://clicksend.helpdocs.com
        regulation_requirements_description:
          type: string
          description: Description of regulation requirements.
          example: >-
            You can only send from a Dedicated ShortCode. Marketing Messages
            must be sent from a zero-rated shortcode. Messages must comply with
            DIA guidelines including opt-in consent and a way to opt-out.
            https://help.clicksend.com/article/7ifkmw5vd5-australia%22
    get-countries-for-global-sending:
      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 are your countries selection.
        data:
          type: array
          items:
            $ref: '#/components/schemas/global_sending'
    select-countries-for-global-sending:
      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 are your countries selection.
        data:
          type: array
          items:
            $ref: '#/components/schemas/global_sending'
    agree-to-rules-and-regulation:
      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 are your countries selection.
        data:
          type: array
          items:
            $ref: '#/components/schemas/global_sending'
    list-countries:
      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: List of Countries.
        data:
          type: array
          items:
            type: object
            properties:
              id:
                type: integer
                description: The id of the country.
                example: 1
              name:
                type: string
                description: The name of the country.
                example: Australia
              code:
                type: string
                description: The code of the country.
                example: AU
              region:
                type: string
                description: The region of the country.
                example: Oceania
    country:
      type: object
      properties:
        code:
          type: string
          description: The country code.
          example: AU
        value:
          type: string
          description: The country name.
          example: Australia
    view-countries:
      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: List of Countries.
        data:
          type: array
          items:
            $ref: '#/components/schemas/country'
          example:
            - code: AF
              value: Afghanistan
            - code: AU
              value: Australia
            - code: FI
              value: Finland
    timezones:
      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: List of timezones.
        data:
          type: array
          items:
            type: string
          example:
            - Africa/Abidjan
            - Africa/Accra
            - Africa/Addis_Ababa
            - Africa/Algiers
            - Africa/Asmara
            - Africa/Asmera
            - Africa/Bamako
            - Africa/Bangui
            - Africa/Banjul
            - Africa/Bissau
            - Africa/Blantyre
            - Africa/Brazzaville
            - Africa/Bujumbura
            - Africa/Cairo
            - Africa/Casablanca
            - Africa/Ceuta
            - Africa/Conakry
            - Africa/Dakar
            - Africa/Dar_es_Salaam
            - Africa/Djibouti
            - etc...
paths:
  /v3/user-countries:
    post:
      summary: Select Countries for Global Sending
      operationId: select-countries-for-global-sending
      description: >-
        _Select Countries_


        Use this endpoint to select countries that you intend to send sms / mms
        to. To remove / unselect a country, just remove the country id from the
        array in the payload.


        ### Properties


        | Name | Type | Required | Restrictions | Description |

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

        | country_list_ids | number | true | none | Country list ID's |



        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:
                country_list_ids:
                  type: array
                  items:
                    type: integer
              example:
                country_list_ids:
                  - 1
      security:
        - basicAuth: []
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/select-countries-for-global-sending'
      x-codeSamples:
        - lang: curl
          source: >-
            curl --location --request POST
            'https://rest.clicksend.com/v3/user-countries' \

            --header 'Content-Type: application/json' \

            --header 'Authorization: Bearer
            YXBpLXVzZXJuYW1lOmFwaS1wYXNzd29yZA==' \

            --data '{
              "country_list_ids": [1, 2]
            }'
    get:
      summary: Get Countries for Global Sending
      operationId: get-countries-for-global-sending
      description: >-
        _Get Countries for global sending_


        Get the list of selected countries.


        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>
      security:
        - basicAuth: []
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/get-countries-for-global-sending'
      x-codeSamples:
        - lang: curl
          source: >-
            curl --location 'https://rest.clicksend.com/v3/user-countries' \

            --header 'Authorization: Bearer
            YXBpLXVzZXJuYW1lOmFwaS1wYXNzd29yZA==' \
  /v3/user-countries/agree:
    post:
      summary: Agree to rules and regulation
      operationId: agree-to-rules-and-regulation
      description: >-
        _Update Country Rule_


        To agree on rules and regulations of selected countries and confirm
        selection.


        ### Properties


        | Name | Type | Required | Restrictions | Description |

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

        | country_list_ids | number | true | none | Country list ID's |



        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: {}
      security:
        - basicAuth: []
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/agree-to-rules-and-regulation'
      x-codeSamples:
        - lang: curl
          source: >-
            curl --location --request POST
            'https://rest.clicksend.com/v3/user-countries/agree' \

            --header 'Content-Type: application/json' \

            --header 'Authorization: Bearer
            YXBpLXVzZXJuYW1lOmFwaS1wYXNzd29yZA==' \
  /v3/country-list:
    get:
      summary: International Messaging
      operationId: list-countries
      description: >-
        _List of countries_


        List of countries with IDs that can be used in selecting countries for
        Global sending.


        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>
      security:
        - basicAuth: []
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/list-countries'
      x-codeSamples:
        - lang: curl
          source: >-
            curl --location 'https://rest.clicksend.com/v3/country-list' \

            --header 'Authorization: Bearer
            YXBpLXVzZXJuYW1lOmFwaS1wYXNzd29yZA==' \
  /v3/countries:
    get:
      summary: View Countries
      operationId: view-countries
      description: >-
        _Get all country codes_


        Get all countries



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



        <div style="background-color: #6BBD5B; padding: 10px; border-radius:
        8px;">
          <span style="color: white;">This endpoint does not require authentication</span> 
        </div>
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/view-countries'
      x-codeSamples:
        - lang: curl
          source: |-
            curl --include \
            'https://rest.clicksend.com/v3/countries'
        - lang: PHP
          source: >-
            <?php

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


            $apiInstance = new ClickSend\Api\CountriesApi(new
            GuzzleHttp\Client());


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

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

            var countriesApi = new CountriesApi(Configuration.Default);
            var response = countriesApi.CountriesGet();
        - lang: Java
          source: |-
            package ClickSend;

            import ClickSend.Api.CountriesApi;

            public class view_countries {
              public static void main(String[] args) {
                CountriesApi apiInstance = new CountriesApi();
                try {
                    String result = apiInstance.countriesGet();
                    System.out.println(result);
                } catch (ApiException e) {
                    System.err.println("Exception when calling CountriesApi#countriesGet");
                    e.printStackTrace();
                }
              }
            }
        - lang: Node.js
          source: |-
            var api = require('./api.js');

            var countriesApi = new api.CountriesApi();

            countriesApi.countriesGet().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'

            api_instance = ClickSendClient::CountriesApi.new

            begin
              # Get all country codes
              result = api_instance.countries_get
              p JSON.parse(result)
            rescue ClickSendClient::ApiError => e
              puts "Exception when calling CountriesApi->countries_get: #{e.response_body}"
            end
        - lang: Python
          source: |-
            from __future__ import print_function
            import clicksend_client
            from clicksend_client.rest import ApiException

            # create an instance of the API class
            api_instance = clicksend_client.CountriesApi()

            try:
                # Get all country codes
                api_response = api_instance.countries_get()
                print(api_response)
            except ApiException as e:
                print("Exception when calling CountriesApi->countries_get: %s\n" % e)
        - lang: perl
          source: >-
            use WWW::ClickSendClient::CountriesApi;


            my $username = 'YOUR_API_USER_NAME';

            my $password = 'YOUR_API_PASSWORD';


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


            my $json_output = $api->countries_get();


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


            CSDefaultConfiguration *apiConfig = [CSDefaultConfiguration
            sharedConfig];

            [apiConfig setUsername:@"USERNAME"];

            [apiConfig setPassword:@"PASSWORD"];


            CSCountriesApi *countriesApi = [[CSCountriesApi alloc] init];

            [countriesApi countriesGetWithCompletionHandler:^(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]
            }

            CountriesAPI.countriesGet { (dataString, error) in
                guard let dataString = dataString else {
                    print(error!)
                    return
                }
                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/timezones:
    get:
      summary: Timezones
      operationId: timezones
      description: >-
        _Get supported list of timezones._


        Get supported list of timezones.


        ### Parameters


        | Parameter | In | Type | Required | Description |

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

        | page | query | integer(int32) | false | Page number |

        | limit | query | integer(int32) | false | Number of records per page |



        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>
      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/timezones'
      x-codeSamples:
        - lang: curl
          source: |-
            curl --include \
                 --header "Authorization: Basic YXBpLXVzZXJuYW1lOmFwaS1wYXNzd29yZA=="  \
            'https://rest.clicksend.com/v3/timezones'
        - 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\TimezonesApi(new
            GuzzleHttp\Client(),$config);

            $page = 1; // int | Page number

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


            try {
                $result = $apiInstance->timezonesGet($page, $limit);
                print_r($result);
            } catch (Exception $e) {
                echo 'Exception when calling TimezonesApi->timezonesGet: ', $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 timezonesApi = new TimezonesApi(configuration);
            var response = timezonesApi.TimezonesGet();
        - lang: Java
          source: |
            package ClickSend;

            import ClickSend.Api.TimezonesApi;

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

            var timezonesApi = new api.TimezonesApi("USERNAME", "API_KEY");

            var page = 1;
            var limit = 10;

            timezonesApi.timezonesGet(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::TimezonesApi.new

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

            begin
              # Get supported list of timezones.
              result = api_instance.timezones_get(opts)
              p JSON.parse(result)
            rescue ClickSendClient::ApiError => e
              puts "Exception when calling TimezonesApi->timezones_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.TimezonesApi(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 supported list of timezones.
                api_response = api_instance.timezones_get(page=page, limit=limit)
                print(api_response)
            except ApiException as e:
                print("Exception when calling TimezonesApi->timezones_get: %s\n" % e)
        - lang: perl
          source: >-
            use WWW::ClickSendClient::TimezonesApi;


            my $username = 'YOUR_API_USER_NAME';

            my $password = 'YOUR_API_PASSWORD';


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


            my $json_output = $api->timezones_get('page'  => '1','limit' =>
            '10');


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

            #import "CSTimeZonesApi.h"


            CSDefaultConfiguration *apiConfig = [CSDefaultConfiguration
            sharedConfig];

            [apiConfig setUsername:@"USERNAME"];

            [apiConfig setPassword:@"PASSWORD"];


            NSNumber *page = [[NSNumber alloc] initWithInt:1];

            NSNumber*limit = [[NSNumber alloc] initWithInt:15];


            CSTimezonesApi *timeZonesApiInstance = [[CSTimezonesApi alloc]
            init];

            [timeZonesApiInstance timezonesGetWithPage:page limit:limit
            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]
            }

            TimezonesAPI.timezonesGet(page: 1, limit: 15) { (dataString, error)
            in
                guard let dataString = dataString else {
                    print(error!)
                    return
                }
                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)
                    }
                }
            }
