Get account balance

This method allows you to get your account balance.

Resource

https://api.infobip.com/account/1/balance

Request Example

					GET /account/1/balance HTTP/1.1
Host: api.infobip.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Accept: application/json
					
				
					GET /account/1/balance HTTP/1.1
Host: api.infobip.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Accept: application/xml
					
				
					curl -X GET \
-H 'Accept: application/json' \
-H "Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==" \
https://api.infobip.com/account/1/balance
					
				
					<?php

$request = new HttpRequest();
$request->setUrl('https://api.infobip.com/account/1/balance');
$request->setMethod(HTTP_METH_GET);

$request->setHeaders(array(
  'accept' => 'application/json',
  'authorization' => 'Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=='
));

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
					
				
					require 'uri'
require 'net/http'

url = URI("https://api.infobip.com/account/1/balance")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["authorization"] = 'Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=='
request["accept"] = 'application/json'

response = http.request(request)
puts response.read_body
					
				
					import http.client

conn = http.client.HTTPSConnection("api.infobip.com")

headers = {
    'authorization': "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==",
    'accept': "application/json"
    }

conn.request("GET", "/account/1/balance", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
					
				
					HttpResponse<String> response = Unirest.get("https://api.infobip.com/account/1/balance")
  .header("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==")
  .header("accept", "application/json")
  .asString();
					
				
					var client = new RestClient("https://api.infobip.com/account/1/balance");

var request = new RestRequest(Method.GET);
request.AddHeader("accept", "application/json");
request.AddHeader("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==");

IRestResponse response = client.Execute(request);
					
				
					var data = null;

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.infobip.com/account/1/balance");
xhr.setRequestHeader("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==");
xhr.setRequestHeader("accept", "application/json");

xhr.send(data);
					
				

Response

					{
  "balance": 47.79134,
  "currency": "EUR"
}
					
				
					HTTP/1.1 200 OK
Content-Type: application/xml

<accountBalance>
    <balance>47.79134</balance>
    <currency>EUR</currency>
</accountBalance>
					
				
					
					
				

Response format

When successful, the response header HTTP status code will be 200 OK and delivery reports will be returned in the response body.

If you try to send a message without authorization, you will get a response with the 401 Unauthorized HTTP status code.

AccountBalance

Parameter Type Description
balance Double Account balance.
currency String The currency in which the account balance is expressed.