TextCus API Documentation
  • Introduction
  • OVERVIEW
    • Send SMS
      • Quick Send
      • Send Multiple SMS
    • Sender IDs
      • List Senders
      • Add Senders
    • Account Balance
    • One Time Password (OTP)
Powered by GitBook
On this page
  • Endpoint
  • Headers
  • Body Parameters
  • Sample Requests
  • Sample Response
  1. OVERVIEW
  2. Sender IDs

Add Senders

Adding new sender may be obtained using this endpoint. For emphasis on specific results, you can add the following parameters when creating new sender.

Endpoint

POST https://sms.textcus.com/api/v2/senders/add

Headers

Authorization: Bearer API_KEY

Body Parameters

Parameters
Type
Description

sender_name

string

Required

Your 11 character sender ID name. eg. TextCus

description

string

Required

The purpose of the sender ID

Sample Requests

<?php
$data = [
  'sender_name' => "TextCus", // 11 Characters Only
  'description' => "For business SMS to my customers",
];

$url = 'https://sms.textcus.com/api/v2/senders/add';

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => $url,
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => $data,
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer API_KEY',  // Replace 'API_KEY' with your actual API key
    'Content-Type: application/json' 
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

?>
const axios = require('axios');

const data = {
  sender_name: "TextCus", // 11 Characters Only
  description: "For business SMS to my customers"
};

const url = 'https://sms.textcus.com/api/v2/senders/add';

axios.post(url, data, {
  headers: {
    'Authorization': 'Bearer API_KEY',  // Replace 'API_KEY' with your actual API key
    'Content-Type': 'application/json'
  }
})
.then(response => {
  console.log(response.data);
})
.catch(error => {
  console.error('Error:', error);
});
import requests

url = 'https://sms.textcus.com/api/v2/senders/add'
data = {
    'sender_name': 'TextCus',  # 11 Characters Only
    'description': 'For business SMS to my customers'
}
headers = {
    'Authorization': 'Bearer API_KEY',  # Replace 'API_KEY' with your actual API key
    'Content-Type': 'application/json'
}

response = requests.post(url, json=data, headers=headers)
print(response.text)
import 'dart:convert';
import 'package:http/http.dart' as http;

void sendSMS() async {
  var url = Uri.parse('https://sms.textcus.com/api/v2/senders/add');
  var data = {
    'sender_name': 'TextCus',  // 11 Characters Only
    'description': 'For business SMS to my customers'
  };

  var response = await http.post(
    url,
    headers: {
      'Authorization': 'Bearer API_KEY',  // Replace 'API_KEY' with your actual API key
      'Content-Type': 'application/json',
    },
    body: jsonEncode(data),
  );

  if (response.statusCode == 200) {
    print('Response: ${response.body}');
  } else {
    print('Error: ${response.statusCode}');
  }
}
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;

public class Main {
    public static void main(String[] args) {
        try {
            String url = "https://sms.textcus.com/api/v2/senders/add";
            URL obj = new URL(url);
            HttpURLConnection con = (HttpURLConnection) obj.openConnection();
            con.setRequestMethod("POST");
            con.setRequestProperty("Authorization", "Bearer API_KEY"); // Replace 'API_KEY'
            con.setRequestProperty("Content-Type", "application/json");

            // Request body
            String jsonInputString = "{\"sender_name\": \"TextCus\", \"description\": \"For business SMS to my customers\"}";
            con.setDoOutput(true);
            try (OutputStream os = con.getOutputStream()) {
                byte[] input = jsonInputString.getBytes(StandardCharsets.UTF_8);
                os.write(input, 0, input.length);
            }

            int responseCode = con.getResponseCode();
            System.out.println("Response Code: " + responseCode);

        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
Imports System.Net
Imports System.Text
Imports System.IO

Module Module1
    Sub Main()
        Dim url As String = "https://sms.textcus.com/api/v2/senders/add"
        Dim request As HttpWebRequest = CType(WebRequest.Create(url), HttpWebRequest)
        request.Method = "POST"
        request.ContentType = "application/json"
        request.Headers.Add("Authorization", "Bearer API_KEY") ' Replace 'API_KEY'

        ' JSON data
        Dim postData As String = "{""sender_name"": ""TextCus"", ""description"": ""For business SMS to my customers""}"
        Dim byteArray As Byte() = Encoding.UTF8.GetBytes(postData)

        request.ContentLength = byteArray.Length
        Dim dataStream As Stream = request.GetRequestStream()
        dataStream.Write(byteArray, 0, byteArray.Length)
        dataStream.Close()

        Dim response As HttpWebResponse = CType(request.GetResponse(), HttpWebResponse)
        Dim reader As New StreamReader(response.GetResponseStream())
        Dim responseText As String = reader.ReadToEnd()
        Console.WriteLine(responseText)

        reader.Close()
        response.Close()
    End Sub
End Module

Sample Response

{
    "status": 200,
    "message": "Sender ID added",
    "data": {
        "sender_name": "TextCus",
        "description": "For business SMS to my customers",
        "status": "no"
    }
}
{
    "status": 401,
    "error": "Authentication invalid"
}, 

{
    "status": 401,
    "error": "Unauthorized: Invalid API Key"
}
PreviousList SendersNextAccount Balance

Last updated 8 months ago