This API is to get account balances of a customer account
<br> <p><strong>OAuth2 related details</strong></p> <p><em>Token URL for Third Party Apps: https://sandboxapi.rakbank.ae/rb/api/v1/customer_signin/oauth2/token</em>
<br>scope : account_balances
<br>grant_type : authorization_code | refresh_token
</p> <br>
Attachment | Size |
---|
Attachment | Size |
---|---|
![]() | 1.03 KB |
OAuth Metadata details
Token URL for Third Party Apps: https://sandboxapi.rakbank.ae/rb/api/v1/customer_signin/oauth2/token
scope : account_balances
grant_type : authorization_code | refresh_token
Paths
/accounts/{account_id}/balances
Get account balances.
Account id of which balances are required. Only MASKED value to be passed. Masking logic to be followed : - First 4 and last 3 characters to be unmasked. All chracters in between to be masked by replacing with 'x'. e.g. 1234xxxxxx567
{
"maxLength": 13
}
Unique Id sent by client. Value should be a unique identifier of the transaction in UUID format.
{
"maxLength": 50
}
200 OK
Unauthorized Error
Forbidden Error
Error in case of Invalid request
Internal Sever Error
curl --request GET \
--url https://sandboxapi.rakbank.ae/sb/api/v1/accounts/REPLACE_ACCOUNT_ID/balances \
--header 'accept: application/json' \
--header 'authorization: Bearer REPLACE_BEARER_TOKEN' \
--header 'msgid: REPLACE_THIS_VALUE' \
--header 'x-ibm-client-id: REPLACE_THIS_KEY'
require 'uri'
require 'openssl'
require 'net/http'
url = URI("https://sandboxapi.rakbank.ae/sb/api/v1/accounts/REPLACE_ACCOUNT_ID/balances")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
request = Net::HTTP::Get.new(url)
request["x-ibm-client-id"] = 'REPLACE_THIS_KEY'
request["authorization"] = 'Bearer REPLACE_BEARER_TOKEN'
request["msgid"] = 'REPLACE_THIS_VALUE'
request["accept"] = 'application/json'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("sandboxapi.rakbank.ae")
headers = {
'x-ibm-client-id': "REPLACE_THIS_KEY",
'authorization': "Bearer REPLACE_BEARER_TOKEN",
'msgid': "REPLACE_THIS_VALUE",
'accept': "application/json"
}
conn.request("GET", "/sb/api/v1/accounts/REPLACE_ACCOUNT_ID/balances", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://sandboxapi.rakbank.ae/sb/api/v1/accounts/REPLACE_ACCOUNT_ID/balances",
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(
"accept: application/json",
"authorization: Bearer REPLACE_BEARER_TOKEN",
"msgid: REPLACE_THIS_VALUE",
"x-ibm-client-id: REPLACE_THIS_KEY"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
// OkHttpClient from http://square.github.io/okhttp/
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://sandboxapi.rakbank.ae/sb/api/v1/accounts/REPLACE_ACCOUNT_ID/balances")
.get()
.addHeader("x-ibm-client-id", "REPLACE_THIS_KEY")
.addHeader("authorization", "Bearer REPLACE_BEARER_TOKEN")
.addHeader("msgid", "REPLACE_THIS_VALUE")
.addHeader("accept", "application/json")
.build();
Response response = client.newCall(request).execute();
// Install request by running "npm install --save request"
var request = require("request");
var options = { method: 'GET',
url: 'https://sandboxapi.rakbank.ae/sb/api/v1/accounts/REPLACE_ACCOUNT_ID/balances',
headers:
{ accept: 'application/json',
msgid: 'REPLACE_THIS_VALUE',
authorization: 'Bearer REPLACE_BEARER_TOKEN',
'x-ibm-client-id': 'REPLACE_THIS_KEY' } };
request(options, function (error, response, body) {
if (error) return console.error('Failed: %s', error.message);
console.log('Success: ', body);
});
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://sandboxapi.rakbank.ae/sb/api/v1/accounts/REPLACE_ACCOUNT_ID/balances"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-ibm-client-id", "REPLACE_THIS_KEY")
req.Header.Add("authorization", "Bearer REPLACE_BEARER_TOKEN")
req.Header.Add("msgid", "REPLACE_THIS_VALUE")
req.Header.Add("accept", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
import Foundation
let headers = [
"x-ibm-client-id": "REPLACE_THIS_KEY",
"authorization": "Bearer REPLACE_BEARER_TOKEN",
"msgid": "REPLACE_THIS_VALUE",
"accept": "application/json"
]
var request = NSMutableURLRequest(URL: NSURL(string: "https://sandboxapi.rakbank.ae/sb/api/v1/accounts/REPLACE_ACCOUNT_ID/balances")!,
cachePolicy: .UseProtocolCachePolicy,
timeoutInterval: 10.0)
request.HTTPMethod = "GET"
request.allHTTPHeaderFields = headers
let session = NSURLSession.sharedSession()
let dataTask = session.dataTaskWithRequest(request, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error)
} else {
let httpResponse = response as? NSHTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
{
"total_count": 10,
"href": "https://sandboxapi.rakbank.ae/rb/api/v1/accounts/1234xxxxxx123/balances",
"balances": [
{
"type": "EffectiveAvailableBalance",
"balance": {
"amount": "2000.00",
"currency": "AED"
}
}
]
}
Definitions
Balance details
{
"properties": {
"type": {
"type": "string",
"enum": [
"LedgerBalance",
"UnclearedBalance",
"ClearedBalance",
"LienAmount+SystemReservedAmount",
"DrawingPower",
"AvailableBalance",
"EffectiveAvailableBalance",
"PoolBalance",
"LienAmount",
"LedgerBalanceHomeCurrency"
],
"description": "Holds balance type",
"example": "EffectiveAvailableBalance"
},
"balance": {
"description": "Holds account balance corresponding to 'type'",
"$ref": "#/definitions/value"
}
},
"additionalProperties": false,
"required": [
"type",
"balance"
]
}
Amount details
{
"properties": {
"amount": {
"type": "string",
"description": "Holds value of the amount (Number format - 20,4)",
"example": "2000.00"
},
"currency": {
"type": "string",
"description": "currency",
"example": "AED"
}
},
"additionalProperties": false,
"required": [
"amount",
"currency"
]
}
Response in case of error
{
"properties": {
"status": {
"type": "string",
"description": "HTTP Status"
},
"response_code": {
"type": "string",
"description": "API specific error code"
},
"property": {
"type": "string"
},
"response_message": {
"type": "string",
"description": "brief type of the error"
},
"description": {
"type": "string",
"description": "detailed description of the error"
}
},
"additionalProperties": false,
"required": [
"status",
"response_code",
"response_message"
]
}
Returns the collection of balances along with some meta data
{
"properties": {
"total_count": {
"type": "integer",
"description": "Holds the total no. of balances returned",
"example": 10
},
"href": {
"type": "string",
"description": "href value to fetch this resource",
"example": "https://sandboxapi.rakbank.ae/rb/api/v1/accounts/1234xxxxxx123/balances"
},
"balances": {
"type": "array",
"items": {
"$ref": "#/definitions/balances"
},
"description": "array of balances"
}
},
"additionalProperties": false,
"required": [
"href",
"balances"
]
}