> For the complete documentation index, see [llms.txt](https://txnlab.gitbook.io/haystack-dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://txnlab.gitbook.io/haystack-dev/haystack-api/accounts.md).

# Accounts

Public per-account reads - HayLaunch holdings, creator earnings and fees, and trading totals.

All paths are under `https://api.hay.app/api`. The full schemas are in the [OpenAPI specification](https://api.hay.app/info/openapi3.yaml).

These read public, on-chain data about any Algorand account. The other `/api/account/...` paths in the specification serve Haystack's own signed-in apps and aren't supported for third parties.

## HayLaunch holdings

`GET /account/{account}/hayLaunchHoldings`

Tokens bought on a HayLaunch bonding curve are credited to a balance in the HayLaunch app, not sent to the wallet, until the token graduates. This lists those balances: `[{ assetId, amount }]`, `assetId` as a string and `amount` in whole tokens. Add them to the wallet's own holdings to show what the account owns.

## Creator earnings

`GET /account/{account}/creatorEarnings`

The HayLaunch creator fees the account has earned, per token it launched, highest USD first: `{ creator, tokens: [{ assetId, name, unitName, image, bondingTokenId, fees }] }`.

`fees.realized` lists totals per kind and asset paid in:

* `kind`: `curve` (fees on buys and sells while bonding, paid in the bonding asset) or `pool` (Pact V2 manager fees after bonding, paid when claimed).
* `amount` in base units of `assetId`, with `decimals`.
* `amountUsd`, the USD value at payment time. `usdPartial` is `true` when some payments had no USD value, so `amountUsd` undercounts.
* `selfPaidPayments` and `selfPaidAmount`: fees the creator paid themselves by trading their own token. These are included in the totals.

`fees.unclaimedPoolFees`, for tokens bonded into Pact V2, is the manager fee accrued in the pool and not yet claimed, in base units of the token and of the bonding asset.

## Creator fee payments

`GET /account/{account}/creatorFees`

Each creator fee payment, newest first: `{ fees: [...], cursor }`. Each payment has:

* `timestamp`, `txnId`, `round`, `tokenAssetId`, `kind`.
* `payer`: the trader, for curve fees.
* `assetId`, `decimals`, `amount` (base units), `amountUsd`, `selfPaid`.

Takes `limit` (1 to 100, default 50) and `paginationToken`.

Base-unit amounts, asset IDs and rounds in these two responses are JSON strings, so they don't lose precision in JavaScript.

## Trading totals

`GET /account/buySellTotals?account=<address>[&asset=<id>]`

What the account has bought and sold, per asset: `[{ assetId, totalBuyAmount, totalBuyUsd, totalSellAmount, totalSellUsd }]`, amounts in whole tokens and USD at trade time. Pass `asset` for one asset.

## Rate limits

| Endpoint                               | Requests per minute |
| -------------------------------------- | ------------------- |
| `account/buySellTotals`                | 40                  |
| `hayLaunchHoldings`, `creatorEarnings` | 30                  |
| `creatorFees`                          | 20                  |

`hayLaunchHoldings`, `creatorEarnings` and `creatorFees` are limited per account as well.
