Check your API key's credit balance.
https://api.snapisms.io/api/v1/balance/:apiKey endpint accepts a GET request where
:apiKey is the API key that you'd like to check with the following request parameters:
You can authenticate in one of two ways.
| ||Boolean value, e.g: 1 or 0||By default, balances implement a 5 minute cache. This is to improve performance. If you'd like to fetch the latest balance, apply this parameter to the request and set it to 1.||No|
Here's a quick example of how to get the status of your API key's balance, you'd replace
:messageId with your message ID, for example:
curl -X "GET" "https://api.snapisms.io/api/v1/balance/1|FGsT3x8EHxLKO3jmDxxjEDGV8Opy8UmQKaaIQxwr" \ --header 'Authorization: Bearer 1|FGsT3x8EHxLKO3jmDxxjEDGV8Opy8UmQKaaIQxwr'
/api/v1/balance/:apiKey endpoint will respond with the following JSON data:
| ||true/false||Whether the balance was retrieved successfully. You should check the existence and value of this key in your application.||No|
| ||Your message status||The message key will provide more details about the status of the request.||Yes|
| ||10||The number of credits remaining in your account.||No|
| ||true/fakse||If you're viewing a cached version of the balance this will be marked as true. If you opted to disable the cache, this will be marked as false.||No|