Skip to content

Calculate amount ↔ SMS count

POST /calculate is the two-way pricing calculator: pass an amount, get back how many SMS it buys; pass an SMS count, get back the amount needed to send them. It mirrors the in-dashboard widget so external callers don’t have to re-implement the average-price aggregation client-side.

The conversion uses the average price across every (country × telephone network × pricing) tuple configured on your merchant, in your wallet currency. If the merchant has no pricings configured the endpoint returns 400.

Pass mode: "amount_to_sms" with a positive amount. The response includes the floor of amount / average_price — never more SMS than the amount actually buys.

Terminal window
curl $BASE_URL/api/v1/lisoloo/sms-api/calculate \
-X POST \
-H "app-key: $LISOLOO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"mode": "amount_to_sms",
"amount": 10
}'

Pass mode: "sms_to_amount" with a positive sms_count. The response includes sms_count × average_price rounded to two decimals.

Terminal window
curl $BASE_URL/api/v1/lisoloo/sms-api/calculate \
-X POST \
-H "app-key: $LISOLOO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"mode": "sms_to_amount",
"sms_count": 2000
}'
{
"status_code": 200,
"data": {
"mode": "amount_to_sms",
"amount": 10.00,
"sms_count": 500,
"average_price": 0.0200,
"currency": "USD",
"currency_symbol": "$"
}
}
FieldDescription
modeEchoed back from the request.
amountWallet amount. Input value when mode='amount_to_sms'; computed (rounded to 2 decimals) when mode='sms_to_amount'.
sms_countSMS count. Computed (floored, never above what the amount buys) when mode='amount_to_sms'; input value when mode='sms_to_amount'.
average_pricePer-SMS price used for the conversion, in currency, rounded to 4 decimals.
currencyThree-letter ISO 4217 code — your wallet currency.
currency_symbolDisplay symbol for currency (e.g. $, , FC).
FieldTypeRequiredDescription
modeenumYesamount_to_sms or sms_to_amount.
amountfloatWhen mode='amount_to_sms'0 ≤ amount ≤ 10 000 000.
sms_countintWhen mode='sms_to_amount'0 ≤ sms_count ≤ 10 000 000.

0 is accepted as input — the response will simply contain 0 for the computed field too, matching how the dashboard widget clears its result.

The gateway pulls every pricing row configured on your merchant — each row covers one (country, telephone network) tuple — and averages them arithmetically in the wallet currency. There is no weighting by traffic volume; every configured destination contributes equally.

This makes the calculator a planning tool, not a per-message guarantee: an actual POST /send charges the exact pricing of each destination’s network, which may differ from the average reported here.

HTTPCauseFix
400"'amount' is required when mode='amount_to_sms'"mode='amount_to_sms' but no amount.Add amount.
400"'sms_count' is required when mode='sms_to_amount'"mode='sms_to_amount' but no sms_count.Add sms_count.
400Invalid modemode not in the enum.Use amount_to_sms or sms_to_amount (lowercase).
400 — no pricingThe merchant has no (country × network × pricing) rows configured.Configure pricings in the dashboard or contact support.