List Customers - Afriex Business API

Afriex SDK

TypeScript

const response = await afriex.customers.list({
  page: 0,
  limit: 20,
  email: "john@example.com",
});

console.log(response.data);  // Customer[]
console.log(response.total); // Total count

CURL

curl --request GET \
  --url 'https://sandbox.api.afriex.com/api/v1/customer?limit=10' \
  --header 'x-api-key: <api-key>'

Python

import requests

url = "https://sandbox.api.afriex.com/api/v1/customer?limit=10"

headers = {"x-api-key": "<api-key>"}

response = requests.get(url, headers=headers)

print(response.text)

JavaScript Fetch

const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};

fetch('https://sandbox.api.afriex.com/api/v1/customer?limit=10', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));

PHP

<?php
$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://sandbox.api.afriex.com/api/v1/customer?limit=10",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => [
    "x-api-key: <api-key>"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
?>

Go

package main

import (
    "fmt"
    "net/http"
    "io"
)

func main() {

url := "https://sandbox.api.afriex.com/api/v1/customer?limit=10"

req, _ := http.NewRequest("GET", url, nil)

req.Header.Add("x-api-key", "<api-key>")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
    body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))
}

Unirest (Java)

HttpResponse<String> response = Unirest.get("https://sandbox.api.afriex.com/api/v1/customer?limit=10")
  .header("x-api-key", "<api-key>")
  .asString();

Ruby

require 'uri'
require 'net/http'

url = URI("https://sandbox.api.afriex.com/api/v1/customer?limit=10")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<api-key>'

response = http.request(request)
puts response.read_body

Sample Response

{
  "data": [
    {
      "name": "Addams Oshay",
      "email": "addams@example.com",
      "phone": "+15086340138",
      "customerId": "6929843e2c4653277440acc0",
      "countryCode": "US",
      "createdAt": "2025-11-28T11:15:10.812Z",
      "updatedAt": "2025-11-28T11:15:10.812Z"
    },
    {
      "name": "Daniel Obirije",
      "email": "daniel@example.com",
      "phone": "+2347049861191",
      "customerId": "6930610b0d8aab4a00b3f918",
      "countryCode": "NG",
      "createdAt": "2025-12-03T16:10:51.291Z",
      "updatedAt": "2025-12-03T16:10:51.291Z"
    }
  ],
  "total": 1448,
  "page": 0
}

Authorizations

Headers

Query Parameters

Response