Account: Get

This method allows you to get accounts. A specific one, all, or filtered accounts can be fetched with this method.

Resource

https://api.infobip.com/settings/1/accounts/:key

Parameters

Property name Type Description
key string Key used to uniquely identify the account. Use _ as parameter value for your current account or account key for sub accounts.
name string Account name.
enabled boolean Status of the account (enabled or disabled).
limit int Number of accounts to fetch, defaults to 40.

Request Example

					GET settings/1/accounts/EF04794F718A3FC8C6DFA0B215B2CF24 HTTP/1.1
Host: api.infobip.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Content-Type: application/json
Accept: application/json
					
				
					GET settings/1/accounts/EF04794F718A3FC8C6DFA0B215B2CF24 HTTP/1.1
Host: api.infobip.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Content-Type: application/xml
Accept: application/xml
					
				
					curl -H "Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==" -H "Content-Type: application/json" 'https://api.infobip.com/settings/1/accounts/EF04794F718A3FC8C6DFA0B215B2CF24'
					
				
					<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.infobip.com/settings/1/accounts/EF04794F718A3FC8C6DFA0B215B2CF24",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=="
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
					
				
					require 'uri'
require 'net/http'

url = URI("https://api.infobip.com/settings/1/accounts/EF04794F718A3FC8C6DFA0B215B2CF24")

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["content-type"] = 'application/json'

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

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

headers = {
    'authorization': "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==",
    'content-type': "application/json"
    }

conn.request("GET", "/settings/1/accounts/EF04794F718A3FC8C6DFA0B215B2CF24", headers=headers)

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

print(data.decode("utf-8"))
					
				
					HttpResponse<String> response = Unirest.get("https://api.infobip.com/settings/1/accounts/EF04794F718A3FC8C6DFA0B215B2CF24")
  .header("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==")
  .header("content-type", "application/json")
  .asString();
					
				
					var client = new RestClient("https://api.infobip.com/settings/1/accounts/EF04794F718A3FC8C6DFA0B215B2CF24");
var request = new RestRequest(Method.GET);
request.AddHeader("content-type", "application/json");
request.AddHeader("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==");
IRestResponse response = client.Execute(request);
					
				
					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/settings/1/accounts/EF04794F718A3FC8C6DFA0B215B2CF24");
xhr.setRequestHeader("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==");
xhr.setRequestHeader("content-type", "application/json");

xhr.send(data);
					
				

Response

					{
  "key": "EF04794F718A3FC8C6DFA0B215B2CF24",  
  "ownerKey": "28A3FC8C615B2CF24E1DFA0BF04794F7",
  "name": "AccountName",
  "enabled": true
}
					
				
					&lt;?xml version='1.0' encoding='UTF-8'?&gt;
<account>
    <key>EF04794F718A3FC8C6DFA0B215B2CF24</key>
    <ownerKey>28A3FC8C615B2CF24E1DFA0BF04794F7</ownerKey>
    <name>AccountName</name>
    <enabled>true</enabled>
</account>
					
				
					{
  "requestError": {
    "serviceException": {
      "messageId": "BAD_REQUEST",
      "text": "Bad request"
    }
  }
}
					
				

Response format

If successful, response header HTTP status code will be 200 OK and the account will be fetched.

If you try to get account(s) without authorization, you will receive a 401 Unauthorized error.

Account

Parameter Type Description
key String Key used to uniquely identify the account.
ownerKey String Key which uniquely identifies account’s owner.
name String Account name.
enabled Boolean Whether account is enabled for use.

Additional examples

Get all accounts

Note

If all accounts are wanted, the key parameter must be omitted. If you have more than 40 accounts also add the limit query parameter.

Request:

GET settings/1/accounts HTTP/1.1
Host: api.infobip.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Content-Type: application/json
Accept: application/json
GET settings/1/accounts HTTP/1.1
Host: api.infobip.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Content-Type: application/xml
Accept: application/xml
curl -H "Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==" -H "Content-Type: application/json" 'https://api.infobip.com/settings/1/accounts'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.infobip.com/settings/1/accounts",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=="
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
require 'uri'
require 'net/http'

url = URI("https://api.infobip.com/settings/1/accounts")

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["content-type"] = 'application/json'

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

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

headers = {
    'authorization': "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==",
    'content-type': "application/json"
    }

conn.request("GET", "/settings/1/accounts", headers=headers)

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

print(data.decode("utf-8"))
HttpResponse<String> response = Unirest.get("https://api.infobip.com/settings/1/accounts")
  .header("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==")
  .header("content-type", "application/json")
  .asString();
var client = new RestClient("https://api.infobip.com/settings/1/accounts");
var request = new RestRequest(Method.GET);
request.AddHeader("content-type", "application/json");
request.AddHeader("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==");
IRestResponse response = client.Execute(request);
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/settings/1/accounts");
xhr.setRequestHeader("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==");
xhr.setRequestHeader("content-type", "application/json");

xhr.send(data);

Response:

{
    "accounts": [
    {
        "key": "EF04794F718A3FC8C6DFA0B215B2CF24",  
        "ownerKey": "28A3FC8C615B2CF24E1DFA0BF04794F7",
        "name": "AccountName",
        "enabled": true
        },
    {
        "key": "C599FEF17318256ACBF987F6D75A156D",  
        "ownerKey": "28A3FC8C615B2CF24E1DFA0BF04794F7",
        "name": "SecondAccountName",
        "enabled": true
        },
    {
        "key": "02D7060AA84699271CD92369F2DEBABF",  
        "ownerKey": "28A3FC8C615B2CF24E1DFA0BF04794F7",
        "name": "DisabledAccount",
        "enabled": false
        }
  ]
}
<?xml version='1.0' encoding='UTF-8'?>
<accountsResponse>
  <accounts>
    <account>
      <name>AccountName</name>
      <key>EF04794F718A3FC8C6DFA0B215B2CF24</key>
      <ownerKey>28A3FC8C615B2CF24E1DFA0BF04794F7</ownerKey>
      <enabled>true</enabled>
    </account>
    <account>
      <name>SecondAccountName</name>
      <key>C599FEF17318256ACBF987F6D75A156D</key>
      <ownerKey>28A3FC8C615B2CF24E1DFA0BF04794F7</ownerKey>
      <enabled>true</enabled>
    </account>
    <account>
      <name>DisabledAccount</name>
      <key>02D7060AA84699271CD92369F2DEBABF</key>
      <ownerKey>28A3FC8C615B2CF24E1DFA0BF04794F7</ownerKey>
      <enabled>true</enabled>
    </account>
  </accounts>
</accountsResponse>

Response format

If successful, the response header HTTP status code will be 200 OK and all accounts will be returned.

If you try to get the accounts without authorization, you will receive a 401 Unauthorized error.

Accounts Response

Parameter Type Description
accounts Account Array of accounts.

Account

Parameter Type Description
key String Key used to uniquely identify the account.
ownerKey String Key which uniquely identifies account’s owner.
name String Account name.
enabled Boolean Whether account is enabled for use.

Get account by name

Caution!

Usage of key and name, enabled and limit parameters is exclusive. With key path parameter, specific account is returned, but with query parameter name (or enabled), list of accounts is returned, filtered by specified parameter value.

Request:

GET settings/1/accounts?name=AccountName HTTP/1.1
Host: api.infobip.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Content-Type: application/json
Accept: application/json
GET settings/1/accounts?name=AccountName HTTP/1.1
Host: api.infobip.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Content-Type: application/json
Accept: application/json
curl -H "Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==" -H "Content-Type: application/json" 'https://api.infobip.com/settings/1/accounts?name=AccountName'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.infobip.com/settings/1/accounts?name=AccountName",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=="
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
require 'uri'
require 'net/http'

url = URI("https://api.infobip.com/settings/1/accounts?name=AccountName")

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["content-type"] = 'application/json'

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

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

headers = {
    'authorization': "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==",
    'content-type': "application/json"
    }

conn.request("GET", "settings/1/accounts?name=AccountName", headers=headers)

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

print(data.decode("utf-8"))
HttpResponse<String> response = Unirest.get("https://api.infobip.com/settings/1/accounts?name=AccountName")
  .header("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==")
  .header("content-type", "application/json")
  .asString();
var client = new RestClient("https://api.infobip.com/settings/1/accounts?name=AccountName");
var request = new RestRequest(Method.GET);
request.AddHeader("content-type", "application/json");
request.AddHeader("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==");
IRestResponse response = client.Execute(request);
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/settings/1/accounts?name=AccountName");
xhr.setRequestHeader("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==");
xhr.setRequestHeader("content-type", "application/json");

xhr.send(data);

Response

{
  "accounts":[
    {
        "key": "EF04794F718A3FC8C6DFA0B215B2CF24",  
        "ownerKey": "28A3FC8C615B2CF24E1DFA0BF04794F7",
        "name": "AccountName",
        "enabled": true
        }
  ]
}
<?xml version='1.0' encoding='UTF-8'?>
<account>
    <key>EF04794F718A3FC8C6DFA0B215B2CF24</key>
    <ownerKey>28A3FC8C615B2CF24E1DFA0BF04794F7</ownerKey>
    <name>AccountName</name>
    <enabled>true</enabled>
</account>

Get only enabled accounts

Request:

GET settings/1/accounts?enabled=true HTTP/1.1
Host: api.infobip.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Content-Type: application/json
Accept: application/json
GET settings/1/accounts?enabled=true HTTP/1.1
Host: api.infobip.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Content-Type: application/json
Accept: application/json
curl -H "Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==" -H "Content-Type: application/json" 'https://api.infobip.com/settings/1/accounts?enabled=true'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.infobip.com/settings/1/accounts?enabled=true",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=="
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
require 'uri'
require 'net/http'

url = URI("https://api.infobip.com/settings/1/accounts?enabled=true")

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["content-type"] = 'application/json'

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

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

headers = {
    'authorization': "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==",
    'content-type': "application/json"
    }

conn.request("GET", "settings/1/accounts?enabled=true", headers=headers)

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

print(data.decode("utf-8"))
HttpResponse<String> response = Unirest.get("https://api.infobip.com/settings/1/accounts?enabled=true")
  .header("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==")
  .header("content-type", "application/json")
  .asString();
var client = new RestClient("https://api.infobip.com/settings/1/accounts?enabled=true");
var request = new RestRequest(Method.GET);
request.AddHeader("content-type", "application/json");
request.AddHeader("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==");
IRestResponse response = client.Execute(request);
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/settings/1/accounts?enabled=true");
xhr.setRequestHeader("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==");
xhr.setRequestHeader("content-type", "application/json");

xhr.send(data);

Response:

{
  "accounts":[
    {
        "key": "EF04794F718A3FC8C6DFA0B215B2CF24",  
        "ownerKey": "28A3FC8C615B2CF24E1DFA0BF04794F7",
        "name": "AccountName",
        "enabled": true
        },
    {
        "key": "C599FEF17318256ACBF987F6D75A156D",  
        "ownerKey": "28A3FC8C615B2CF24E1DFA0BF04794F7",
        "name": "SecondAccountName",
        "enabled": true
        }
  ]
}
<?xml version='1.0' encoding='UTF-8'?>
<accountsResponse>
  <accounts>
    <account>
      <name>AccountName</name>
      <key>EF04794F718A3FC8C6DFA0B215B2CF24</key>
      <ownerKey>28A3FC8C615B2CF24E1DFA0BF04794F7</ownerKey>
      <enabled>true</enabled>
    </account>
    <account>
      <name>SecondAccountName</name>
      <key>C599FEF17318256ACBF987F6D75A156D</key>
      <ownerKey>28A3FC8C615B2CF24E1DFA0BF04794F7</ownerKey>
      <enabled>true</enabled>
    </account>
  </accounts>
</accountsResponse>

Get main account

In order to get your main account use the _ as a value of the path parameter:

Request:

GET settings/1/accounts/_ HTTP/1.1
Host: api.infobip.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Accept: application/json
GET settings/1/accounts/_ HTTP/1.1
Host: api.infobip.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Accept: application/xml

Response:

{
  "key": "28A3FC8C615B2CF24E1DFA0BF04794F7",
  "name": "Main account name",
  "enabled": true
}
<?xml version='1.0' encoding='UTF-8'?>
<account>
    <key>28A3FC8C615B2CF24E1DFA0BF04794F7</key>
    <name>Main account name</name>
    <enabled>true</enabled>
</account>