Skip to main content

SDK Overview

Official AfriRoute client libraries for six languages. Each SDK wraps the REST API — SMS, Voice, WhatsApp, Email, USSD, and Payments — with idiomatic types, automatic retries, and Bearer-token authentication so you can send your first message in minutes.

Supported Languages​

LanguagePackageInstallGuide
Node.jsafriroutenpm install afrirouteJavaScript
Pythonafriroutepip install afriroutePython
C# / .NETAfriRoutedotnet add package AfriRouteC#
Goafriroute-sdk/gogo get afriroute.ai/sdk-goGo
PHPafriroute/afriroutecomposer require afriroute/afriroutePHP
Javaai.afriroute:afrirouteMaven / GradleJava

Authentication​

Every SDK is initialized with your API key, sent as a Bearer token on each request to https://api.afriroute.ai:

Authorization: Bearer $AFRIROUTE_API_KEY

Find your keys under Settings → API Keys in the dashboard. Use a sandbox key for testing and a production key for live traffic.

What the SDKs Cover​

ServiceDescription
SMSSend and receive SMS across 54+ African countries
VoiceProgrammable voice calls and TTS
WhatsAppWhatsApp Business messaging
EmailTransactional and marketing email
USSDInteractive USSD sessions
PaymentsMobile money and wallet notifications

Common Configuration​

All SDKs accept the same options — a custom base URL (e.g. the sandbox), request timeout, and a maximum retry count. Retries use exponential back-off and automatically handle 429 rate-limit responses.

OptionDefaultPurpose
Base URLhttps://api.afriroute.ai/api/v1Point at sandbox or production
Timeout60 secondsPer-request timeout
Max retries5Automatic retry on transient errors

Sandbox base URL:

https://api.afriroute.ai

Choosing an SDK​

  • Node.js / Python — fastest path for scripts, serverless, and web backends.
  • C# / Java — strongly typed request/response models for enterprise stacks (Spring Boot, .NET, Android).
  • Go — context-aware, dependency-light client for high-throughput services.
  • PHP — drop-in for Laravel and Symfony applications.

Quick Example​

import Afriroute from "afriroute";

const client = new Afriroute("$AFRIROUTE_API_KEY");

await client.sms.send({
to: "+251900000000",
message: "Hello from AfriRoute",
senderId: "AfriRoute",
});

Error Handling​

Across all SDKs, failed requests raise a typed error (or return an error/err value in Go) carrying a machine-readable code, a human-readable message, and the HTTP status. Common codes include INVALID_API_KEY, INVALID_PHONE_NUMBER, INSUFFICIENT_BALANCE, and RATE_LIMIT_EXCEEDED. See each language guide for idiomatic handling.


Last Updated: May 2026 · Need help? Contact Support →