AxeDz

v1.0

  • Overview
  • Quickstart
  • SDK
  • Authentication
  • Payment
  • API Reference
  • Errors

SDK

Use our official libraries to integrate AxeDz into your app quickly. They handle authentication, retries, and error messages so you can focus on your product.

Available languages

Official SDKs are available for Node.js and Python. SDKs for PHP and other languages are coming soon — you can always use the REST API directly in the meantime.

Node.js

Installation

bash
npm install axedz

Set up your client

Node.js
1const AxeDz = require("axedz");
2 
3const client = new AxeDz(process.env.AXEDZ_API_KEY);

Send an SMS

Node.js
1const sms = await client.sms.send({
2 to: "+213555123456",
3 message: "Your OTP is 482910",
4});
5 
6console.log(sms.id, sms.status);

Send an email

Node.js
1const email = await client.email.send({
2 to: "user@example.com",
3 subject: "Password reset",
4 body: "<p>Click the link to reset your password.</p>",
5});
6 
7console.log(email.id, email.status);

Check your balance

Node.js
1const wallet = await client.wallet.get();
2console.log(wallet.balance, wallet.currency); // balance in DZD

Python

Installation

bash
pip install axedz

Set up your client

Python
1from axedz import AxeDz
2import os
3 
4client = AxeDz(os.environ["AXEDZ_API_KEY"])

Send an SMS

Python
1sms = client.sms.send(
2 to="+213555123456",
3 message="Your OTP is 482910",
4)
5 
6print(sms.id, sms.status)

Send an email

Python
1email = client.email.send(
2 to="user@example.com",
3 subject="Password reset",
4 body="<p>Click the link to reset your password.</p>",
5)
6 
7print(email.id, email.status)

Handling errors

When a request fails, the SDK throws a clear error so you know exactly what went wrong and how to fix it:

  • ValidationError — something is wrong with your request (e.g. invalid phone number)
  • AuthorizationError — your API key is missing, invalid, or revoked
  • NotFoundError — the resource you requested does not exist
Node.js
1try {
2 await client.sms.send({ to: "invalid", message: "Hi" });
3} catch (err) {
4 if (err.code === "ValidationError") {
5 console.error(err.message);
6 }
7}