Base URLs:

| Environment | Base URL |
| --- | --- |
| Production | `https://api.gum.ag/app/v1` |
| Devnet | `https://dev-api.gum.ag/app/v1` |

Both use the same `/app/v1` prefix. Examples and the playground use production.

`GET /v1` lists every endpoint and `GET /v1/openapi.json` is the OpenAPI 3.1
spec. Errors and rate limits are on [Errors and limits](/trading-api/errors-and-limits).

## Activity

History, status and the live streams return the same object for a swap,
withdrawal or deposit. A field that doesn't apply to the type is left out; one
that applies but isn't known yet is `null`.

| Field         | For                   | What it means                                                                                                                                                                                                     |
| ------------- | --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `id`          | All                   | The request's account on GUM Network, in base58. Pass a swap's to `GET /v1/swap/{id}` and a withdrawal's to `GET /v1/withdraw/{id}`. A swap that settles in one transaction (selling BSC USDT or Robinhood USDG) uses its transaction id. |
| `type`        | All                   | `swap`, `withdrawal` or `deposit`. It decides which fields below appear.                                                                                                                                          |
| `status`      | All                   | `pending` until it finishes, then `completed`, `failed`, `refunded` (a failed swap's funds are back in your balance) or `cancelled` (a cancelled withdrawal). See [Track status](/trading-api/status).            |
| `final`       | All                   | `true` once nothing can change: stop polling. A `failed` swap isn't final until its funds are back and it turns `refunded`.                                                                                      |
| `step`        | Pending               | What's happening now, for display, e.g. "Executing swap on Solana" or "Crediting your balance". The wording can change, so don't parse it.                                                                        |
| `reason`      | Failed                | Why it failed, for display, e.g. "Not filled in time. The amount is being refunded to your balance."                                                                                                                   |
| `side`        | Swaps                 | `buy` spends USD on `token`. `sell` turns `token` into USD.                                                                                                                                                       |
| `token`       | All                   | The token involved: `address` (its mint or contract on its home chain), `chainId`, `decimals` and `symbol`. Your USD balance shows as `USD` with no address. A USD withdrawal shows the dollar token it pays out, e.g. USDC on Base. |
| `pay`         | Swaps                 | `{ amount, symbol }` that left your balance: USD on a buy, the token on a sell.                                                                                                                                   |
| `receive`     | Swaps                 | `{ amount, symbol }` that reached your balance. `amount` is `null` until the swap fills.                                                                                                                         |
| `amount`      | Withdrawals, deposits | `{ amount, symbol }`: what arrives at `destination`, after `fee`, for a withdrawal; what was credited to your balance for a deposit.                                                                              |
| `fee`         | Swaps, withdrawals    | `{ amount, symbol }`: GUM's trading fee in USD for a swap, or `null` until the swap completes (the fee is only charged then, and a failed swap is refunded in full); the network fee in the withdrawn token for a withdrawal, already taken out of `amount`. |
| `destination` | Withdrawals           | The address on `chainId` that receives the funds.                                                                                                                                                                 |
| `chainId`     | All                   | The other chain involved: where a swap's token trades, where a withdrawal goes, where a deposit came from. `900` is Solana; [`GET /v1/chains`](/trading-api/reference/get-chains) lists them all.              |
| `txHash`      | All                   | The transaction on `chainId`: the swap, the withdrawal's payout or the deposit you sent. `null` until there is one.                                                                                               |
| `explorerUrl` | All                   | `txHash` on that chain's block explorer, or `null` without a `txHash`.                                                                                                                                            |
| `createdAt`   | All                   | When the request was made, as an ISO 8601 UTC timestamp.                                                                                                                                                          |
| `completedAt` | All                   | When it finished, as an ISO 8601 UTC timestamp. `null` while pending.                                                                                                                                             |

## Amounts

Every amount is a decimal string in whole units, like `"0.042203755"`. Send
amounts the same way; the API rejects more decimal places than a token has
rather than rounding.

## Pagination

`GET /v1/history/{address}` returns `nextCursor`. Pass it back as `cursor` to
get the next page; it's `null` on the last one.
