API Documentation

Buy data programmatically from your own app, bot, or reseller platform. Grab your keys from Settings → API Keys in your dashboard.

Sandbox keys simulate every response and never touch your wallet or a real network — test with those first, then switch to Live keys when you're ready to go into production.

Authentication

Every request is authenticated with a header carrying your sandbox or live secret key:

Authorization: Token <your_secret_key>

Buy data

POST /api/data

Required: network, mobile_number, plan. Optional: request-id, Ported_number.

Example request

curl -X POST "https://usefooma.site/api/data" \
  -H "Authorization: Token sk_test_4558418757c99db6f8afe58e6ad2856dc2dfeb53" \
  -H "Content-Type: application/json" \
  -d '{
    "network": 1,
    "mobile_number": "08012345678",
    "plan": 101,
    "request-id": "order_123"
  }'

Example response

{
  "status": "success",
  "message": "Data Purchase Successful.",
  "response": "MTN 1GB SME (30 Days) sent to 08012345678",
  "request-id": "order_123",
  "reference": "USF_1_64f...",
  "service": "data",
  "amount": "300.00",
  "old_balance": "5000.00",
  "new_balance": "4700.00"
}

List data plans

GET /api/data_plan

Same key auth as above (sandbox or live). Returns the active plan catalog — use each plan's plan_id as the plan field when buying data.

curl "https://usefooma.site/api/data_plan" \
  -H "Authorization: Token sk_test_4558418757c99db6f8afe58e6ad2856dc2dfeb53"

Errors

StatusMeaning
401Invalid or missing API key
402Insufficient wallet balance
404That plan isn't available
422Missing or invalid fields
429Too many requests — slow down