SDKs & Libraries

Official API Express SDKs handle authentication, request formatting, retry logic, and error handling out of the box. Install in seconds, integrate in minutes. All SDKs are open-source and available on GitHub.

Overview

SDKs are optional — you can always call the API directly with HTTP requests. But for production applications, SDKs provide real value:

  • Automatic authentication — Set your key once, every request includes it
  • Typed methods per API — client.recharge.send(...), client.kyc.verifyPan(...)
  • Built-in retry logic — Handles 429s and 5xx errors with exponential backoff
  • Consistent error handling — Throws typed exceptions instead of generic HTTP errors
  • Automatic environment switching — Sandbox vs production with one flag
  • Webhook signature verification — One-line helpers for verifying event signatures
SDK Package Version Status
Node.js@apiexpress/sdk1.4.0Official
Pythonapiexpress1.2.0Official
PHPapiexpress/sdk1.0.3Official
Gogithub.com/apiexpress/go0.9.1Community
Rubyapiexpress0.8.0Community
Javain.apiexpress:sdk0.7.2Community
💡
All SDKs are on GitHub. Report issues, submit pull requests, or fork them for your own use — they're MIT licensed.

Node.js SDK

Official

Installation

npm install @apiexpress/sdk

Or with yarn:

yarn add @apiexpress/sdk

Initialize the client

const { ApiExpress } = require('@apiexpress/sdk');

const client = new ApiExpress({
  apiKey: process.env.API_KEY,
  environment: 'production' // or 'sandbox'
});

With TypeScript (recommended):

import { ApiExpress } from '@apiexpress/sdk';

const client = new ApiExpress({
  apiKey: process.env.API_KEY!,
  environment: process.env.NODE_ENV === 'production' ? 'production' : 'sandbox'
});

Basic usage

// Weather API
const weather = await client.weather.get({
  city: 'Mumbai'
});
console.log(weather.temp); // 31.5

// Mobile Recharge API
const recharge = await client.recharge.send({
  mobile: '9876543210',
  operator: 'auto',
  amount: 199
});
console.log(recharge.transaction_id);

// KYC PAN verification
const kyc = await client.kyc.verifyPan({
  pan: 'ABCDE1234F',
  name: 'Arjun Sharma'
});
console.log(kyc.verified); // true

Error handling

const { ApiExpressError } = require('@apiexpress/sdk');

try {
  await client.recharge.send({ /* ... */ });
} catch (error) {
  if (error instanceof ApiExpressError) {
    console.error(error.code);        // 'RATE_LIMIT_EXCEEDED'
    console.error(error.message);     // 'Too many requests.'
    console.error(error.statusCode);  // 429
    console.error(error.requestId);   // 'req_1a2b3c4d5e6f'
  }
}

Automatic retry

The SDK retries 429s and 5xx errors automatically (3 attempts by default):

const client = new ApiExpress({
  apiKey: process.env.API_KEY,
  maxRetries: 5 // optional, default: 3
});

Webhook verification

const { verifyWebhook } = require('@apiexpress/sdk');

app.post('/webhooks/apiexpress',
  express.raw({ type: 'application/json' }),
  (req, res) => {
    const isValid = verifyWebhook({
      payload: req.body.toString(),
      signature: req.headers['x-apix-signature'],
      secret: process.env.WEBHOOK_SECRET
    });

    if (!isValid) return res.status(401).send('Invalid signature');

    const event = JSON.parse(req.body.toString());
    // Handle event...

    res.status(200).send('OK');
  }
);

Python SDK

Official

Installation

pip install apiexpress

Initialize the client

from apiexpress import ApiExpress

client = ApiExpress(
    api_key=os.environ["API_KEY"],
    environment="production"  # or "sandbox"
)

Basic usage

# Weather API
weather = client.weather.get(city="Mumbai")
print(weather.temp)  # 31.5

# Mobile Recharge API
recharge = client.recharge.send(
    mobile="9876543210",
    operator="auto",
    amount=199
)
print(recharge.transaction_id)

# KYC PAN verification
kyc = client.kyc.verify_pan(
    pan="ABCDE1234F",
    name="Arjun Sharma"
)
print(kyc.verified)  # True

Error handling

from apiexpress import ApiExpressError

try:
    client.recharge.send(mobile="...", amount=199)
except ApiExpressError as e:
    print(e.code)         # 'RATE_LIMIT_EXCEEDED'
    print(e.message)      # 'Too many requests.'
    print(e.status_code)  # 429
    print(e.request_id)   # 'req_1a2b3c4d5e6f'

Automatic retry

client = ApiExpress(
    api_key=os.environ["API_KEY"],
    max_retries=5  # default: 3
)

Webhook verification (Flask example)

from apiexpress import verify_webhook
from flask import Flask, request

app = Flask(__name__)

@app.route('/webhooks/apiexpress', methods=['POST'])
def handle_webhook():
    raw_body = request.get_data(as_text=True)
    signature = request.headers.get('X-APIX-Signature')

    if not verify_webhook(
        payload=raw_body,
        signature=signature,
        secret=os.environ["WEBHOOK_SECRET"]
    ):
        return "Invalid signature", 401

    event = request.get_json()
    # Handle event...
    return "OK", 200

PHP SDK

Official

Installation

composer require apiexpress/sdk

Initialize the client

<?php
use ApiExpress\ApiExpress;

$client = new ApiExpress([
    'api_key' => getenv('API_KEY'),
    'environment' => 'production' // or 'sandbox'
]);

Basic usage

<?php
// Weather API
$weather = $client->weather->get(['city' => 'Mumbai']);
echo $weather->temp; // 31.5

// Mobile Recharge API
$recharge = $client->recharge->send([
    'mobile' => '9876543210',
    'operator' => 'auto',
    'amount' => 199
]);
echo $recharge->transaction_id;

// KYC PAN verification
$kyc = $client->kyc->verifyPan([
    'pan' => 'ABCDE1234F',
    'name' => 'Arjun Sharma'
]);
var_dump($kyc->verified); // true

Error handling

<?php
use ApiExpress\ApiExpressException;

try {
    $client->recharge->send(['mobile' => '...', 'amount' => 199]);
} catch (ApiExpressException $e) {
    echo $e->getCode();        // 'RATE_LIMIT_EXCEEDED'
    echo $e->getMessage();     // 'Too many requests.'
    echo $e->getHttpStatus();  // 429
    echo $e->getRequestId();   // 'req_1a2b3c4d5e6f'
}

Webhook verification

<?php
use ApiExpress\Webhook;

$rawBody = file_get_contents('php://input');
$signature = $_SERVER['HTTP_X_APIX_SIGNATURE'] ?? '';

$isValid = Webhook::verify([
    'payload' => $rawBody,
    'signature' => $signature,
    'secret' => getenv('WEBHOOK_SECRET')
]);

if (!$isValid) {
    http_response_code(401);
    exit('Invalid signature');
}

$event = json_decode($rawBody, true);
// Handle event...

http_response_code(200);
echo 'OK';

Community SDKs

These SDKs are maintained by the community. They're not officially supported by API Express, but they're actively maintained and widely used.

Go

Community
go get github.com/apiexpress/go
import "github.com/apiexpress/go"

client := apiexpress.NewClient(os.Getenv("API_KEY"))

weather, err := client.Weather.Get("Mumbai")
if err != nil {
    log.Fatal(err)
}
fmt.Println(weather.Temp)

Ruby

Community
gem install apiexpress
require 'apiexpress'

client = ApiExpress::Client.new(api_key: ENV['API_KEY'])

weather = client.weather.get(city: 'Mumbai')
puts weather.temp

Java

Community
<dependency>
  <groupId>in.apiexpress</groupId>
  <artifactId>sdk</artifactId>
  <version>0.7.2</version>
</dependency>
ApiExpressClient client = new ApiExpressClient(System.getenv("API_KEY"));

WeatherResponse weather = client.weather().get("Mumbai");
System.out.println(weather.getTemp());

Best Practices

Always use environment variables for API keys

Never hardcode API keys in your source code. Use environment variables or a secrets manager. Every SDK reads from whatever you pass, so pass from env:

// ✅ Correct
const client = new ApiExpress({
  apiKey: process.env.API_KEY,
  environment: process.env.NODE_ENV === 'production' ? 'production' : 'sandbox'
});

// ❌ Never do this
const client = new ApiExpress({
  apiKey: 'sk_live_1a2b3c4d5e6f...'
});

Use the SDK's automatic retry

All official SDKs implement exponential backoff with jitter for 429 and 5xx errors. Don't disable this unless you have a specific reason.

Handle typed errors, not raw HTTP errors

SDKs throw typed exceptions. Catch them explicitly instead of parsing HTTP responses yourself:

// ✅ Correct
try {
  await client.recharge.send({ /* ... */ });
} catch (error) {
  if (error.code === 'RATE_LIMIT_EXCEEDED') {
    // Wait and retry
  }
}

// ❌ Not recommended
const res = await fetch(url);
if (res.status === 429) { /* ... */ }

Use webhook verification helpers

Every SDK includes a one-line signature verification helper. Never process a webhook event without verifying the signature first.

Upgrade SDKs regularly

SDK updates include performance improvements, new API endpoints, and security fixes. Keep them up to date — most dependency managers make this trivial.

# Node.js
npm update @apiexpress/sdk

# Python
pip install --upgrade apiexpress

# PHP
composer update apiexpress/sdk
✅
Not using an SDK? That's fine — you can call the API directly with any HTTP client. SDKs are convenience, not a requirement. All endpoints work with plain REST calls.

Related Documentation

Ready to build?

Install an SDK and Ship Your First Integration Today

Pick your language, install the SDK, and make your first API call in minutes. Your first 1,000 API calls are free.

No credit card required 1,000 free API calls Open-source SDKs MIT licensed