Skip to content

List accounts

GET https://rest.haasapi.com/v1/accounts

Returns every exchange account on the authenticated user, real and simulated. The account_id is the join key the account-scoped endpoints take. Returned whole - no pagination.

Requires the read scope.

Terminal window
curl "https://rest.haasapi.com/v1/accounts" \
-H "Authorization: Bearer hk_live_YOUR_KEY"

200 OK. Returns a AccountsPage.

{
"data": [
{
"account_id": "45130505-7d48-4abb-ab01-8859f5624dad",
"name": "asdf",
"exchange": "BYBITSPOT",
"market_type": "spot",
"status": "connected",
"is_simulated": true,
"is_testnet": false
},
{
"account_id": "af85799d-a214-4fd2-92ea-443c5eed18ad",
"name": "SIM Cypress Gemini",
"exchange": "GEMINI",
"market_type": "spot",
"status": "connected",
"is_simulated": true,
"is_testnet": false
}
]
}

The public contract for /v1/accounts and /v1/accounts/{account_id}/balance - same single-source-of-truth pattern as V1MarketsDto: [JsonProperty] is the wire format, [Description] is the docs, and V1OpenApi reflects both into the published schema.

No cursor: a user holds dozens of accounts at most and the list is returned whole - the /v1/exchanges precedent. If it ever needs paging, next_cursor appears as a new nullable field - additive, not breaking.

Field Type Description
data array of Account Every exchange account on the user, real and simulated.
Field Type Description
account_id string Account identifier - the id every other endpoint accepts wherever an account is referenced (balance, bot creation). Copy it from this endpoint; never construct one.
name string User-chosen account name.
exchange string Exchange code - joins against /v1/exchanges and the exchange field on /v1/markets.
market_type AccountMarketType
status AccountStatus
is_simulated boolean Whether this is a simulated (paper-trading) account rather than one holding real exchange keys.
is_testnet boolean Whether the account trades against the exchange’s testnet environment.

What the account trades. No margin member: the internal EnumExchangeType has one, but no driver declares it (every driver is Spot or Leverage) and production holds zero such accounts, so publishing it would only tell integrators to write a dead branch.

Value Description
spot The account trades spot markets.
futures The account trades futures markets.

Whether the account’s stored keys are connected and usable. No unknown member: the internal EnumAccountStatus has exactly these four and all four are mapped, so there is no unresolved case to report.

Value Description
created Added but never connected.
connected Keys verified and in use.
keys_error The exchange rejects the stored keys.
deactivated Switched off.

All errors are RFC 9457 problem documents.

Status Description
400 The request is malformed (invalid limit, unusable cursor, …). (code: invalid_request)
401 Missing, malformed, disabled, or revoked API key. (code: invalid_api_key)
500 An unexpected error inside the API. Nothing about the request caused it; retry, and quote the instance value if it persists. (code: internal_error)
502 An internal service answered in a way the API could not serve. Retry. (code: upstream_error)
503 The request could not be served right now. Retry with the same key - do not discard it. (code: temporarily_unavailable)
504 An internal service did not answer within the deadline. Retry with backoff. (code: upstream_timeout)
{
"type": "https://docs.haasapi.com/errors/invalid_request",
"title": "Invalid request",
"status": 400,
"detail": "The request is malformed (invalid limit, unusable cursor, …).",
"code": "invalid_request"
}