# List Senders

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

<mark style="color:green;">**`GET`**</mark> `https://api.textcus.com/api/v2/senders`

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

`Authorization: Bearer API_KEY`

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

| Parameters                                           | Type     | Description                                                         |
| ---------------------------------------------------- | -------- | ------------------------------------------------------------------- |
| <p>apikey</p><p><em><strong>string</strong></em></p> | Required | Your unique API key is required to retrieve your TextCus Sender IDs |

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

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

```php
<?php
$url = 'https://api.textcus.com/api/v2/senders';

$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 => 'GET',
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer API_KEY' // Replace 'API_KEY' with your actual API key
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

?>
```

{% endtab %}

{% tab title="NodeJS" %}

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

const config = {
    method: 'get',
    url: `https://api.textcus.com/api/v2/senders`,
    headers: {
        'Authorization': 'Bearer API_KEY' // Replace 'API_KEY' with your actual API key
    }
};

axios(config).then(function(response) {
    console.log(JSON.stringify(response.data));
}).catch(function(error) {
    console.error(error);
});
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = f'https://api.textcus.com/api/v2/senders'

headers = {
    "Authorization": "Bearer API_KEY" # Replace 'API_KEY' with your actual API key
}

try:
    response = requests.get(url, headers=headers)
    print(response.json())
except requests.exceptions.RequestException as e:
    print(e)
```

{% endtab %}

{% tab title="Dart" %}

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

void main() async {
  String url = 'https://api.textcus.com/api/v2/senders';

  try {
    final response = await http.get(
      Uri.parse(url),
      headers: {
        'Authorization': 'Bearer API_KEY', // Replace 'API_KEY' with your actual API Key
      },
    );

    if (response.statusCode == 200) {
      // If the server returns an OK response, parse the JSON
      print(response.body);
    } else {
      // If the server did not return a 200 OK response, throw an exception.
      print('Failed to load balance. Status code: ${response.statusCode}');
    }
  } catch (e) {
    print('Error: $e');
  }
}
```

{% endtab %}

{% tab title="Java" %}

```java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.http.HttpHeaders;
import java.net.http.HttpResponse.BodyHandlers;

public class CheckBalance {

    public static void main(String[] args) {
        String url = "https://api.textcus.com/api/v2/senders/";

        try {
            // Create HttpClient
            HttpClient client = HttpClient.newHttpClient();

            // Build the GET request
            HttpRequest request = HttpRequest.newBuilder()
                    .uri(URI.create(url))
                    .header("Authorization", "Bearer API_KEY")  // Replace 'API_KEY' with your actual API Key
                    .GET()
                    .build();

            // Send the request and get the response
            HttpResponse<String> response = client.send(request, BodyHandlers.ofString());

            // Check if the request was successful
            if (response.statusCode() == 200) {
                System.out.println("Response: " + response.body());
            } else {
                System.out.println("Failed to retrieve balance. Status code: " + response.statusCode());
                System.out.println("Response: " + response.body());
            }

        } catch (Exception e) {
            System.out.println("Error: " + e.getMessage());
        }
    }
}

```

{% endtab %}

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

```vbnet
Imports System.Net.Http
Imports System.Threading.Tasks

Module Module1
    Sub Main()
        Dim url As String = "https://api.textcus.com/api/v2/senders"

        Dim response As String = GetApiResponseAsync(url, apiKey).GetAwaiter().GetResult()

        Console.WriteLine(response)
    End Sub

    Async Function GetApiResponseAsync(url As String, apiKey As String) As Task(Of String)
        Using client As New HttpClient()
            client.DefaultRequestHeaders.Add("Authorization", "Bearer " & apiKey) ' Replace 'API_KEY' with your actual API key

            Dim response As HttpResponseMessage = Await client.GetAsync(url)
            If response.IsSuccessStatusCode Then
                Return Await response.Content.ReadAsStringAsync()
            Else
                Return "Error: " & response.StatusCode.ToString()
            End If
        End Using
    End Function
End Module
```

{% endtab %}
{% endtabs %}

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

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

```json
{
    "status": 200,
    "message": "Senders retrieved",
    "data": {
        "sender_name": "TextCus",
        "status": "yes"
    },
    ...
}
```

{% endtab %}

{% tab title="Errors" %}

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

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

{% endtab %}
{% endtabs %}
