openapi: 3.0.0
info:
  title: Subaccounts
  description: Everything about Subaccounts.
servers:
  - url: https://rest.clicksend.com
components:
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
  schemas:
    subaccount:
      type: object
      properties:
        subaccount_id:
          type: integer
          description: The unique identifier for the subaccount.
          example: 126
        api_username:
          type: string
          description: The API username of the subaccount.
          example: johndoe1
        email:
          type: string
          format: email
          description: The email address of the subaccount.
          example: johndoe1@awesome.com
        phone_number:
          type: string
          description: The phone number of the subaccount.
          example: '+15184811001'
        first_name:
          type: string
          description: The first name of the subaccount.
          example: John
        last_name:
          type: string
          description: The last name of the subaccount.
          example: Doe
        api_key:
          type: string
          description: The API key of the subaccount.
          example: F3702045-EB2C-0091-C211-7728048DCAE2
        access_users:
          type: integer
          description: Flag indicating if the subaccount has access to users.
          example: 1
        access_billing:
          type: integer
          description: Flag indicating if the subaccount has access to billing.
          example: 1
        access_reporting:
          type: integer
          description: Flag indicating if the subaccount has access to reporting.
          example: 1
        access_contacts:
          type: integer
          description: Flag indicating if the subaccount has access to contacts.
          example: 1
        access_settings:
          type: integer
          description: Flag indicating if the subaccount has access to settings.
          example: 1
        access_sms:
          type: integer
          description: Flag indicating if the subaccount has access to SMS.
          example: 1
        access_email:
          type: integer
          description: Flag indicating if the subaccount has access to email.
          example: 1
        access_voice:
          type: integer
          description: Flag indicating if the subaccount has access to voice services.
          example: 1
        access_fax:
          type: integer
          description: Flag indicating if the subaccount has access to fax services.
          example: 1
        access_post:
          type: integer
          description: Flag indicating if the subaccount has access to post services.
          example: 1
        access_reseller:
          type: integer
          description: Flag indicating if the subaccount has access to reseller services.
          example: 1
        access_mms:
          type: integer
          description: Flag indicating if the subaccount has access to MMS services.
          example: 1
        share_campaigns:
          type: integer
          description: Flag indicating if the subaccount can share campaigns.
          example: 0
        notes:
          type: string
          nullable: true
          description: Additional notes for the subaccount.
          example: null
    view-subaccounts:
      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: SUCCESS
        data:
          type: array
          items:
            $ref: '#/components/schemas/subaccount'
    create-subaccount:
      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: New account has been created.
        data:
          $ref: '#/components/schemas/subaccount'
    view-specific-subaccount:
      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 data.
        data:
          $ref: '#/components/schemas/subaccount'
    update-subaccount:
      type: object
      properties:
        http_code:
          type: integer
          description: The HTTP status code of the response.
        response_code:
          type: string
          description: The response code indicating the status of the operation.
        response_msg:
          type: string
          description: A message describing the outcome of the operation.
        data:
          $ref: '#/components/schemas/subaccount'
      example:
        http_code: 200
        response_code: SUCCESS
        response_msg: 'Subaccount #59 has been updated.'
        data:
          subaccount_id: 59
          api_username: nameP99
          email: testfP0.updated@gmail.com
          phone_number: '+619417513065'
          first_name: FirstnameKvdRZ Updated
          last_name: LastnameHUPYG Updated
          api_key: 367C506E-FBCA-1EDA-E8E0-1384F9F196D5
          access_users: 1
          access_billing: 1
          access_reporting: 1
          access_contacts: 1
          access_settings: 1
          access_sms: 1
          access_email: 1
          access_voice: 1
          access_fax: 1
          access_post: 1
          access_reseller: 1
          access_mms: 1
          share_campaigns: 0
          notes: null
    delete-subaccount:
      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: 'Subaccount #59 has been deleted'
        data:
          type: boolean
          description: The status of the operation.
          example: true
    generate-new-api-key:
      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 API Key has been regenerated.
        data:
          type: object
          properties:
            api_key:
              type: string
              example: E72D09F6-AC80-0A5C-F7F0-1A244A377A5C
              description: The new API key
paths:
  /v3/subaccounts:
    get:
      summary: View Subaccounts
      operationId: view-subaccounts
      description: >-
        _Get all subaccounts_


        ### Parameters


        | Parameter | In | Type | Required | Description |

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

        | page | query | integer(int32) | false | [Page
        number](https://developers.clicksend.com/docs/rest/v3/#pagination) |

        | limit | query | integer(int32) | false | [Number of records per
        page](https://developers.clicksend.com/docs/rest/v3/#pagination) |



        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/view-subaccounts'
      x-codeSamples:
        - lang: curl
          source: |-
            curl --include \
                 --header "Authorization: Basic YXBpLXVzZXJuYW1lOmFwaS1wYXNzd29yZA=="  \

            'https://rest.clicksend.com/v3/subaccounts'
        - 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\SubaccountApi(new
            GuzzleHttp\Client(),$config);

            $page = 1; // int | Page number

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


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

            import ClickSend.Api.SubaccountApi;

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

            var subaccountApi = new api.SubaccountApi("USERNAME", "API_KEY");

            var page = 1;
            var limit = 10;

            subaccountApi.subaccountsGet(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::SubaccountApi.new

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

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


            my $username = 'YOUR_API_USER_NAME';

            my $password = 'YOUR_API_PASSWORD';


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


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


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

            #import "CSDefaultConfiguration.h"


            CSDefaultConfiguration *apiConfig = [CSDefaultConfiguration
            sharedConfig];

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

            [apiConfig setUsername:@"USERNAME"];

            [apiConfig setPassword:@"PASSWORD"];


            CSSubaccountApi *subaccountApi = [[CSSubaccountApi alloc] init];

            [subaccountApi subaccountsGetWithPage:@(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]
            }


            SubaccountAPI.subaccountsGet { (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)
                        }
                    }
                }
            }
    post:
      summary: Create Subaccount
      operationId: create-subaccount
      description: >-
        _Create new subaccount_


        ### Properties


        | Name | Type | Required | Restrictions | Description |

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

        | api_username | string | true | none | Your new api username. |

        | password | string | true | none | Your new password |

        | email | string | true | none | Your new email. |

        | phone_number | string | true | none | Your phone number in
        [E.164](https://en.wikipedia.org/wiki/E.164) format. |

        | first_name | string | true | none | Your firstname |

        | last_name | string | true | none | Your lastname |

        | access_users | integer(int1) | false | none | Flag value must be 1 for
        yes or 0 for no. |

        | access_billing | integer(int1) | false | none | Flag value must be 1
        for yes or 0 for no. |

        | access_reporting | integer(int1) | false | none | Flag value must be 1
        for yes or 0 for no. |

        | access_contacts | integer(int1) | false | none | Flag value must be 1
        for yes or 0 for no. |

        | access_settings | integer(int1) | false | none | Flag value must be 1
        for yes or 0 for no. |


        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:
                api_username:
                  type: string
                password:
                  type: string
                email:
                  type: string
                phone_number:
                  type: string
                first_name:
                  type: string
                last_name:
                  type: string
                user_id:
                  type: integer
                sms_deidentify_message:
                  type: integer
                access_smpp:
                  type: integer
                access_users:
                  type: integer
                access_billing:
                  type: integer
                access_reporting:
                  type: integer
                access_contacts:
                  type: integer
                access_settings:
                  type: integer
                notes:
                  type: string
              example:
                api_username: test
                password: test123
                email: test@test.com
                phone_number: '+61411111111'
                first_name: John
                last_name: Doe
                user_id: 3839
                sms_deidentify_message: 0
                access_smpp: 0
                access_users: 1
                access_billing: 1
                access_reporting: 1
                access_contacts: 1
                access_settings: 1
                notes: these are test notes
      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/create-subaccount'
      x-codeSamples:
        - lang: curl
          source: |-
            curl --include \
                 --header "Authorization: Basic YXBpLXVzZXJuYW1lOmFwaS1wYXNzd29yZA=="  \
                 --request POST \
                 --header "Content-Type: application/json" \

                 --data-binary "    {
                    \"api_username\":\"nameP99\",
                    \"password\":\"pass\",
                    \"email\":\"testvrq@gmail.com\",
                    \"phone_number\":\"941-751-3278\",
                    \"first_name\":\"FirstnameeGPqV\",
                    \"last_name\":\"LastnamePvjJp\"
                }" \
            'https://rest.clicksend.com/v3/subaccounts'
        - 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\SubaccountApi(new
            GuzzleHttp\Client(),$config);

            $subaccount = new \ClickSend\Model\Subaccount(); //
            \ClickSend\Model\Subaccount | Subaccount model

            $subaccount->setApiUsername("name");

            $subaccount->setPassword("pwd");

            $subaccount->setEmail("xxx@gmail.com");

            $subaccount->setPhoneNumber("xxx-xxx-xxxx");

            $subaccount->setFirstName("first");

            $subaccount->setLastName("last");


            try {
                $result = $apiInstance->subaccountsPost($subaccount);
                print_r($result);
            } catch (Exception $e) {
                echo 'Exception when calling SubaccountApi->subaccountsPost: ', $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 subaccountApi = new SubaccountApi(configuration);
            var response = subaccountApi.SubaccountsPost(new Subaccount(
                apiUsername: "username",
                password: "password",
                email: "john@doe.com",
                phoneNumber: "+11231231234",
                firstName: "John",
                lastName: "Doe",
                accessBilling: 1,
                accessContacts: 1,
                accessUsers: 1,
                accessReporting: 1,
                accessSettings: 1
            ));
        - lang: Java
          source: |-
            package ClickSend;

            import ClickSend.Api.SubaccountApi;
            import ClickSend.Model.Subaccount;

            public class create_subaccount {
              public static void main(String[] args) {
                ApiClient defaultClient = new ApiClient();
                defaultClient.setUsername("USERNAME");
                defaultClient.setPassword("API_KEY");
                SubaccountApi apiInstance = new SubaccountApi(defaultClient);
                Subaccount subaccount = new Subaccount(); // Subaccount | Subaccount model
                subaccount.apiUsername("testing");
                subaccount.password("pass");
                subaccount.email("xxx@gmail.com");
                subaccount.phoneNumber("000-000-0000");
                subaccount.firstName("test");
                subaccount.lastName("test");
                subaccount.accessUsers(new Integer(1));
                subaccount.accessBilling(new Integer(1));
                subaccount.accessReporting(new Integer(1));
                subaccount.accessContacts(new Integer(1));
                subaccount.accessSettings(new Integer(1));
                try {
                    String result = apiInstance.subaccountsPost(subaccount);
                    System.out.println(result);
                } catch (ApiException e) {
                    System.err.println("Exception when calling SubaccountApi#subaccountsPost");
                    e.printStackTrace();
                }
              }
            }
        - lang: Node.js
          source: |-
            var api = require('./api.js');

            var subaccountApi = new api.SubaccountApi("USERNAME", "API_KEY");

            var subaccount = new api.Subaccount();

            subaccount.apiUsername = "apiUsername";
            subaccount.password = "pass";
            subaccount.email = "xxx@gmail.com";
            subaccount.phoneNumber = "xxx-xxx-xxxx";
            subaccount.firstName = "firstName";
            subaccount.lastName = "lastName";
            subaccount.accessUsers = 1;
            subaccount.accessBilling = 1;
            subaccount.accessReporting = 1;
            subaccount.accessContacts = 1;
            subaccount.accessSettings = 1;

            subaccountApi.subaccountsPost(subaccount).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::SubaccountApi.new

            # Subaccount | Subaccount model
            subaccount = ClickSendClient::Subaccount.new(
              "api_username": "api_username",
              "access_billing": 1,
              "password": "password",
              "access_reporting": 1,
              "access_settings": 1,
              "access_users": 1,
              "access_contacts": 0,
              "last_name": "last_name",
              "phone_number": "phone_number",
              "first_name": "first_name",
              "email": "email"
            )

            begin
              # Create new subaccount
              result = api_instance.subaccounts_post(subaccount)
              p JSON.parse(result)
            rescue ClickSendClient::ApiError => e
              puts "Exception when calling SubaccountApi->subaccounts_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.SubaccountApi(clicksend_client.ApiClient(configuration))

            # Subaccount | Subaccount model

            subaccount = clicksend_client.Subaccount(
                api_username="username",
                password="password",
                email="xxx@gmail.com",
                phone_number="000-000-0000",
                first_name="Firstnamee",
                last_name="Lastname",
                access_users=1,
                access_billing=1,
                access_reporting=1,
                access_contacts=1,
                access_settings=1) 

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

            use WWW::ClickSendClient::Object::Subaccount;


            my $username = 'YOUR_API_USER_NAME';

            my $password = 'YOUR_API_PASSWORD';


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


            my %params = (
                'api_username'     => 'api_username',
                'access_billing'   => 1,
                'password'         => 'password',
                'access_reporting' => 1,
                'access_settings'  => 1,
                'access_users'     => 1,
                'access_contacts'  => 0,
                'last_name'        => 'last_name',
                'phone_number'     => 'phone_number',
                'first_name'       => 'first_name',
                'email'            => 'test1@test.com'
            );


            my $subaccount_obj =
            WWW::ClickSendClient::Object::Subaccount->new(%params);

            my $json_output = $api->subaccounts_post('subaccount' =>
            $subaccount_obj);


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

            #import "CSDefaultConfiguration.h"


            CSDefaultConfiguration *apiConfig = [CSDefaultConfiguration
            sharedConfig];

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

            [apiConfig setUsername:@"USERNAME"];

            [apiConfig setPassword:@"PASSWORD"];


            CSSubaccount *subaccount = [[CSSubaccount alloc] init];

            subaccount.apiUsername = @"api_username";

            subaccount.password = @"password";

            subaccount.email = @"johndoe@gmail.com";

            subaccount.phoneNumber = @"+639772549340";

            subaccount.firstName = @"firstname";

            subaccount.lastName = @"lastname";

            subaccount.accessUsers = @(1);

            subaccount.accessBilling = @(1);

            subaccount.accessReporting = @(1);

            subaccount.accessContacts = @(1);

            subaccount.accessSettings = @(1);


            CSSubaccountApi *subaccountApi = [[CSSubaccountApi alloc] init];

            [subaccountApi subaccountsPostWithSubaccount:subaccount
            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 subaccount = Subaccount(
                                apiUsername: "api_username", 
                                password: "password", 
                                email: "johndoe@gmail.com", 
                                phoneNumber: "+639772549340", 
                                firstName: "first_name", 
                                lastName: "last_name", 
                                accessUsers: 1, 
                                accessBilling: 1, 
                                accessReporting: 1, 
                                accessContacts: 1, 
                                accessSettings: 1
                            )

            SubaccountAPI.subaccountsPost(subaccount: subaccount) { (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/subaccounts/{subaccount_id}:
    get:
      summary: View Specific Subaccount
      operationId: view-specific-subaccount
      description: >-
        _Get specific subaccount_


        ### Parameters


        | Parameter | In | Type | Required | Description |

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

        | subaccount_id | path | integer(int32) | true | ID of subaccount to get
        |



        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
        - name: subaccount_id
          in: path
          schema:
            type: string
          required: true
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/view-specific-subaccount'
      x-codeSamples:
        - lang: curl
          source: |-
            curl --include \
                 --header "Authorization: Basic YXBpLXVzZXJuYW1lOmFwaS1wYXNzd29yZA=="  \

            'https://rest.clicksend.com/v3/subaccounts/{subaccount_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\SubaccountApi(new
            GuzzleHttp\Client(),$config);

            $subaccount_id = 74275; // int | ID of subaccount to get


            try {
                $result = $apiInstance->subaccountsBySubaccountIdGet($subaccount_id);
                print_r($result);
            } catch (Exception $e) {
                echo 'Exception when calling SubaccountApi->subaccountsBySubaccountIdGet: ', $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 subaccountApi = new SubaccountApi(configuration);

            var response =
            subaccountApi.SubaccountsBySubaccountIdGet(SUB_ACCOUNT_ID);
        - lang: Java
          source: |
            package ClickSend;

            import ClickSend.Api.SubaccountApi;

            public class view_specific_subaccount {
               public static void main(String[] args) {
                  ApiClient defaultClient = new ApiClient();
                  defaultClient.setUsername("USERNAME");
                  defaultClient.setPassword("API_KEY");
                  SubaccountApi apiInstance = new SubaccountApi(defaultClient);
                  Integer subaccountId = 77547; // Integer | ID of subaccount to get
                  try {
                      String result = apiInstance.subaccountsBySubaccountIdGet(subaccountId);
                      System.out.println(result);
                  } catch (ApiException e) {
                      System.err.println("Exception when calling SubaccountApi#subaccountsBySubaccountIdGet");
                      e.printStackTrace();
                  }
               }
            }
        - lang: Node.js
          source: >-
            var api = require('./api.js');


            var subaccountApi = new api.SubaccountApi("USERNAME", "API_KEY");


            var subaccountId = 80018;


            subaccountApi.subaccountsBySubaccountIdGet(subaccountId).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::SubaccountApi.new

            subaccount_id = 56 # Integer | ID of subaccount to get

            begin
              # Get specific subaccount
              result = api_instance.subaccounts_by_subaccount_id_get(subaccount_id)
              p JSON.parse(result)
            rescue ClickSendClient::ApiError => e
              puts "Exception when calling SubaccountApi->subaccounts_by_subaccount_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.SubaccountApi(clicksend_client.ApiClient(configuration))

            subaccount_id = 75094 # int | ID of subaccount to get


            try:
                # Get specific subaccount
                api_response = api_instance.subaccounts_by_subaccount_id_get(subaccount_id)
                print(api_response)
            except ApiException as e:
                print("Exception when calling SubaccountApi->subaccounts_by_subaccount_id_get: %s\n" % e)
        - lang: perl
          source: >-
            use WWW::ClickSendClient::SubaccountApi;


            my $username = 'YOUR_API_USER_NAME';

            my $password = 'YOUR_API_PASSWORD';


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


            my $json_output =
            $api->subaccounts_by_subaccount_id_get('subaccount_id' => '1234');


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

            #import "CSDefaultConfiguration.h"


            CSDefaultConfiguration *apiConfig = [CSDefaultConfiguration
            sharedConfig];

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

            [apiConfig setUsername:@"USERNAME"];

            [apiConfig setPassword:@"PASSWORD"];


            CSSubaccountApi *subaccountApi = [[CSSubaccountApi alloc] init];

            [subaccountApi subaccountsBySubaccountIdGetWithSubaccountId:@(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]
            }



            SubaccountAPI.subaccountsBySubaccountIdGet(subaccountId: 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)
                        }
                    }
                }
            }
    put:
      summary: Update Subaccount
      operationId: update-subaccount
      description: >-
        _Update subaccount_


        ### Parameters


        | Parameter | In | Type | Required | Description |

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

        | subaccount_id | path | integer(int32) | true | ID of subaccount to
        update |


        ### Properties


        | Name | Type | Required | Restrictions | Description |

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

        | api_username | string | true | none | Your new api username. |

        | password | string | true | none | Your new password |

        | email | string | true | none | Your new email. |

        | phone_number | string | true | none | Your phone number in
        [E.164](https://en.wikipedia.org/wiki/E.164) format. |

        | first_name | string | true | none | Your firstname |

        | last_name | string | true | none | Your lastname |

        | access_users | integer(int1) | false | none | Flag value must be 1 for
        yes or 0 for no. |

        | access_billing | integer(int1) | false | none | Flag value must be 1
        for yes or 0 for no. |

        | access_reporting | integer(int1) | false | none | Flag value must be 1
        for yes or 0 for no. |

        | access_contacts | integer(int1) | false | none | Flag value must be 1
        for yes or 0 for no. |

        | access_settings | integer(int1) | false | none | Flag value must be 1
        for yes or 0 for no. |



        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:
                access_sms:
                  type: integer
                email:
                  type: string
              example:
                access_sms: 1
                email: '{{email}}'
      security:
        - basicAuth: []
      parameters:
        - name: Content-Type
          in: header
          schema:
            type: string
          example: application/json
        - name: subaccount_id
          in: path
          schema:
            type: string
          required: true
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/update-subaccount'
      x-codeSamples:
        - lang: curl
          source: |-
            curl --include \
                 --header "Authorization: Basic YXBpLXVzZXJuYW1lOmFwaS1wYXNzd29yZA=="  \
                 --request PUT \
                 --header "Content-Type: application/json" \

                 --data-binary "    {
                    \"password\":\"pass\",
                    \"email\":\"testfP0.updated@gmail.com\",
                    \"phone_number\":\"+19417519130\",
                    \"first_name\":\"FirstnameKvdRZUpdated\",
                    \"last_name\":\"LastnameHUPYGUpdated\",
                    \"access_users\": 1,
                    \"access_billing\": 1,
                    \"access_reporting\": 1,
                    \"access_contacts\": 1,
                    \"access_settings\": 1,
                    \"access_sms\": 1,
                    \"access_email\": 1,
                    \"access_voice\": 1,
                    \"access_fax\": 1,
                    \"access_post\": 1,
                    \"access_reseller\": 1,
                    \"access_mms\": 1,
                    \"share_campaigns\": 0,
                    \"notes\": null
                }" \
            'https://rest.clicksend.com/v3/subaccounts/{subaccount_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\SubaccountApi(new
            GuzzleHttp\Client(),$config);

            $subaccount_id = 82857; // int | ID of subaccount to update

            $subaccount = new \ClickSend\Model\Subaccount(); //
            \ClickSend\Model\Subaccount | Subaccount model

            $subaccount->setApiUsername("name");

            $subaccount->setPassword("pwd");

            $subaccount->setEmail("xxx@gmail.com");

            $subaccount->setPhoneNumber("xxx-xxx-xxxx");

            $subaccount->setFirstName("first");

            $subaccount->setLastName("last");


            try {
                $result = $apiInstance->subaccountsBySubaccountIdPut($subaccount_id, $subaccount);
                print_r($result);
            } catch (Exception $e) {
                echo 'Exception when calling SubaccountApi->subaccountsBySubaccountIdPut: ', $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 subaccountApi = new SubaccountApi(configuration);

            var response = subaccountApi.SubaccountsBySubaccountIdPut(75557, new
            Subaccount(
                apiUsername: "username",
                password: "password",
                email: "john@doe.com",
                phoneNumber: "+11231231234",
                firstName: "John",
                lastName: "Doe",
                accessBilling: 1,
                accessContacts: 1,
                accessUsers: 1,
                accessReporting: 1,
                accessSettings: 1
            ));
        - lang: Java
          source: |-
            package ClickSend;

            import ClickSend.Api.SubaccountApi;
            import ClickSend.Model.Subaccount;

            public class update_subaccount {
              public static void main(String[] args) {
                ApiClient defaultClient = new ApiClient();
                defaultClient.setUsername("USERNAME");
                defaultClient.setPassword("API_KEY");
                SubaccountApi apiInstance = new SubaccountApi(defaultClient);
                Integer subaccountId = 77547; // Integer | ID of subaccount to update
                Subaccount subaccount = new Subaccount(); // Subaccount | Subaccount model
                subaccount.apiUsername("testing");
                subaccount.password("pwd");
                subaccount.email("xxx@gmail.com");
                subaccount.phoneNumber("000-000-0000");
                subaccount.firstName("test");
                subaccount.lastName("test");
                subaccount.accessUsers(new Integer(1));
                subaccount.accessBilling(new Integer(1));
                subaccount.accessReporting(new Integer(1));
                subaccount.accessContacts(new Integer(0));
                subaccount.accessSettings(new Integer(1));
                try {
                    String result = apiInstance.subaccountsBySubaccountIdPut(subaccountId, subaccount);
                    System.out.println(result);
                } catch (ApiException e) {
                    System.err.println("Exception when calling SubaccountApi#subaccountsBySubaccountIdPut");
                    e.printStackTrace();
                }
              }
            }
        - lang: Node.js
          source: >-
            var api = require('./api.js');


            var subaccountApi = new api.SubaccountApi("USERNAME", "API_KEY");


            var subaccountId = 80018;


            var subaccount = new api.Subaccount();


            subaccount.apiUsername = "apiUsername";

            subaccount.password = "pass";

            subaccount.email = "xxx@gmail.com";

            subaccount.phoneNumber = "xxx-xxx-xxxx";

            subaccount.firstName = "firstName";

            subaccount.lastName = "lastName";

            subaccount.accessUsers = 1;

            subaccount.accessBilling = 1;

            subaccount.accessReporting = 1;

            subaccount.accessContacts = 1;

            subaccount.accessSettings = 1;


            subaccountApi.subaccountsBySubaccountIdPut(subaccountId,
            subaccount).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::SubaccountApi.new

            subaccount_id = 56 # Integer | ID of subaccount to update

            # Subaccount | Subaccount model
            subaccount = ClickSendClient::Subaccount.new(
              "api_username": "api_username",
              "access_billing": 1,
              "password": "password",
              "access_reporting": 1,
              "access_settings": 1,
              "access_users": 1,
              "access_contacts": 0,
              "last_name": "last_name",
              "phone_number": "phone_number",
              "first_name": "first_name",
              "email": "email"
            )

            begin
              # Update subaccount
              result = api_instance.subaccounts_by_subaccount_id_put(subaccount_id, subaccount)
              p JSON.parse(result)
            rescue ClickSendClient::ApiError => e
              puts "Exception when calling SubaccountApi->subaccounts_by_subaccount_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.SubaccountApi(clicksend_client.ApiClient(configuration))

            subaccount_id = 75094 # int | ID of subaccount to update

            # Subaccount | Subaccount model

            subaccount = clicksend_client.Subaccount(
                api_username="username",
                password="password",
                email="xxx@gmail.com",
                phone_number="000-000-0000",
                first_name="Firstnamee",
                last_name="Lastname",
                access_users=1,
                access_billing=1,
                access_reporting=1,
                access_contacts=1,
                access_settings=1) 

            try:
                # Update subaccount
                api_response = api_instance.subaccounts_by_subaccount_id_put(subaccount_id, subaccount)
                print(api_response)
            except ApiException as e:
                print("Exception when calling SubaccountApi->subaccounts_by_subaccount_id_put: %s\n" % e)
        - lang: perl
          source: >-
            use WWW::ClickSendClient::SubaccountApi;

            use WWW::ClickSendClient::Object::Subaccount;


            my $username = 'YOUR_API_USER_NAME';

            my $password = 'YOUR_API_PASSWORD';


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


            my %params = (
                'api_username'     => 'api_username_updated',
                'access_billing'   => 1,
                'password'         => 'password',
                'access_reporting' => 1,
                'access_settings'  => 1,
                'access_users'     => 1,
                'access_contacts'  => 0,
                'last_name'        => 'last_name',
                'phone_number'     => '+447777777777',
                'first_name'       => 'first_name',
                'email'            => 'test1@test.com'
            );


            my $subaccount_obj =
            WWW::ClickSendClient::Object::Subaccount->new(%params);


            my $json_output =
            $api->subaccounts_by_subaccount_id_put('subaccount' =>
            $subaccount_obj, 'subaccount_id' => '12345');


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

            #import "CSDefaultConfiguration.h"


            CSDefaultConfiguration *apiConfig = [CSDefaultConfiguration
            sharedConfig];

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

            [apiConfig setUsername:@"USERNAME"];

            [apiConfig setPassword:@"PASSWORD"];


            CSSubaccount *subaccount = [[CSSubaccount alloc] init];

            subaccount.apiUsername = @"api_username";

            subaccount.password = @"password";

            subaccount.email = @"johndoe@gmail.com";

            subaccount.phoneNumber = @"+639772549340";

            subaccount.firstName = @"firstname";

            subaccount.lastName = @"lastname";

            subaccount.accessUsers = @(1);

            subaccount.accessBilling = @(1);

            subaccount.accessReporting = @(1);

            subaccount.accessContacts = @(1);

            subaccount.accessSettings = @(1);


            CSSubaccountApi *subaccountApi = [[CSSubaccountApi alloc] init];

            [subaccountApi subaccountsBySubaccountIdPutWithSubaccountId:@(1)
            subaccount:subaccount 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 subaccount = Subaccount(
                                apiUsername: "api_username", 
                                password: "password", 
                                email: "johndoe@gmail.com", 
                                phoneNumber: "+639772549340", 
                                firstName: "first_name", 
                                lastName: "last_name", 
                                accessUsers: 1, 
                                accessBilling: 1, 
                                accessReporting: 1, 
                                accessContacts: 1, accessSettings: 1
                            )

            SubaccountAPI.subaccountsBySubaccountIdPut(subaccountId: 1,
            subaccount: subaccount) { (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)
                        }
                    }
                }
            }
    delete:
      summary: Delete Subaccount
      operationId: delete-subaccount
      description: >-
        _Delete a subaccount_


        ### Parameters


        | Parameter | In | Type | Required | Description |

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

        | subaccount_id | path | integer(int32) | true | ID of subaccount to
        delete |



        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
        - name: subaccount_id
          in: path
          schema:
            type: string
          required: true
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/delete-subaccount'
      x-codeSamples:
        - lang: curl
          source: |-
            curl --include \
                 --header "Authorization: Basic YXBpLXVzZXJuYW1lOmFwaS1wYXNzd29yZA=="  \
                 --request DELETE \

            'https://rest.clicksend.com/v3/subaccounts/{subaccount_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\SubaccountApi(new
            GuzzleHttp\Client(),$config);

            $subaccount_id = 82271; // int | ID of subaccount to regenerate API
            key for


            try {
                $result = $apiInstance->subaccountsBySubaccountIdDelete($subaccount_id);
                print_r($result);
            } catch (Exception $e) {
                echo 'Exception when calling SubaccountApi->subaccountsBySubaccountIdDelete: ', $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 subaccountApi = new SubaccountApi(configuration);

            var response =
            subaccountApi.SubaccountsBySubaccountIdDelete(SUB_ACCOUNT_ID);
        - lang: Java
          source: |-
            package ClickSend;

            import ClickSend.Api.SubaccountApi;

            public class delete_subaccount {
               public static void main(String[] args) {
                  ApiClient defaultClient = new ApiClient();
                  defaultClient.setUsername("USERNAME");
                  defaultClient.setPassword("API_KEY");
                  SubaccountApi apiInstance = new SubaccountApi(defaultClient);
                  Integer subaccountId = 75097; // Integer | ID of subaccount to delete
                  try {
                      String result = apiInstance.subaccountsBySubaccountIdDelete(subaccountId);
                      System.out.println(result);
                  } catch (ApiException e) {
                      System.err.println("Exception when calling SubaccountApi#subaccountsBySubaccountIdDelete");
                      e.printStackTrace();
                  }
               }
            }
        - lang: Node.js
          source: >-
            var api = require('./api.js');


            var subaccountApi = new api.SubaccountApi("USERNAME", "API_KEY");


            var subaccountId = 80018;


            subaccountApi.subaccountsBySubaccountIdDelete(subaccountId).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::SubaccountApi.new

            subaccount_id = 56 # Integer | ID of subaccount to delete

            begin
              # Delete a subaccount
              result = api_instance.subaccounts_by_subaccount_id_delete(subaccount_id)
              p JSON.parse(result)
            rescue ClickSendClient::ApiError => e
              puts "Exception when calling SubaccountApi->subaccounts_by_subaccount_id_delete: #{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.SubaccountApi(clicksend_client.ApiClient(configuration))

            subaccount_id = 75094 # int | ID of subaccount to delete


            try:
                # Delete a subaccount
                api_response = api_instance.subaccounts_by_subaccount_id_delete(subaccount_id)
                print(api_response)
            except ApiException as e:
                print("Exception when calling SubaccountApi->subaccounts_by_subaccount_id_delete: %s\n" % e)
        - lang: perl
          source: >-
            use WWW::ClickSendClient::SubaccountApi;


            my $username = 'YOUR_API_USER_NAME';

            my $password = 'YOUR_API_PASSWORD';


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


            my $json_output =
            $api->subaccounts_by_subaccount_id_delete('subaccount_id' =>
            '12345');


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

            #import "CSDefaultConfiguration.h"


            CSDefaultConfiguration *apiConfig = [CSDefaultConfiguration
            sharedConfig];

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

            [apiConfig setUsername:@"USERNAME"];

            [apiConfig setPassword:@"PASSWORD"];


            CSSubaccountApi *subaccountApi = [[CSSubaccountApi alloc] init];

            [subaccountApi subaccountsBySubaccountIdDeleteWithSubaccountId:@(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]
            }


            SubaccountAPI.subaccountsBySubaccountIdDelete(subaccountId: 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/subaccounts/{subaccount_id}/regen-api-key:
    put:
      summary: Generate New API Key
      operationId: generate-new-api-key
      description: >-
        _Regenerate an API Key_


        ### Parameters


        | Parameter | In | Type | Required | Description |

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

        | subaccount_id | path | integer(int32) | true | ID of subaccount to
        regenerate API key for |



        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:
                access_sms:
                  type: integer
                email:
                  type: string
                notes:
                  type: string
              example:
                access_sms: 1
                email: '{{email}}'
                notes: This is a test
      security:
        - basicAuth: []
      parameters:
        - name: Content-Type
          in: header
          schema:
            type: string
          example: application/json
        - name: subaccount_id
          in: path
          schema:
            type: string
          required: true
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/generate-new-api-key'
      x-codeSamples:
        - lang: curl
          source: >-
            curl --include \
                 --header "Authorization: Basic YXBpLXVzZXJuYW1lOmFwaS1wYXNzd29yZA=="  \
                 --request PUT \

            'https://rest.clicksend.com/v3/subaccounts/{subaccount_id}/regen-api-key'
        - 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\SubaccountApi(new
            GuzzleHttp\Client(),$config);

            $subaccount_id = 74275; // int | ID of subaccount to regenerate API
            key for


            try {
                $result = $apiInstance->subaccountsRegenApiKeyBySubaccountIdPut($subaccount_id);
                print_r($result);
            } catch (Exception $e) {
                echo 'Exception when calling SubaccountApi->subaccountsRegenApiKeyBySubaccountIdPut: ', $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 subaccountApi = new SubaccountApi(configuration);

            var response =
            subaccountApi.SubaccountsRegenApiKeyBySubaccountIdPut(SUB_ACCOUNT_ID);
        - lang: Java
          source: |-
            package ClickSend;

            import ClickSend.Api.SubaccountApi;

            public class regenerate_api_key {
               public static void main(String[] args) {
                  ApiClient defaultClient = new ApiClient();
                  defaultClient.setUsername("USERNAME");
                  defaultClient.setPassword("API_KEY");
                  SubaccountApi apiInstance = new SubaccountApi(defaultClient);
                  // Integer | ID of subaccount to regenerate API key for
                  Integer subaccountId = 75093; 
                  try {
                      String result = apiInstance.subaccountsRegenApiKeyBySubaccountIdPut(subaccountId);
                      System.out.println(result);
                  } catch (ApiException e) {
                      System.err.println("Exception when calling SubaccountApi#subaccountsRegenApiKeyBySubaccountIdPut");
                      e.printStackTrace();
                  }
               }
            }
        - lang: Node.js
          source: >-
            var api = require('./api.js');


            var subaccountApi = new api.SubaccountApi("USERNAME", "API_KEY");


            var subaccountId = 80017;


            subaccountApi.subaccountsRegenApiKeyBySubaccountIdPut(subaccountId).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::SubaccountApi.new


            subaccount_id = 56 # Integer | ID of subaccount to regenerate API
            key for


            begin
              # Regenerate an API Key
              result = api_instance.subaccounts_regen_api_key_by_subaccount_id_put(subaccount_id)
              p JSON.parse(result)
            rescue ClickSendClient::ApiError => e
              puts "Exception when calling SubaccountApi->subaccounts_regen_api_key_by_subaccount_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.SubaccountApi(clicksend_client.ApiClient(configuration))

            subaccount_id = 74275 # int | ID of subaccount to regenerate API key
            for


            try:
                # Regenerate an API Key
                api_response = api_instance.subaccounts_regen_api_key_by_subaccount_id_put(subaccount_id)
                print(api_response)
            except ApiException as e:
                print("Exception when calling SubaccountApi->subaccounts_regen_api_key_by_subaccount_id_put: %s\n" % e)
        - lang: perl
          source: >-
            use WWW::ClickSendClient::SubaccountApi;


            my $username = 'YOUR_API_USER_NAME';

            my $password = 'YOUR_API_PASSWORD';


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


            my $json_output =
            $api->subaccounts_regen_api_key_by_subaccount_id_put('subaccount_id'
            => '12345');


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

            #import "CSDefaultConfiguration.h"


            CSDefaultConfiguration *apiConfig = [CSDefaultConfiguration
            sharedConfig];

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

            [apiConfig setUsername:@"USERNAME"];

            [apiConfig setPassword:@"PASSWORD"];


            CSSubaccountApi *subaccountApi = [[CSSubaccountApi alloc] init];

            [subaccountApi
            subaccountsRegenApiKeyBySubaccountIdPutWithSubaccountId:@(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]
            }


            SubaccountAPI.subaccountsRegenApiKeyBySubaccountIdPut(subaccountId:
            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)
                        }
                    }
                }
            }
