Chinguisoft SMS Validation API

Welcome to Chinguisoft's SMS Validation API!

Use this guide to quickly integrate the API into your applications.

Introduction

The Chinguisoft SMS Validation API simplifies phone number validation for your application by sending a secure SMS to the provided number. This SMS includes a unique, randomly generated validation code and a brief explanatory message tailored to the recipient's language preference (Arabic or French).

Features

Quick Start

Step 0: Application

To create an application:

Step 1: Authentication

Every request must include:

If you do not have a Validation-token, or to Increase your balance, please contact us here.

Step 2: Request Details

Method: POST
URL: https://chinguisoft.com/api/sms/validation/{validation_key}

Headers

            Validation-token: your_validation_token
            Content-Type: application/json
        

Body Parameters

            {
                "phone": "44800028",
                "lang": "ar"
            }
        

Step 3: Responses

SMS sent to phone number

If you need to customize the sms, please contact us here.

Example Code

Curl

                curl -X POST https://chinguisoft.com/api/sms/validation/your_validation_key \
                    -H "Validation-token: your_validation_token" \
                    -H "Content-Type: application/json" \
                    -d '{
                        "phone": "44800028",
                        "lang": "ar"
                    }'
            

Python

                import requests

                # Your unique validation key provided by Chinguisoft.
                validation_key = 'your_validation_key'
                # The API token required for authorization.
                token = 'your_validation_token'

                # The API endpoint for validation.
                url = f"https://chinguisoft.com/api/sms/validation/{validation_key}"

                # Headers for the request.
                headers = {
                    'Validation-token': token,
                    'Content-Type': 'application/json',
                }

                # Data payload for the request.
                data = {
                    'phone': '44800028',
                    'lang': 'ar'
                }

                # Make the POST request.
                response = requests.post(url, headers=headers, json=data)

                # Output the response body (validation result).
                print(response.text)
            

PHP (Using Guzzle)

                require 'vendor/autoload.php';

                use GuzzleHttp\Client;

                // Your unique validation key provided by Chinguisoft.
                $validationKey = 'your_validation_key';
                // The API token required for authorization.
                $token = 'your_validation_token';

                // Initialize a new Guzzle HTTP client.
                $client = new Client();

                // Make a POST request to the validation API.
                $response = $client->post("https://chinguisoft.com/api/sms/validation/$validationKey", [
                    'headers' => [
                        // Include the API token in the request headers.
                        'Validation-token' => $token,
                        // Specify that the request body is in JSON format.
                        'Content-Type' => 'application/json',
                    ],
                    'json' => [
                        // Provide the phone number to validate.
                        'phone' => '44800028',
                        // Specify the preferred language for the SMS.
                        'lang' => 'ar'
                    ]
                ]);

                // Output the response body (validation result).
                echo $response->getBody();
            

Java (Using HttpClient)

                import java.net.URI;
                import java.net.http.HttpClient;
                import java.net.http.HttpRequest;
                import java.net.http.HttpResponse;

                public class ValidationApiExample {
                    public static void main(String[] args) {
                        // Your validation key provided by Chinguisoft
                        String validationKey = "your_validation_key";
                        // Your unique API token for authorization
                        String token = "your_validation_token";
                        // The API endpoint to send requests to
                        String apiUrl = "https://chinguisoft.com/api/sms/validation/" + validationKey;

                        // The body of the POST request in JSON format
                        String requestBody = "{\"phone\":\"44800028\", \"lang\":\"ar\"}";

                        // Create a new instance of HttpClient to send HTTP requests
                        HttpClient client = HttpClient.newHttpClient();

                        // Build an HTTP POST request with headers and a body
                        HttpRequest request = HttpRequest.newBuilder()
                                .uri(URI.create(apiUrl)) // Set the API endpoint URL
                                .header("Content-Type", "application/json") // Specify JSON content type
                                .header("Validation-token", token) // Include the API token in the headers
                                .POST(HttpRequest.BodyPublishers.ofString(requestBody)) // Add the JSON body to the POST request
                                .build();

                        try {
                            // Send the request and get the response
                            HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString());
                            // Print the status code of the response
                            System.out.println("Response Code: " + response.statusCode());
                            // Print the response body (e.g., validation result)
                            System.out.println("Response Body: " + response.body());
                        } catch (Exception e) {
                            // Handle any exceptions that occur during the request
                            e.printStackTrace();
                        }
                    }
                }
            

JavaScript (Axios)

                // Import the Axios library, which simplifies HTTP requests
                const axios = require('axios');

                // Your unique validation key provided by Chinguisoft
                const validationKey = 'your_validation_key';
                // The API token required for authorization
                const token = 'your_validation_token';

                // Request data containing the phone number and language preference
                const requestData = {
                    phone: '44800028', // The phone number to validate
                    lang: 'ar'           // Language preference for the SMS
                };

                // Send a POST request to the Chinguisoft validation API
                axios.post(`https://chinguisoft.com/api/sms/validation/${validationKey}`, requestData, {
                headers: {
                    'Validation-token': token,       // Include the API token for authorization
                    'Content-Type': 'application/json'  // Specify that the request body is in JSON format
                }
                })
                .then(response => {
                    // Handle a successful response
                    console.log('Success:', response.data); // Log the response data
                })
                .catch(error => {
                    // Handle errors during the request
                    if (error.response) {
                    // Log the error response returned by the server
                    console.log('Error:', error.response.data);
                    } else {
                    // Log any other errors, such as network issues
                    console.error('Request failed:', error.message);
                    }
                });
            

Dart (Using http Package)

                import 'dart:convert';
                import 'package:http/http.dart' as http;

                void main() async {
                    // Define your unique validation key provided by Chinguisoft
                    final validationKey = 'your_validation_key';
                    // Define your unique API token required for authorization
                    final token = 'your_validation_token';
                    // Construct the API endpoint URL with the validation key
                    final url = Uri.parse('https://chinguisoft.com/api/sms/validation/\$validationKey');

                    // Set up the request headers, including the API token and content type
                    final headers = {
                        'Validation-token': token, // Authorization header
                        'Content-Type': 'application/json', // Specify JSON content type
                    };

                    // Define the body of the POST request as a JSON object
                    final body = jsonEncode({
                        'phone': '44800028', // The phone number to validate
                        'lang': 'ar', // The preferred language for the SMS
                    });

                    try {
                        // Send the POST request asynchronously
                        final response = await http.post(url, headers: headers, body: body);

                        // Check if the request was successful
                        if (response.statusCode == 200) {
                        // Print the response body if the request was successful
                        print('Success: \${response.body}');
                        } else {
                        // Print the error details if the request failed
                        print('Error: \${response.statusCode} - \${response.body}');
                        }
                    } catch (e) {
                        // Handle exceptions, such as network errors
                        print('Request failed: \$e');
                    }
                }
            

Tips for Using the API

Need Help?

For questions, assistance, or to get your Validation Key, Validation token, or to Increase your balance, please contact us here.

Thank you for choosing Chinguisoft!