MENU navbar-image

Introduction

API Documentation

This documentation provides comprehensive information for developers looking to integrate with our SMS messaging API. Before using the API, you must create an account to obtain your credentials (username and password). Here, you'll find everything you need to understand the API's capabilities, including endpoints, request and response formats, authentication methods, and more.

Send SMS Message API

Endpoint

POST /v1/sms/send

Description

This endpoint allows you to send SMS messages to multiple recipients. Users can provide their credentials via URL parameters or form parameters.


Authentication

Credentials

Users must provide the following credentials for authentication:

Credentials can be passed either as URL parameters or form parameters.


Request Parameters

Body Parameters

Parameter Type Required Description
numbers string Yes The phone numbers to send the message to. Comma separated. Example: 0701234567, 0712345678
message_body string Yes The content of the message to be sent. Example: "Hello, this is a test message."
username string Yes Your username for authentication. Example: "user123"
password string Yes Your password for authentication. Example: "pass123"

Responses

Success Response


400 Bad Request

{ "error": "Invalid phone number format." }


401 Unauthorized

{ "error": "Unauthorized." }


Explanation of Sections

  1. Endpoint: Specifies the URL and method used to access the API.
  2. Description: Provides a brief overview of what the endpoint does.
  3. Authentication: Details the credentials needed for access.
  4. Request Parameters: Lists the body parameters that can be sent with the request, including their types and descriptions.
  5. Responses: Describes the possible responses, including success and error responses with example JSON outputs.
  6. Notes: Additional information relevant to the API usage.

<?php
    // PHP example for sending SMS via API
    $url = "https://ugsms.com/v1/sms/send";
    $data = [
        'username' => 'your_username',
        'password' => 'your_password',
        'numbers' => '0701234567, 0712345678',
        'message_body' => 'Hello, this is a test message.'
    ];
    $options = [
        'http' => [
            'header'  => "Content-Type: application/json\r\n",
            'method'  => 'POST',
            'content' => json_encode($data),
        ],
    ];
    $context  = stream_context_create($options);
    $result = file_get_contents($url, false, $context);
    if ($result === FALSE) { /* Handle error */ }
    echo $result;
?>