API Documentation

Integrate VTU services into your application

API User Access Required

To use these API endpoints, you must upgrade your account to an API User role. API users get special pricing and programmatic access to all VTU services.

Visit your dashboard to request an API user upgrade.

Base URL

url
https://api.yourapp.com

Network IDs

MTN

ID: 1

AIRTEL

ID: 2

GLO

ID: 3

9MOBILE

ID: 4

Electricity Distribution Companies (DISCOs)

Ikeja Electric

ID: 1

Eko Electric

ID: 2

Abuja Electric

ID: 3

Kano Electric

ID: 4

Port Harcourt Electric

ID: 5

Authentication

All API requests require authentication using a Bearer token

POST/v1/auth/login

Request

bash
curl -X POST https://api.yourapp.com/v1/auth/login \
  -H "Content-Type: application/json" \
  -d '{
    "email": "your-email@example.com",
    "password": "your-password"
  }'

Response

json
{
  "ok": true,
  "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "user": {
    "id": "user_id",
    "fullName": "John Doe",
    "email": "john@example.com",
    "role": "api-user"
  }
}

Get User Profile

Retrieve authenticated user information and wallet balance

GET/v1/api/me

Request

bash
curl -X GET https://api.yourapp.com/v1/api/me \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

Response

json
{
  "ok": true,
  "user": {
    "id": "user_id",
    "fullName": "John Doe",
    "email": "john@example.com",
    "phone": "+2348012345678",
    "role": "api-user"
  },
  "wallet": {
    "balanceKobo": 500000
  }
}

Get Data Plans

Fetch available data plans with API user pricing

GET/v1/api/plans

Request

bash
curl -X GET "https://api.yourapp.com/v1/api/plans?service=data&networkId=1" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

Response

json
{
  "ok": true,
  "items": [
    {
      "id": "plan_id",
      "service": "data",
      "networkId": 1,
      "network": "MTN",
      "planType": "SME",
      "planName": "1GB - 30 Days",
      "validity": "30 Days",
      "price": 25000
    }
  ]
}

Buy Data

Purchase data for a phone number

POST/v1/api/buy-data

Request

bash
curl -X POST https://api.yourapp.com/v1/api/buy-data \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "planId": "plan_id_here",
    "phone": "08012345678"
  }'

Response

json
{
  "ok": true,
  "transaction": {
    "_id": "transaction_id",
    "kind": "purchase_data",
    "status": "success",
    "amountKobo": 25000,
    "createdAt": "2024-01-01T00:00:00.000Z"
  }
}

Buy Airtime

Purchase airtime for a phone number

POST/v1/api/buy-airtime

Request

bash
curl -X POST https://api.yourapp.com/v1/api/buy-airtime \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "networkId": 1,
    "phone": "08012345678",
    "amountKobo": 10000
  }'

Response

json
{
  "ok": true,
  "transaction": {
    "_id": "transaction_id",
    "kind": "purchase_airtime",
    "status": "success",
    "amountKobo": 10000
  }
}

Get Cable TV Plans

Fetch available cable TV subscription plans

GET/v1/api/cable-plans

Request

bash
curl -X GET "https://api.yourapp.com/v1/api/cable-plans?cableId=1" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

Response

json
{
  "ok": true,
  "items": [
    {
      "id": "plan_id",
      "cableId": 1,
      "cable": "DSTV",
      "planName": "Compact Plus",
      "price": 1450000
    }
  ]
}

Pay for TV Subscription

Subscribe to a cable TV plan

POST/v1/api/pay-tv

Request

bash
curl -X POST https://api.yourapp.com/v1/api/pay-tv \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "cablePlanId": "plan_id_here",
    "smartCardNumber": "1234567890"
  }'

Response

json
{
  "ok": true,
  "transaction": {
    "_id": "transaction_id",
    "kind": "purchase_tv",
    "status": "success",
    "amountKobo": 1450000
  }
}

Pay Electricity Bill

Pay for electricity using meter number

POST/v1/api/pay-electricity

Request

bash
curl -X POST https://api.yourapp.com/v1/api/pay-electricity \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "discoId": 1,
    "meterNumber": "12345678901",
    "meterType": "prepaid",
    "amountKobo": 500000
  }'

Response

json
{
  "ok": true,
  "transaction": {
    "_id": "transaction_id",
    "kind": "purchase_electricity",
    "status": "success",
    "amountKobo": 500000
  }
}

Error Handling

All API responses follow a consistent format. Successful responses have ok: true, while errors have ok: false with a message field explaining the error.

json
{
  "ok": false,
  "message": "Insufficient wallet balance"
}