# Get broker account balances

Get account balances for a broker in all assets.
#### Sample script
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


```shell
# 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}\""
```

Endpoint: GET /custody/v2/broker/account/balances
Version: 1.0.1
Security: SSO_TOKEN

## Query parameters:

  - `orgName` (string, required)
    Custody / liquidity provider (LP) / exchange / customer organization name

  - `isLP` (boolean, required)
    Whether the organization is an LP (`true`) or customer (`false`).

## Response 200 fields (application/json):

  - `custodyOrg` (string)
    Custody organization ID associated with the balances.
    Example: CustodyOrgName

  - `customerOrg` (string)
    Customer organization ID associated with the balances.
    Example: CustomerOrgName

  - `balances` (array)

  - `balances.currency` (string)
    Asset symbol.
    Example: BTC

  - `balances.balance` (number)
    Available balance.
    Example: 10.12922

  - `balances.holds` (number)
    Active holds, if any.
    Example: 1.0092

  - `balances.available` (number)
    Total amount available.
    Example: 9.12002

  - `balances.tradingBalance` (number)
    Total amount available for trading.
    Example: 9.12002

