Check your API key's credit balance.
The 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.
Parameter | Value | Description | Required? |
---|---|---|---|
disable_cache | 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: https://api.snapisms.io/api/v1/status/bc75bc01-06f1-4870-9a46-8fb4dab1d43d
curl -X "GET" "https://api.snapisms.io/api/v1/balance/1|FGsT3x8EHxLKO3jmDxxjEDGV8Opy8UmQKaaIQxwr" \ --header 'Authorization: Bearer 1|FGsT3x8EHxLKO3jmDxxjEDGV8Opy8UmQKaaIQxwr'
The /api/v1/balance/:apiKey
endpoint will respond with the following JSON data:
Key | Value | Description | Always present? |
---|---|---|---|
success | true/false | Whether the balance was retrieved successfully. You should check the existence and value of this key in your application. | No |
message | Your message status | The message key will provide more details about the status of the request. | Yes |
credits_remaining | 10 | The number of credits remaining in your account. | No |
is_cached | 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 |