Skip to main content

Method API

Not every operation maps cleanly to a document CRUD call. For actions like "send an SMS", "run a report", or "activate a SIM", Smarty.tel exposes whitelisted server-side methods at:

/api/method/<dotted.path.to.method>

Only methods explicitly marked as whitelisted (safe for external calls) are reachable this way. Attempting to call a non-whitelisted method returns a 403 Forbidden.

Calling a method

GET is used for read-only methods, POST for methods that have side effects. Check the specific method's documentation (or ask your Smarty.tel administrator) for which verb it expects and what parameters it accepts.

curl -X POST "https://app.smarty.tel/api/method/smarty.api.sim.activate_sim" \
-H "Authorization: token <api_key>:<api_secret>" \
-H "Content-Type: application/json" \
-d '{"iccid": "8988303000000123456", "customer": "CUST-2026-0091"}'
{
"message": {
"status": "activated",
"iccid": "8988303000000123456",
"activated_on": "2026-08-19 08:03:22"
}
}

The return value of the underlying function is always wrapped in a top-level message key.

GET example with query parameters

curl -G "https://app.smarty.tel/api/method/smarty.api.usage.get_data_balance" \
-H "Authorization: token <api_key>:<api_secret>" \
--data-urlencode 'msisdn=+15551234567'
{
"message": {
"msisdn": "+15551234567",
"balance_mb": 4096,
"cycle_ends": "2026-09-01"
}
}

Common built-in methods

MethodDescription
loginAuthenticate and start a session (see Authentication).
logoutEnd the current session.
frappe.client.get_listProgrammatic alternative to the list Resource API, useful when you need more control over joins/filters.
frappe.client.get_countReturn the count of documents matching a filter, without fetching rows.

Errors

Method calls use the same error envelope as the Resource API. A whitelisted method that raises an exception returns 417 Expectation Failed (or the exception's declared HTTP status) with the error details in the response body.

Next: File Uploads.