List data bundles
/airtime/v1/productsReturns the data bundles on sale. Each bundle has an id and a code. Send either one to buy the bundle.
We add and withdraw bundles from time to time. Call this endpoint for the current list instead of hard-coding bundles. Your key needs the Airtime API turned on. See API keys and base URLs. To buy one, see Buy airtime or data.
Query parameters
Example request
- curl
- Node.js
- Python
- PHP
curl "https://sandbox-api.ponitor.com/airtime/v1/products?carrier=LONESTAR&type=DATA" \
-H "apiKey: $PONITOR_API_KEY"
const response = await fetch('https://sandbox-api.ponitor.com/airtime/v1/products?carrier=LONESTAR&type=DATA', {
headers: { apiKey: process.env.PONITOR_API_KEY },
});
console.log(response.status, await response.json());
import os
import requests
response = requests.get(
"https://sandbox-api.ponitor.com/airtime/v1/products?carrier=LONESTAR&type=DATA",
headers={"apiKey": os.environ["PONITOR_API_KEY"]},
timeout=30,
)
print(response.status_code, response.json())
<?php
$ch = curl_init('https://sandbox-api.ponitor.com/airtime/v1/products?carrier=LONESTAR&type=DATA');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['apiKey: ' . getenv('PONITOR_API_KEY')],
]);
$body = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
echo $status, ' ', $body, PHP_EOL;
Responses
- 200
- 400
- 401
- 429
OK. The bundles on sale, each a product object. The list can be empty.
{
"products": [
{
"id": "prod_hceed9ywq1er",
"code": "mtn-data-1-8gb-7d",
"type": "DATA",
"carrier": "LONESTAR",
"name": "Lonestar Cell MTN 1.8GB, 7 days",
"data": "1.8GB",
"validity": "7 days",
"price": 2,
"currency": "USD"
},
{
"id": "prod_p4nzx9xp335h",
"code": "mtn-data-15gb-30d",
"type": "DATA",
"carrier": "LONESTAR",
"name": "Lonestar Cell MTN 15GB, 30 days",
"data": "15GB",
"validity": "30 days",
"price": 9,
"currency": "USD"
}
]
}
These bundles are examples. The bundles and prices on sale are what this endpoint returns.
Bad Request. carrier or type isn't one of the values above (E01001).
{
"error": {
"type": "validation_error",
"code": "E01001",
"name": "ValidationError",
"message": "The request has 1 problem.",
"doc_url": "https://docs.ponitor.com/api/errors#E01001",
"request_id": "9a0b1c2d-3e4f-4a5b-8c6d-7e8f9a0b1c2d",
"param": "carrier",
"details": [
{ "param": "carrier", "message": "carrier must be ORANGE or LONESTAR" }
]
}
}
Every error has this error object. The body also still carries fields from before codes, which are deprecated. See The error body.
Unauthorized. The API key is missing (E02001), wrong or revoked (E02002), or sent to the other base URL (E02003). See API keys and base URLs.
Too Many Requests. Your team went over its rate limit (E01011). Wait, then try again.
The product object
| Field | Description |
|---|---|
id | The bundle's ID, prod_ and 12 characters. It never changes, so store it. Send it as productId to buy. |
code | A readable code, such as mtn-data-15gb-30d. Lowercase letters, digits and dashes, never an underscore. Send it as productCode to buy, or use it instead of the ID to get the bundle. |
type | DATA. |
carrier | ORANGE or LONESTAR (Lonestar Cell MTN). The bundle works only for numbers on that network. |
name | A name you can show your customers, such as Lonestar Cell MTN 15GB, 30 days. |
data | The data allowance as text, such as 350MB, 1.8GB or 1TB. 1 GB is 1024 MB. |
validity | How long the bundle lasts after it arrives, as text, such as 1 day, 7 days or 30 days. |
price | What your account is charged, in currency. No added fees. |
currency | USD. |