SDKs
Official typed, read-only client libraries for JavaScript/TypeScript and PHP.
We publish small, hand-written, read-only client libraries so you don't have to hand-roll
fetch/cURL calls. They wrap the public API (/public/v1), carry the
optional x-api-key header, and surface the error envelope as a typed
exception. No write access, no PII.
Both mirror the published OpenAPI contract and follow the same
versioning policy — treat response objects as open (new fields may
be added within v1).
JavaScript / TypeScript
npm install @ardent-africa/sdkWorks in Node 18+ and modern browsers (uses the global fetch).
import { ArdentClient, ArdentApiError } from '@ardent-africa/sdk';
// The key is optional (keyless works at a lower rate tier).
const ardent = new ArdentClient({ apiKey: process.env.ARDENT_API_KEY });
const { data, total } = await ardent.listCampaigns({ limit: 5, category: 'Education' });
const campaign = await ardent.getCampaign('clean-water-for-tamale');
const stats = await ardent.getStats();
try {
await ardent.getCampaign('does-not-exist');
} catch (err) {
if (err instanceof ArdentApiError && err.code === 'NOT_FOUND') {
// err.code, err.message, err.status, err.ref
}
}Every response is fully typed. List methods return { data, page, limit, total }.
PHP
composer require ardent-africa/sdkRequires PHP 7.4+ (ext-curl, ext-json only — no third-party packages).
use Ardent\Sdk\Client;
use Ardent\Sdk\ArdentApiException;
$ardent = new Client(['api_key' => getenv('ARDENT_API_KEY')]);
$page = $ardent->listCampaigns(['limit' => 5, 'category' => 'Education']);
foreach ($page['data'] as $campaign) {
echo $campaign['title'], "\n";
}
try {
$ardent->getCampaign('does-not-exist');
} catch (ArdentApiException $e) {
// $e->apiCode, $e->getMessage(), $e->httpStatus, $e->ref
}Methods return the decoded JSON as associative arrays.
Methods
Both SDKs expose the same surface:
listCampaigns · getCampaign · listPetitions · getPetition · listEvents · getEvent ·
listServices · getService · listCategories · listBlog · getBlogPost · getProfile ·
getStats.
Prefer to generate your own?
The OpenAPI spec lets you generate a client in any language. The official SDKs exist for the two ecosystems most of our integrators use (the WordPress plugin builds on the same patterns as the PHP client).
Last updated: 28 June 2026
