Messente logo

Pricing API

Account prices to specific country

Pricing API endpoints

Main API endpoint https://api2.messente.com/prices/
Backup API endpoint https://api3.messente.com/prices/

Request parameters

Key Value Required
username API account user name from the Messente's web page  Yes
password API account security key (API key) from the Messente's web page  Yes
country Two-letter country code. Ex: GB  Yes
format Desired response format. Currently supported: json / xml
Defaults to "json".
 No

Response codes

Code Meaning
ERROR 101 Access is restricted, wrong credentials. Check the username and password values.
ERROR 102 Parameters are wrong or missing. Check that all the required parameters are present.
ERROR 103 IP address is not allowed.
ERROR 104 Country was not found.
ERROR 105 This country is not supported
ERROR 106 Invalid format provided. Only json or xml is allowed.
FAILED 209 Server failure, try again after a few seconds or try the api3.messente.com backup server.

Example request (JSON response)

https://api2.messente.com/prices/
	?username=api_username&password=api_password&country=EE

Successful response:

{"country":"EE","name":"Estonia","prefix":"372","networks":[
{"mccmnc":"24803","name":"Tele2","price":"0.06000"},
{"mccmnc":"24802","name":"Elisa","price":"0.06000"},
{"mccmnc":"24801","name":"EMT","price":"0.06000"}]}

Example request (XML response)

https://api2.messente.com/prices/
?username=api_username&password=api_password&country=EE&format=xml

Successful response:

<?xml version='1.0' encoding='UTF-8' standalone="yes"?>
<pricing>
<country>EE</country>
<name>Estonia</name>
<prefix>372</prefix>
<networks>
<network>
<mccmnc>24803</mccmnc>
<name>Tele2</name>
<price>0.06000</price>
</network>
<network>
<mccmnc>24802</mccmnc>
<name>Elisa</name>
<price>0.06000</price>
</network>
<network>
<mccmnc>24801</mccmnc>
<name>EMT</name>
<price>0.06000</price>
</network>
</networks>
</pricing>

Examples

import messente
import json

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

# Fetch prices for country, default format is json
response = api.pricing.get_country_prices("ee")
if response.is_ok():
    print(json.loads(response.get_result()))

    

Account full pricelist

Full Pricelist API endpoints

Main API endpoint https://api2.messente.com/pricelist/
Backup API endpoint https://api3.messente.com/pricelist/

Messente has an API for downloading the full pricelist in a developer-friendly CSV format. This is suitable for users who send to multiple destinations and require to keep their pricelist up to date at all times.

The preferred frequency when to update the pricelist is around 6 hours but no more than every 2 hours.

Request parameters

Key Value Required
username API account user name from the Messente's web page Yes
password API account security key (API key) from the Messente's web page     Yes

When the request was unsuccessful, the HTTP response includes the response code:

Response codes

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

Example request

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

Successful response snippet:

Country,Code,MCCMNC,Network,Price
Canada,CA,302270,EastLink,0.0062
Papua New Guinea,PG,53703,Digicel,0.0485
India,IN,40440,Airtel - Chennai,0.0448
United States,US,310284,Verizon Wireless,0.0062
....

Examples

import messente
import tempfile
import json

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

# Fetch whole pricelist
response = api.pricing.get_pricelist()
if response.is_ok():
	print(response.get_result())

# Save whole pricelist in a file
(_, filename) = tempfile.mkstemp()
response = api.pricing.get_pricelist(filename)
if response.is_ok():
	print("Pricelist saved in:", filename)