Base URLs
| Environment |
URL |
| Staging (testing) |
https://staging.be.airtime.mobi |
| Production |
https://be.airtime.mobi |
All paths in this document are relative to the base URL, for example
GET https://be.airtime.mobi/api/v2/wallets.
Authentication
Every request must carry the header x-api-key: <your API key>. No signature
or timestamp header is required on requests to the API.
- A missing or unknown API key returns HTTP 401 with code
2003
(invalid api key).
- The API key type must match the server: use a development key on
staging and a production key on production. A staging key does not
work on production and vice versa.
- Rate limit: each API key has a per-second request limit (default 20
requests per second).
POST /transaction/request and
POST /transaction/inquiry answer HTTP 429 when you go above it. Keep
your request rate under the limit on the other endpoints as well.
Response envelope
Every response is JSON:
{ "code": 200, "message": "success", "data": { } }
- Success:
code is 200, message is "success", and the payload is in
data.
- Error:
code is an Airtime error code (see Error codes), message is
the error text, and error is an optional array of detail strings.
data is absent.
- The
code in the body is the Airtime code, not the HTTP status. Many
business errors (insufficient balance, unknown product, transaction not
found, and so on) are returned with HTTP status 500 and a specific
body code. Rejections of a closed or unavailable product (code 1001)
are returned with HTTP status 400 instead. Always branch on the body
code.
Pagination
List endpoints return data.pagination and data.rows:
{ "pagination": { "page": 1, "per_page": 10, "total": 16, "total_pages": 2 },
"rows": [] }
Query parameters: page (default 1) and limit (default 10).
Money and currency
The platform base currency is USD. Your merchant account may have its
own currency (for example IDR); if it does not, amounts are in USD.
| Field |
Where |
Currency |
sales_price, promo_price, currency |
GET /products |
Your merchant currency (currency names it). A zero price is returned as null. |
amount |
transaction request, status, history, bulk, callback |
USD (base currency). This is the amount charged to your wallet. |
merchant_currency, amount_merchant |
transaction request, status, history, callback |
The same amount expressed in your merchant currency, fixed when the transaction was created. If your account has no merchant currency, this equals amount in USD. |
amount, base_currency |
GET /wallets |
Wallet balance in USD. |
currency_code, display_amount |
GET /wallets |
Wallet balance converted to your merchant currency. |
Because product prices are in your merchant currency while amount is in
USD, use amount_merchant to show the price of a transaction in your own
currency. The bulk endpoint response has no merchant_currency or
amount_merchant.
Transaction flow
-
GET /api/v2/wallets to check the balance (optional).
-
GET /api/v2/categories, GET /api/v2/operators and
GET /api/v2/products to discover what you can sell. Use the
product_id from /products.
- For bill-payment and some e-wallet products, call
POST /api/v2/transaction/inquiry first, then pass the returned
inquiry_no (where applicable) to the transaction request.
-
POST /api/v2/transaction/request with a unique reference_id. The
response status is PENDING and the wallet is charged immediately.
Sending the same reference_id again returns the existing transaction
instead of creating a second one.
- The final status (
SUCCESS or FAILED) is POSTed to your callback URL
(see Callback). If you do not receive it, poll
GET /api/v2/transaction/status?reference_id=....
-
GET /api/v2/transaction/history lists past transactions.
Transaction statuses: PENDING, SUCCESS, FAILED.
Testing on staging
GET|POST /api/v2/transaction/status accepts a dev parameter that
simulates a final status on staging only: 1 success, 2 failed,
3 pending. It is ignored on production.