Afriex SDK
API Reference

Customers API

Manage customers with KYC support.

Create Customer

const customer = await afriex.customers.create({
  fullName: "John Doe",
  email: "john@example.com",
  phone: "+1234567890",
  countryCode: "US",
  meta: {
    // Optional metadata
  },
});

Parameters:

FieldTypeRequiredDescription
fullNamestringYesCustomer's full name
emailstringYesEmail address
phonestringYesPhone number with country code
countryCodestringYesISO 3166-1 alpha-2 code, (e.g US)
metaobject-Additional metadata

The response uses name, not fullName — the API responds with a Customer object whose full-name field is name.

Get Customer

const customer = await afriex.customers.get("customer-id");

List Customers

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

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

email and phone are optional exact-match filters for narrowing the list.

Update Customer

Partially update a customer's profile. Send at least one of fullName, email, or phone; omitted fields are left unchanged.

const customer = await afriex.customers.update("customer-id", {
  fullName: "Jane Doe",
});

Update KYC

The KYC document map is sent directly as the request body — do not wrap it in a kyc field.

const customer = await afriex.customers.updateKyc("customer-id", {
  PASSPORT: "AB123456",
  DATE_OF_BIRTH: "1990-05-15",
});

// The saved documents come back under meta.kyc.data
console.log(customer.meta?.kyc?.data);
// { PASSPORT: 'AB123456', DATE_OF_BIRTH: '1990-05-15' }

Valid keys (KycDocumentType): REPRESENTATIVE_TYPE, DATE_OF_BIRTH, ADDRESS, BANK_STATEMENT, BUSINESS_CERTIFICATE, ID_FRONT, ID_BACK, SELFIE, PROOF_OF_ADDRESS, PROOF_OF_INCOME, DRIVER_LICENSE, PASSPORT, NATIONAL_ID, PAYMENT_METHOD, RESIDENCE_PERMIT, VEHICLE_REGISTRATION, VOTER_ID, OTHERS.

COUNTRY, PHONE and BVN are not accepted here — the API rejects them with INVALID_KYC_DOCUMENT_TYPE. Set the country with countryCode on create, the phone with update(), and verify a BVN with verify().

Each call replaces the stored document map rather than merging into it. Send every document you want to keep on every call.

Verify Customer

Run an identity verification against a customer document. Today the only supported docType is BVN (Nigeria). Verification is rate limited per business.

const customer = await afriex.customers.verify("customer-id", {
  docType: "BVN",
  docValue: "22222222222",
});

Delete Customer

await afriex.customers.delete("customer-id");

On this page