Messente avatar logo

Credits API

Checking your account balance in Messente

Using the Messente credits API you can:

  • Receive a response with your current account balance. In case of failed request the response will return with error that indicates the reason why the request failed.


HTTP GET/POST Request URL:

http(s)://api2.messente.com/get_balance/

Backup balance API endpoint URL:

http(s)://api3.messente.com/get_balance/

Request parameters

KeyValue
usernameAPI account user name from the Messente's web page
passwordAPI account security key (API key) from the Messente's web page

Response from get_balance request

Basic syntax for successful response: OK [SMS balance in EUR]

When the request was unsuccessful, the HTTP response includes one of the response codes:

CodeMeaning
ERROR 101Access is restricted, wrong credentials. Check username and password values.
ERROR 102Parameters are wrong or missing. Check that all required parameters are present.
FAILED 209Server failure, try again after a few seconds or try api3.messente.com backup server.

Example request

https://api2.messente.com/get_balance/?username=api_username&password=api_password

Successful response:

OK 707.54

EXAMPLES

import messente

api = messente.Messente(
    username="api_user",
    password="api_password"
)

response = api.credit.get_balance()
if response.is_ok():
    print("Account balance:", response.get_result())
else:
    print(response.get_full_error_msg())