openapi: 3.0.0
info:
  title: Verification
  description: Endpoints associated with creating and managing user accounts.
servers:
  - url: https://rest.clicksend.com
components:
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
  schemas:
    forgot-username:
      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: An email notification has been sent.
        data:
          type: array
          items: []
          example: []
    forgot-password:
      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: An email notification has been sent.
        data:
          type: array
          items: []
          example: []
paths:
  /v3/forgot-username:
    put:
      summary: Forgot Username
      operationId: forgot-username
      description: >-
        _Forgot username_


        Requires the user to pass either the email registered to an account or
        the phone number, **not** both


        ### Properties


        | **Name** | **Type** | **Required** | **Restrictions** |
        **Description** |

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

        | email | string | true | none | Email belonging to account |

        | phone_number | string | true | none | Phone belonging to account |


        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>   
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                email:
                  type: string
              example:
                email: test@test.com
      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/forgot-username'
      x-codeSamples:
        - lang: curl
          source: |-
            curl --include \
                 --request PUT \
                 --header "Content-Type: application/json" \
                 --data-binary "    {
                    \"phone_number\": \"3108147982\",
                    \"email\": \"test@email.com\"
                }" \
            'https://rest.clicksend.com/v3/forgot-username'
        - lang: PHP
          source: >-
            <?php

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


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

            $forgot_username = new \ClickSend\Model\ForgotUsername(); //
            \ClickSend\Model\ForgotUsername | 

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


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

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

            var accountApi = new AccountApi(Configuration.Default);
            var response = accountApi.ForgotUsernamePut(new ForgotUsername(
                email: "john@doe.com"
            ));
        - lang: Java
          source: |-
            package ClickSend;

            import ClickSend.Api.AccountApi;
            import ClickSend.Model.ForgotUsername;

            public class forgot_username {
              public static void main(String[] args) {
                ApiClient defaultClient = new ApiClient();
                defaultClient.setUsername("USERNAME");
                defaultClient.setPassword("API_KEY");
                AccountApi apiInstance = new AccountApi(defaultClient);
                ForgotUsername forgotUsername = new ForgotUsername(); // ForgotUsername | 
                forgotUsername.email("xxx@gmail.com");
                forgotUsername.phoneNumber("xxx-xxx-xxxx");
                try {
                    String result = apiInstance.forgotUsernamePut(forgotUsername);
                    System.out.println(result);
                } catch (ApiException e) {
                    System.err.println("Exception when calling AccountApi#forgotUsernamePut");
                    e.printStackTrace();
                }
              }
            }
        - lang: Node.js
          source: >-
            var api = require('./api.js');


            var accountApi = new api.AccountApi("USERNAME", "API_KEY");


            var forgotUsername = new  api.ForgotUsername();


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

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


            accountApi.forgotUsernamePut(forgotUsername).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::AccountApi.new

            opts = {
              forgot_username: ClickSendClient::ForgotUsername.new( # ForgotUsername | ForgotUsername model
                "email": "test@email.com"
              )
            }

            begin
              # Forgot username
              result = api_instance.forgot_username_put(opts)
              p JSON.parse(result)
            rescue ClickSendClient::ApiError => e
              puts "Exception when calling AccountApi->forgot_username_put: #{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.AccountApi()
            forgot_username = clicksend_client.ForgotUsername(
                              email='xxx@gmail.com',
                              phone_number= '000-000-0000') # ForgotUsername |  (optional)

            try:
                # Forgot username
                api_response = api_instance.forgot_username_put(forgot_username=forgot_username)
                print(api_response)
            except ApiException as e:
                print("Exception when calling AccountApi->forgot_username_put: %s\n" % e)
        - lang: perl
          source: |-
            use WWW::ClickSendClient::AccountApi;

            my $api         = WWW::ClickSendClient::AccountApi->new();
            my $email       = 'YOUR_EMAIL';

            my $json_output = $api->forgot_username_put('email' => $email);

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

            #import "CSAccountApi.h"


            CSDefaultConfiguration *apiConfig = [CSDefaultConfiguration
            sharedConfig];

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

            [apiConfig setUsername:@"USERNAME"];

            [apiConfig setPassword:@"PASSWORD"];


            CSAccountApi *accountAPI = [[CSAccountApi alloc] init];

            CSForgotUsername *forgotUserName = [[CSForgotUsername alloc] init];

            forgotUserName.email = @"johndoe1@gmail.com";

            forgotUserName.phoneNumber = @"3108147982";


            [accountAPI forgotUsernamePutWithForgotUsername:forgotUserName
            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 forgotUserName = ForgotUsername(
                email: "johndoe1@gmail.com", 
                phoneNumber: "3108147982"
            )


            AccountAPI.forgotUsernamePut(forgotUsername: forgotUserName) {
            (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/forgot-password:
    put:
      summary: Forgot Password
      operationId: forgot-password
      description: >-
        _Forgot password_


        A user can send their username to this endpoint to be sent an email with
        their registered email address that will have a verification code.


        Once you have this verification email containing the code you can send
        it to the
        [forgotten-password/verify](https://developers.clicksend.com/docs/rest/v3/#verify-forgot-password)
        endpoint along with a new password and the ID of that subaccount.


        _Ask your administrator if you do not know your subaccount id._


        ### Properties


        | **Name** | **Type** | **Required** | **Restrictions** |
        **Description** |

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

        | username | string | true | none | Username belonging to account |


        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>
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                username:
                  type: string
              example:
                username: test
      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/forgot-password'
      x-codeSamples:
        - lang: curl
          source: |-
            curl --include \
                 --request PUT \
                 --header "Content-Type: application/json" \
                 --data-binary "    {
                    \"username\": \"0F6pKiiuca\"
                }" \
            'https://rest.clicksend.com/v3/forgot-password'
        - 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\AccountApi(new
            GuzzleHttp\Client(),$config);

            $forgot_password = new \ClickSend\Model\ForgotPassword(); //
            \ClickSend\Model\ForgotPassword | 

            $forgot_password->username="username";


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

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

            var accountApi = new AccountApi(Configuration.Default);
            var response = accountApi.ForgotPasswordPut(USERNAME);
        - lang: Java
          source: |-
            package ClickSend;

            import ClickSend.Api.AccountApi;
            import ClickSend.Model.ForgotPassword;

            public class forgot_password {
              public static void main(String[] args) {
                ApiClient defaultClient = new ApiClient();
                defaultClient.setUsername("USERNAME");
                defaultClient.setPassword("API_KEY");
                AccountApi apiInstance = new AccountApi(defaultClient);
                ForgotPassword forgotPassword = new ForgotPassword(); // ForgotPassword | 
                forgotPassword.username("USERNAME");
                try {
                    String result = apiInstance.forgotPasswordPut(forgotPassword);
                    System.out.println(result);
                } catch (ApiException e) {
                    System.err.println("Exception when calling AccountApi#forgotPasswordPut");
                    e.printStackTrace();
                }
              }
            }
        - lang: Node.js
          source: >-
            var api = require('./api.js');


            var accountApi = new api.AccountApi("USERNAME", "API_KEY");


            var forgotPassword = new  api.ForgotPassword();


            forgotPassword.username = "xxx@gmail.com";


            accountApi.forgotPasswordPut(forgotPassword).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::AccountApi.new

            # ForgotPassword |
            opts = {
              forgot_password: ClickSendClient::ForgotPassword.new(
                "username": "0F6pKiiuca"
              )
            }

            begin
              # Forgot password
              result = api_instance.forgot_password_put(opts)
              p JSON.parse(result)
            rescue ClickSendClient::ApiError => e
              puts "Exception when calling AccountApi->forgot_password_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.AccountApi(clicksend_client.ApiClient(configuration))

            forgot_password =
            clicksend_client.ForgotPassword(username='USERNAME') #
            ForgotPassword |  (optional)


            try:
                # Forgot password
                api_response = api_instance.forgot_password_put(forgot_password=forgot_password)
                print(api_response)
            except ApiException as e:
                print("Exception when calling AccountApi->forgot_password_put: %s\n" % e)
        - lang: perl
          source: >-
            use WWW::ClickSendClient::AccountApi;


            my $api = WWW::ClickSendClient::AccountApi->new();


            my $username = 'YOUR_USER_NAME';


            my $json_output = $api->forgot_password_put('username' =>
            $username);

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

            #import "CSAccountApi.h"


            CSDefaultConfiguration *apiConfig = [CSDefaultConfiguration
            sharedConfig];

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

            [apiConfig setUsername:@"USERNAME"];

            [apiConfig setPassword:@"PASSWORD"];


            CSAccountApi *accountAPI = [[CSAccountApi alloc] init];


            CSForgotPassword *forgotPassword = [[CSForgotPassword alloc] init];

            forgotPassword.username = @"USERNAME";


            [accountAPI forgotPasswordPutWithForgotPassword:forgotPassword
            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 forgotPassword = ForgotPassword(username: "USERNAME")


            AccountAPI.forgotPasswordPut(forgotPassword: forgotPassword) {
            (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)
                    }
                }
            }
