API reference/REST API//
- Get broker account balances
Get account balance
Update broker account balance
Get broker account balanc...
Get account balances for a broker in all assets.
The following shell script demonstrates how to authenticate and retrieve account balances from the API. To execute this request, you will need the following credentials:
Broker Org Name: Your organization's identifier.API_KEY: Your unique access key.SECRET: The secret key associated with your API Key (used for signing).
The API requires an HMAC signature within the Authorization header. The script below calculates this signature and formats the header as follows:
Authorization: hmac username="${API_KEY}", algorithm="hmac-sha256", headers="date request-line", signature="${SIGNATURE}"
Sample shell script
# Variables
URL_PATH="/custody/api/broker/account/balances"
QUERY="org=<broker_org_name>&isOrgLP=false"
API_KEY="UGmfhBAoXTePWcxtljL0VSAiHTNAW3Uc"
SECRET="<secret>"
# RFC 1123 date in GMT
DATE=$(LC_ALL=C date -u +"%a, %d %b %Y %H:%M:%S GMT")
# Build signing string EXACTLY as Kong expects
SIGNING_STRING="date: ${DATE}\nGET ${URL_PATH}?${QUERY} HTTP/1.1"
# Generate HMAC signature (base64)
SIGNATURE=$(printf "%b" "$SIGNING_STRING" | openssl dgst -sha256 -hmac "$SECRET" -binary | base64)
# Show for debugging
echo "Signing String:"
printf "%b\n" "$SIGNING_STRING"
echo ""
echo "Signature: $SIGNATURE"
echo ""
# Execute request
curl -v "https://crdnet-uat.codexnetwork.org${URL_PATH}?${QUERY}" \
-H "Date: ${DATE}" \
-H "Authorization: hmac username=\"${API_KEY}\", algorithm=\"hmac-sha256\", \
headers=\"date request-line\", signature=\"${SIGNATURE}\""Security
SSO_TOKEN
- Mock serverhttps://docs.fxinside.net/_mock/openapi/integral-api-reference/rest/custody/v2/broker/account/balances
const query = new URLSearchParams({
orgName: 'string',
isLP: 'true'
}).toString();
const resp = await fetch(
`https://docs.fxinside.net/_mock/openapi/integral-api-reference/rest/custody/v2/broker/account/balances?${query}`,
{
method: 'GET',
headers: {
SSO_TOKEN: 'YOUR_API_KEY_HERE'
}
}
);
const data = await resp.text();
console.log(data);Successful operation. If there are no balances, an empty array is returned.
Response
[ { "custodyOrg": "BrokerName", "customerOrg": "LP1", "balances": [ … ] } ]