MOR API v2 tariff rates
Returns the complete rate table for a tariff — retail destination groups with time-banded prices, optional custom rates, or wholesale/provider flat rate rows. Not prefix rate lookup — that is MOR API v2 rates (GET /rates). Parity with legacy MOR API tariff rates get (tariff_rates_get / get_tariff).
Retail behaviour matches the end-user GUI Rates screen (/tariffs/user_rates). Wholesale/provider behaviour matches SETTINGS → Tariffs → open a tariff → Rates for tariff.
Simple portal users call without tariff_id or user_id to receive their own tariff. Admin, reseller, and accountant callers may pass user_id or tariff_id per the rules below. For user and accountant callers, tariff_id is ignored when user_id is omitted — the JWT user's tariff is returned (legacy parity).
All endpoints require a valid Bearer token (see MOR API v2 authentication), user type admin, reseller, accountant, or user, and v2_tariff_rates_index (Read) on the user's API permission group (section Tariffs).
Quick start
Obtain a token, then (portal retail user):
curl -s -H "Authorization: Bearer $TOKEN" \ "https://your-mor.example/billing/api/v2/tariff_rates?additional_retail_info=1"
Wholesale or provider tariffs require pagination:
curl -s -H "Authorization: Bearer $TOKEN" \ "https://your-mor.example/billing/api/v2/tariff_rates?tariff_id=14&page=1&limit=100"
Endpoint
Base path: {Web_Dir}/api/v2/tariff_rates (for example /billing/api/v2/tariff_rates).
| Method | Path | Permission | Description |
|---|---|---|---|
| GET | /tariff_rates |
v2_tariff_rates_index |
Full tariff rate export. |
Query parameters
user_id— optional. Load the tariff (and custom rates) for another user. Admin, reseller, and accountant use cases; portal users typically omit this.tariff_id— optional. Select a tariff by ID when the caller is admin or reseller (and not usinguser_idonly). Ignored foruser/accountantwhenuser_idis blank.additional_retail_info—0or1; default0. When1, each retail/custom destination group includes nested destinationnameandprefixrows.page— required for wholesale/provider tariffs. 1-based page number.limit— required for wholesale/provider tariffs. Page size (maximum 500).
Retail and custom-rate responses are not paginated. Wholesale/provider responses without page and limit return 422.
Response shape
Top-level object: { "tariff_rates": { … } }.
Retail (purpose user): tariff_name, purpose, currency, optional custom_rates (same structure), then destinations — each with destination_group_name and rates (duration, type, round_by, rate, start_time, end_time, daytype, from). When custom rates exist, custom groups are listed first; tariff groups already covered by custom rates are omitted. If the user has custom rates but no assigned tariff, the response may contain only custom_rates (HTTP 200).
Wholesale / provider: flat rates array (direction, destination, prefix, code, rate, connection_fee, increment, min_time, start_time, end_time, daytype, effective_from) plus meta with page, limit, returned, total.
Currency and time values follow legacy API conventions (system currency; time strings; wholesale rate / connection_fee formatted like legacy XML wholesale export).
Example (retail fragment)
{
"tariff_rates": {
"tariff_name": "My Tariff",
"purpose": "user",
"currency": "USD",
"destinations": [
{
"destination_group_name": "Lithuania",
"rates": [
{
"duration": "Infinity",
"type": "minute",
"round_by": "1",
"rate": "0.05",
"start_time": "00:00:00",
"end_time": "23:59:59",
"daytype": "WD",
"from": "0"
}
]
}
]
}
}
Errors
- 401 — Missing or invalid token, usertype not allowed, or API permission denied:
{ "errors": "Unauthorized" }or{ "errors": "API method not permitted: v2_tariff_rates_index" } - 404 — No tariff resolved:
{ "errors": "No tariff found" } - 422 — Wholesale/provider tariff without
pageandlimit:{ "errors": "page and limit are required for wholesale tariffs" }
See also
- MOR API tariff rates get — legacy XML/hash full tariff export
- MOR API v2 rates — prefix rate lookup (
GET /rates), not full tariff table - MOR API Permission Groups — enable
v2_tariff_rates_indexfor integrators