Get a data bundle
/airtime/v1/products/{idOrCode}Returns one data bundle by its id or code. Use it to check that a bundle is still on sale, and its price, before you offer it.
Path parameters
- The bundle's id (prod_…) or code, from List data bundles. You can send /products/mtn-data-15gb-30d for the same bundle.Example:
prod_p4nzx9xp335h
Example request
- curl
- Node.js
- Python
- PHP
curl "https://sandbox-api.ponitor.com/airtime/v1/products/prod_p4nzx9xp335h" \
-H "apiKey: $PONITOR_API_KEY"
const response = await fetch('https://sandbox-api.ponitor.com/airtime/v1/products/prod_p4nzx9xp335h', {
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/prod_p4nzx9xp335h",
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/prod_p4nzx9xp335h');
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
- 404
- 429
OK. The bundle, as a product object.
{
"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"
}
Bad Request. The value isn't a bundle id or a bundle code (E01002). An id is prod_ and 12 characters. A code is up to 64 lowercase letters, digits and dashes, starting with a letter.
{
"error": {
"type": "bad_request_error",
"code": "E01002",
"name": "BadRequest",
"message": "idOrCode must be a product id (prod_…) or a product code from GET /products",
"doc_url": "https://docs.ponitor.com/api/errors#E01002",
"request_id": "1e2f3a4b-5c6d-4e7f-8a9b-0c1d2e3f4a5b"
}
}
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.
Not Found. No bundle with that id or code is on sale (E01005). It doesn't exist, or it was withdrawn.
{
"error": {
"type": "not_found_error",
"code": "E01005",
"name": "NotFound",
"message": "product mtn-data-15gb-30d not found",
"doc_url": "https://docs.ponitor.com/api/errors#E01005",
"request_id": "6b7c8d9e-0f1a-4b2c-8d3e-4f5a6b7c8d9e"
}
}
Too Many Requests. Your team went over its rate limit (E01011). Wait, then try again.