Retrieve available data plans for all supported networks.

Data Plans

Retrieve a list of all available data plans and their IDs for use with the Data Purchase endpoint.

Endpoint

GET https://example.com/api/data_plans

Request Headers

{
  "Accept": "application/json",
  "Authorization": "Bearer YOUR_API_TOKEN"
}

Example Request

curl -X GET https://example.com/api/data_plans \
  -H "Accept: application/json" \
  -H "Authorization: Bearer YOUR_API_TOKEN"

Response

Success (200)

Returns data plans grouped by network. Each plan includes its integer id which is used as the plan field in the Data Purchase request.

[
  {
    "id": 12,
    "size": "1",
    "volume": "GB",
    "validity": "30 days",
    "amount": 230,
    "network": "MTN",
    "type": "SME"
  },
  {
    "id": 15,
    "size": "2",
    "volume": "GB",
    "validity": "30 days",
    "amount": 460,
    "network": "MTN",
    "type": "SME"
  }
]

Network IDs

IDNetwork
1MTN
2Glo
39mobile
4Airtel

Filtered Data Plans

For more advanced filtering, use the filtered endpoint:

GET https://example.com/api/data-plans-prices/filtered

Query Parameters (All Optional)

ParameterTypeDescription
mobile_networkintegerFilter by network ID
data_plan_typeintegerFilter by plan type ID
min_pricenumericMinimum price
max_pricenumericMaximum price
validitystringFilter by validity period (e.g., "Monthly")

Example Request

curl -X GET "https://example.com/api/data-plans-prices/filtered?mobile_network=1&min_price=100&max_price=500" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer YOUR_API_TOKEN"

Success Response (200)

{
  "success": true,
  "data": [
    {
      "id": 1,
      "name": "MTN",
      "code": "mtn",
      "data_active": true,
      "data_plan_types": [
        {
          "id": 1,
          "name": "SME",
          "code": "sme",
          "active": true,
          "plans": [
            {
              "id": 12,
              "size": "1",
              "volume": "GB",
              "validity": "30 days",
              "validity_normalized": "Monthly",
              "amount": 230,
              "smart_earner_amount": 210,
              "affiliate_amount": 200,
              "top_user_amount": 195,
              "api_amount": 220,
              "formatted_price": "₦230.00",
              "active": true
            }
          ]
        }
      ]
    }
  ],
  "filters_applied": {
    "mobile_network": "MTN",
    "min_price": "100",
    "max_price": "500"
  },
  "total_plans": 8,
  "message": "Filtered plans retrieved successfully"
}

Error Response (500)

{
  "success": false,
  "message": "Failed to fetch filtered plans",
  "error": "Error details"
}

Filtered Plan Response Fields

FieldTypeDescription
idintegerPlan ID (use as plan in data purchase)
sizestringData size value
volumestringData unit (e.g., "GB", "MB")
validitystringRaw validity string
validity_normalizedstringNormalized validity (e.g., "Monthly", "Weekly")
amountnumberStandard price
smart_earner_amountnumberSmart earner price
affiliate_amountnumberAffiliate price
top_user_amountnumberTop user price
api_amountnumberAPI user price
formatted_pricestringFormatted price string (e.g., "₦230.00")
activebooleanWhether the plan is currently active

Notes

  • Plan IDs and pricing may change — always fetch the latest plans before displaying options to users
  • Use the returned plan id (integer) as the plan field in the Data Purchase request
  • The filtered endpoint provides more detailed pricing tiers for different user levels