Skip to content
Get Started

Quickstart

Make your first Whale API request

1. Prepare credentials

You need one credential issued for your broker:

Credential Header Description
ACCESS_TOKEN Authorization: Bearer <token> Broker-scoped access token issued by Longport Whale

2. Send your first request

The example below queries the account_cash_balances dataset (GET /v1/datasets/account_cash_balances):

curl --get \
  --url https://b-api.longbridge.xyz/v1/datasets/account_cash_balances \
  --header "Authorization: Bearer ${ACCESS_TOKEN}" \
  --data-urlencode 'filters={}' \
  --data-urlencode 'page=1' \
  --data-urlencode 'page_size=20'
import requests

ACCESS_TOKEN = "${access_token}"

host = "https://b-api.longbridge.xyz"  # production: https://b-api.lbkrs.com
uri = "/v1/datasets/account_cash_balances"

resp = requests.get(
    url=host + uri,
    headers={"Authorization": f"Bearer {ACCESS_TOKEN}"},
    params={"filters": "{}", "page": 1, "page_size": 20},
)
print(resp.json())
Tip

Switch between Test and Production environments by changing the host — use https://b-api.longbridge.xyz for testing without affecting live data.

3. Explore the API

Head to the BrokerAPI reference to browse all endpoints with an interactive playground.

Whale Docs