# Add Senders

### Endpoint <a href="#endpoint" id="endpoint"></a>

<mark style="color:yellow;">**`POST`**</mark> `https://api.textcus.com/api/v2/senders/add`

### Headers <a href="#headers" id="headers"></a>

`Authorization: Bearer API_KEY`

### **Body Parameters** <a href="#path-parameters" id="path-parameters"></a>

| Parameters                                                 | Type     | Description                                     |
| ---------------------------------------------------------- | -------- | ----------------------------------------------- |
| <p>sender\_name</p><p><em><strong>string</strong></em></p> | Required | Your 11 character sender ID name. eg. `TextCus` |
| <p>description</p><p><em><strong>string</strong></em></p>  | Required | The purpose of the sender ID                    |

## Sample Requests <a href="#sample-requests" id="sample-requests"></a>

{% tabs %}
{% tab title="PHP" %}

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

$url = 'https://api.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;

?>
```

{% endtab %}

{% tab title="NodeJS" %}

```javascript
const axios = require('axios');

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

const url = 'https://api.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);
});
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = 'https://api.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)
```

{% endtab %}

{% tab title="Dart" %}

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

void sendSMS() async {
  var url = Uri.parse('https://api.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}');
  }
}
```

{% endtab %}

{% tab title="Java" %}

```java
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://api.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();
        }
    }
}
```

{% endtab %}

{% tab title="VB.Net" %}

```vbnet
Imports System.Net
Imports System.Text
Imports System.IO

Module Module1
    Sub Main()
        Dim url As String = "https://api.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
```

{% endtab %}
{% endtabs %}

## Sample Response <a href="#sample-response" id="sample-response"></a>

{% tabs %}
{% tab title="Success" %}

```json
{
    "status": 200,
    "message": "Sender ID added",
    "data": {
        "sender_name": "TextCus",
        "description": "For business SMS to my customers",
        "status": "no"
    }
}
```

{% endtab %}

{% tab title="Errors" %}

```json
{
    "status": 401,
    "error": "Authentication invalid"
}, 

{
    "status": 401,
    "error": "Unauthorized: Invalid API Key"
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developers.textcus.com/overview/sender-ids/add-senders.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
