Skip to content
Longport Whale
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 (POST /v1/datasets/account_cash_balances):

curl --request POST \
  --url https://b-api.longbridge.xyz/v1/datasets/account_cash_balances \
  --header "Authorization: Bearer ${ACCESS_TOKEN}" \
  --header "Content-Type: application/json; charset=utf-8" \
  --data '{"filters": {}, "page": 1, "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.post(
    url=host + uri,
    headers={
        "Authorization": f"Bearer {ACCESS_TOKEN}",
        "Content-Type": "application/json; charset=utf-8",
    },
    json={"filters": {}, "page": 1, "page_size": 20},
)
print(resp.json())

3. Explore the API

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

Whale Docs