API Introduction

BatiB2B developer reference

The BatiB2B API

Sell data, airtime, cable TV subscriptions and electricity from your own application.

The API is REST over HTTPS. Send request bodies as JSON and expect JSON back. Every purchase is paid for from your BatiB2B wallet, so keep it funded.

Base URL https://batib2b.com.ng/api
Send these headers with every request
HTTP
Accept: application/json
Content-Type: application/json
Authorization: Bearer YOUR_API_TOKEN

Quick start

  1. Create an account, verify your email and set your 4-digit transaction PIN.
  2. Call Get an API token with your email and password, then keep the token safe on your server.
  3. Try your integration while your account is in test mode. Nothing is charged.
  4. Fund your wallet, switch the API mode to live on your profile page, and start vending.

Your token and transaction PIN give access to your wallet. Call the API from your server only, never from a browser or mobile app.

Responses & statuses

Every response has a success boolean. Purchase (vend) responses also carry a vend_status, which is what tells you whether value was delivered:

vend_statusMeaningWhat to do
successful Value was delivered to the recipient. Give value to your customer.
processing The order was accepted and is still being completed. Do not retry. Check it later with Check a transaction.
failed The order failed. Your wallet has been refunded in full. You can retry with a new custom_ref.

A vend can return "success": true together with "vend_status": "failed". Always decide on vend_status, not on success alone.

You are charged the face value of every product. Your commission on each successful purchase is paid into your commissions wallet, which you can move to your main wallet from the dashboard.

Test mode

New accounts start in test mode. In test mode every vend request that passes validation returns a mock successful response. No value is delivered, your wallet is not charged and no transaction is recorded.

Switch between test and live on your profile page under API settings.

Errors & limits

HTTP statusWhen
200The request was handled. For vends, check vend_status. Some errors, such as a suspended account or a rejected data purchase, also return 200 with "success": false and a message.
401The bearer token is missing or invalid.
422Validation failed. The message lists what is wrong.
429Too many requests. The limit is 60 requests per minute per account.
500An airtime, cable or electricity purchase could not be completed, for example an invalid transaction PIN or insufficient wallet balance. The message gives the reason.
Error responses look like this
JSON
{
    "success": false,
    "message": "Insufficient wallet balance..Please topup wallet to be able to vend"
}

Authentication

Get an API token

POST /login No token needed

Exchange your account email and password for a bearer token. Send the token in the Authorization header of every other request.

Parameters
ParameterDescription
email string · required Your account email address
password string · required Your account password
Example request
cURL
curl -X POST "https://batib2b.com.ng/api/login" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{"email":"you@business.com","password":"your-password"}'
Example responses
JSON · 200
{
    "success": true,
    "message": "User logged in successfully",
    "data": {
        "token": "12|Xy3kP0qv..."
    }
}

Networks

List networks

GET /networks Requires token

Returns the mobile networks and their IDs. Use the ID as network_id when vending airtime or filtering data plans.

Example request
cURL
curl -X GET "https://batib2b.com.ng/api/networks" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
Example responses
JSON · 200
{
    "success": true,
    "message": "fetched successfully",
    "data": [
        {
            "id": 1,
            "name": "MTN"
        }
    ]
}

Data

List data plans

GET /data/plans/{network_id?} Requires token

Returns the available data plans. Pass a network ID in the URL to get the plans for one network only.

Parameters
ParameterDescription
network_id integer · optional URL segment. Limits the list to one network
Example request
cURL
curl -X GET "https://batib2b.com.ng/api/data/plans/{network_id?}" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
Example responses
JSON · 200
{
    "success": true,
    "data": [
        {
            "id": 4,
            "name": "1GB - 30 Days",
            "network": {
                "id": 1,
                "name": "MTN"
            },
            "type": "SME",
            "price": 300
        }
    ],
    "message": "Data Plans fetched successfully"
}

Buy data

POST /data/vend Requires token

Buys a data plan for a phone number. Your wallet is charged the plan price.

Parameters
ParameterDescription
plan_id integer · required ID of the data plan, from List data plans
recipient string · required Phone number to receive the data. Exactly 11 digits
transaction_pin string · required Your 4-digit transaction PIN
custom_ref string · required Your own unique reference for this order. Use it to check the status later
allow_ported_no boolean · optional Set to true to skip the check that the number belongs to the plan's network
Example request
cURL
curl -X POST "https://batib2b.com.ng/api/data/vend" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"plan_id":4,"recipient":"08031234567","transaction_pin":"1234","custom_ref":"ORDER-10001"}'
Example responses
JSON · 200
{
    "success": true,
    "vend_status": "successful",
    "data": []
}

Airtime

Buy airtime

POST /airtime/vend Requires token

Sends airtime to a phone number. Your wallet is charged the airtime amount.

Parameters
ParameterDescription
network_id integer · required ID of the network, from List networks
recipient string · required Phone number to receive the airtime
amount integer · required Airtime amount in naira. Minimum 50, maximum 50,000
transaction_pin string · required Your 4-digit transaction PIN
custom_ref string · required Your own unique reference for this order
Example request
cURL
curl -X POST "https://batib2b.com.ng/api/airtime/vend" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"network_id":1,"recipient":"08031234567","amount":500,"transaction_pin":"1234","custom_ref":"ORDER-10002"}'
Example responses
JSON · 200
{
    "success": true,
    "vend_status": "successful",
    "data": []
}

Cable TV

List cable plans

GET /cable/plans/{type} Requires token

Returns the plans for one cable provider.

Parameters
ParameterDescription
type string · required URL segment. One of dstv, gotv, startimes
Example request
cURL
curl -X GET "https://batib2b.com.ng/api/cable/plans/{type}" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
Example responses
JSON · 200
{
    "success": true,
    "message": "Cable plans fetched successfully",
    "data": [
        {
            "id": 2,
            "name": "GOtv Jolli",
            "type": "gotv",
            "amount": 5800
        }
    ]
}

Validate a smart card number

POST /cable/validate Requires token

Confirms a smart card / IUC number and returns the customer name. Do this before vending.

Parameters
ParameterDescription
type string · required One of dstv, gotv, startimes
smart_card_no numeric · required The smart card / IUC number
Example request
cURL
curl -X POST "https://batib2b.com.ng/api/cable/validate" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"type":"gotv","smart_card_no":"2012345678"}'
Example responses
JSON · 200
{
    "success": true,
    "msg": "Operation successful",
    "data": {
        "customer_name": "JOHN DOE",
        "customer_no": ""
    }
}

Pay a cable subscription

POST /cable/vend Requires token

Pays for a cable plan on a smart card. Your wallet is charged the plan amount.

Parameters
ParameterDescription
plan_id integer · required ID of the cable plan, from List cable plans
smart_card_no string · required The smart card / IUC number
transaction_pin string · required Your 4-digit transaction PIN
duration integer · optional Number of months, up to 12. Defaults to 1
custom_ref string · optional Your own unique reference for this order
Example request
cURL
curl -X POST "https://batib2b.com.ng/api/cable/vend" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"plan_id":2,"smart_card_no":"2012345678","transaction_pin":"1234","custom_ref":"ORDER-10003"}'
Example responses
JSON · 200
{
    "success": true,
    "vend_status": "successful",
    "data": []
}

Electricity

List discos

GET /power/discos Requires token

Returns the electricity distribution companies and their IDs.

Example request
cURL
curl -X GET "https://batib2b.com.ng/api/power/discos" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
Example responses
JSON · 200
{
    "success": true,
    "message": "Discos fetch successfully",
    "data": [
        {
            "id": 1,
            "name": "Ikeja Electric",
            "short_name": "IKEDC"
        }
    ]
}

Validate a meter number

POST /power/validate Requires token

Confirms a meter number and returns the customer name and address. Do this before vending.

Parameters
ParameterDescription
disco_id integer · required ID of the disco, from List discos
meter_no numeric · required The meter number
type string · required prepaid or postpaid
Example request
cURL
curl -X POST "https://batib2b.com.ng/api/power/validate" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"disco_id":1,"meter_no":"45012345678","type":"prepaid"}'
Example responses
JSON · 200
{
    "success": true,
    "data": {
        "customer_name": "JOHN DOE",
        "customer_address": "12 ALLEN AVENUE IKEJA"
    }
}

Buy electricity

POST /power/vend Requires token

Buys electricity units for a meter. Your wallet is charged the amount. For prepaid meters the token is returned in data.token.

Parameters
ParameterDescription
disco_id integer · required ID of the disco, from List discos
type string · required prepaid or postpaid
meter_no numeric · required The meter number
amount integer · required Amount in naira. Minimum 1,000
transaction_pin string · required Your 4-digit transaction PIN
custom_ref string · required Your own unique reference for this order
Example request
cURL
curl -X POST "https://batib2b.com.ng/api/power/vend" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"disco_id":1,"type":"prepaid","meter_no":"45012345678","amount":5000,"transaction_pin":"1234","custom_ref":"ORDER-10004"}'
Example responses
JSON · 200
{
    "success": true,
    "vend_status": "successful",
    "data": {
        "token": "1234-5678-9012-3456-7890"
    }
}

Transactions

Check a transaction

GET /transaction/{custom_ref} No token needed

Returns the current status of an order, looked up by the custom_ref you sent when vending. Use this to follow up on orders that came back as processing.

Parameters
ParameterDescription
custom_ref string · required URL segment. The reference you sent with the vend request
Example request
cURL
curl -X GET "https://batib2b.com.ng/api/transaction/{custom_ref}" \
  -H "Accept: application/json"
Example responses
JSON · 200
{
    "success": true,
    "message": "Transaction successfully fetched",
    "data": {
        "ref_id": "AB123456",
        "desc": "Network: MTN",
        "custom_ref": "ORDER-10002",
        "type": "AirtimePurchase",
        "request_ip": "102.89.0.1",
        "status": "successful"
    }
}

Network & disco IDs

The current IDs on this platform. They are also returned by List networks and List discos.

Networks
network_idName
1MTN
2Etisalat
3Airtel
4Glo
Discos
disco_idNameShort name
1Ikeja ElectricIKEDC
2Ibadan ElectricIBEDC
3Eko ElectricEKEDC
4Kano ElectricKEDC
5Abuja ElectricAEDC
6Jos ElectricJEDC
7Kaduna ElectricKAEDC
8Enugu ElectricEEDC
9Port Harcourt ElectricPHEDC
10Benin ElectricBEDC
11Yola ElectricYEDC