> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sodax.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> SODAX is mainnet-only (no testnet chains or RPC endpoints exist) with a hub-and-spoke architecture; Sonic is the hub. SODAX is non-custodial protocol/software: it routes and settles; independent solvers on the marketplace fill — never say 'our solver', 'the SODAX solver', that SODAX trades, takes custody, or fills orders. For frontend/React integrations, prefer @sodax/dapp-kit hooks over calling @sodax/sdk directly. SDK operations — the methods that build, submit or await a transaction, and the API/quote calls — return Result<T, E> ({ ok: true, value } or { ok: false, error }): check result.ok, never wrap them in try/catch or branch on error.message; discriminate on the narrow error.code union instead. Synchronous config getters (getPartnerFee, getSupportedSwapTokens, getVault, ...) return their value directly, not a Result.

# HTTP API

> Public SODAX HTTP surfaces for partners — base URLs, route prefixes, conventions, and which API to use.

> [card] [Get your API key](https://portal.sodax.com)
>
> Create a key in the partner portal and send it as `x-api-key` from your server.

Use this section when integrating over raw HTTP (any language). This is the recommended starting point for new integrations. Prefer a [solution hub](https://docs.sodax.com/introduction.md) when you already know the outcome (Swap, Yield, …). For TypeScript end-to-end flows (create intent → relay → settle), use the [SDK functional modules](https://docs.sodax.com/developers/packages/foundation/sdk/functional-modules.md).

> [card] [Swap API](https://docs.sodax.com/developers/http-api/swaps.md)
>
> Quote, build intents, submit-tx, status. Product overview: [Swap hub](https://docs.sodax.com/swap.md).

> [card] [Leverage yield API](https://docs.sodax.com/developers/http-api/leverage.md)
>
> Vault deposit / withdraw. Product overview: [Yield hub](https://docs.sodax.com/yield.md).

> [card] [Oracle](https://docs.sodax.com/developers/http-api/oracle.md)
>
> USD OHLC candles for charts, plus live solver mark prices.

> [card] [Protocol stats](https://docs.sodax.com/developers/http-api/stats.md)
>
> Networks, partners, assets, filled-intent volume, and SODA supply.

> [!NOTE]
>
> **Exploring these routes with an AI agent?** The [Builders MCP](https://docs.sodax.com/builders-mcp.md)
> (`https://builders.sodax.com/mcp`) wraps the read surfaces below as tools, so the agent works from
> today's chains, tokens, quotes and rates instead of its training data.

## Base URLs

| Environment | Host | Use |
| - | - | - |
| **Production** | `https://api.sodax.com` | Default for partners |
| **Canary** | `https://canary-api.sodax.com` | Early features / soak |

Always use these public hosts. Do not hard-code private infrastructure hostnames.

Send `x-api-key` from your server, never from a browser: a key in front-end code is public. [API key good practices](https://docs.sodax.com/developers/how-to/api-key-good-practices.md) shows how to proxy browser traffic through your own backend.

## Route map

| Prefix | Purpose | Auth |
| - | - | - |
| `/v1/swaps/*` | Swaps API — quote, build intent, submit-tx, status | No key enforced yet (rate-limited writes) — see [API keys](https://docs.sodax.com/developers/how-to/api-keys.md) |
| `/v1/leverage-yield/*` | Leveraged yield vaults over HTTP | No key enforced yet (same pattern as swaps) — see [API keys](https://docs.sodax.com/developers/how-to/api-keys.md) |
| `/v1/bridge/*` | Bridge API — tokens, allowance, approve, build intent, submit-tx, status | Portal key as `x-api-key` — see the [`@sodax/bridge-api` key notes](https://github.com/gosodax/sodax-sdks/blob/main/packages/bridge-api/README.md#api-key) |
| `/v1/be/oracle/*` | USD OHLC price candles for charts | Unauthenticated `GET` |
| `/v1/be/solver/*` | Solver volume / orderbook / intent journal reads | Unauthenticated `GET` |
| `/v1/be/config/*` | Chains, tokens, hub assets | Unauthenticated `GET` |
| `/v1/be/partners/*` | Partner receivers + fee/volume summary | Unauthenticated `GET` |
| `/v1/be/sodax/*` | SODA total / circulating supply | Unauthenticated `GET` |
| `/v1/be/intent/*` | Intent lookup by hash / tx / user | Unauthenticated `GET` |
| `/v1/be/moneymarket/*` | Money-market positions & reserves (read) | Unauthenticated `GET` |
| `/v1/intent/*` | Solver service (quote / execute / status / oracle prices) | Unauthenticated |
| `/v1/a/*` | Sonic data backend (pools, volume, prices) | Unauthenticated `GET` |
| `/v1/sponsorships/*` | Stellar sponsoring | API key (enforced; its own key registry, not a portal key — see [API keys](https://docs.sodax.com/developers/how-to/api-keys.md)) |

## Shared conventions

### BigInt as decimal strings

Any amount, chain id field, or token quantity larger than a safe JSON integer is serialized as a **decimal string** on the wire (e.g. `"1000000"`, never a bare JS number for wei-scale values).

```json theme={null}
{ "inputAmount": "1000000", "deadline": "1786500000" }
```

Not every decimal string is an integer, though — prices and supply figures carry a fractional part. Match the parser to the value: integer strings take `BigInt`, fractional strings need a decimal library. See [SODA supply](https://docs.sodax.com/developers/http-api/stats.md#soda-supply) for the trap this creates.

### Timestamps

There is no single representation — read the unit off the endpoint you are calling.

| Where | Representation |
| - | - |
| Oracle candle `timestamp`, and the `from` / `to` query parameters | UNIX **seconds** |
| Date fields inside JSON bodies — e.g. `now` in the health response, `abandonedAt` on swap status | **ISO 8601** strings |
| Intent date filters (`startDate` / `endDate`) | **ISO 8601** on the wire |

> [!NOTE]
>
> Porting from the SDK? `backendApi.getUserIntents()` takes `startDate` / `endDate` as
> **milliseconds** and converts them to ISO 8601 before sending. That conversion is a client-side
> convenience, not the wire format — calling the endpoint directly with a millisecond value will not
> work.

### Errors at the edge

Unknown routes return:

```json theme={null}
{ "ok": false, "error": "route_not_found" }
```

Service-level validation errors are typically HTTP `400` with a descriptive message body. Rate-limited writes return `429`.

Two 404 shapes exist, and telling them apart saves debugging time. The payload above is the
**gateway** shape: the path matched no published route, so the request never reached a service — this
almost always means a wrong or missing prefix. A **service** 404 carries a message instead, meaning
the prefix was right and the service itself rejected the path:

```json theme={null}
{ "message": "Cannot GET /api/swaps", "error": "Not Found", "statusCode": 404 }
```

To confirm a base URL and prefix are right before debugging anything else:

```bash theme={null}
curl -s 'https://api.sodax.com/v1/be/healthz'
# → {"status":"ok","service":"api","aggregatorBlockHeight":"78868510","now":"…","acceptTraffic":true}
```

A `route_not_found` from that path means the prefix is wrong, not that the API is down.

### Caching

Read endpoints are often cached server-side (seconds to a minute). Polling faster than the cache TTL does not yield fresher data. Exact TTLs are noted per page where known.

Read endpoints also send a weak `ETag` and honour `If-None-Match`, so a poller can skip
re-downloading an unchanged payload:

```bash theme={null}
curl -s -D- -o /dev/null 'https://api.sodax.com/v1/be/oracle/markets' | grep -i etag
# etag: W/"319-AoMQadrF9GEZWYlx1LKeFt0/Lc4"

curl -s -o /dev/null -w '%{http_code}\n' \
  -H 'If-None-Match: W/"319-AoMQadrF9GEZWYlx1LKeFt0/Lc4"' \
  'https://api.sodax.com/v1/be/oracle/markets'
# → 304
```

### Partner fees

Partner monetization uses a per-request `partnerFee` object on quote/create-intent style endpoints — there is **no** global default fee. See [Swaps](https://docs.sodax.com/developers/http-api/swaps.md#partner-fee) and the [Monetize SDK](https://docs.sodax.com/developers/how-to/monetize_sdk.md) guide for claiming.

## Choose a path

| You want to… | Use |
| - | - |
| Chart USD prices for SODAX assets | [Oracle candles](https://docs.sodax.com/developers/http-api/oracle.md) |
| Show live hub token prices | [Solver oracle](https://docs.sodax.com/developers/http-api/oracle.md#solver-oracle-live-prices) |
| Show “networks / partners / volume / supply” on a site | [Stats](https://docs.sodax.com/developers/http-api/stats.md) |
| Run swaps from a bot or non-TS stack | [Swaps API](https://docs.sodax.com/developers/http-api/swaps.md) |
| Deposit into leverage vaults over HTTP | [Leverage yield](https://docs.sodax.com/developers/http-api/leverage.md) |
| Move assets between networks without a swap | [Bridge hub](https://docs.sodax.com/bridge.md) (`/v1/bridge/*`) |
| Activate a new Stellar account | [Stellar sponsoring](https://docs.sodax.com/developers/how-to/stellar-sponsoring-getting-started.md) (`/v1/sponsorships/*`, API key) |
| Full wallet + multi-chain UX in React | [`@sodax/sdk`](https://docs.sodax.com/developers/packages/foundation/sdk) + [`@sodax/dapp-kit`](https://docs.sodax.com/developers/packages/experience/dapp-kit) |

## OpenAPI

Machine-readable OpenAPI for the backend API is available at:

* `https://api.sodax.com/v1/be/docs` (interactive)
* `https://api.sodax.com/v1/be/docs-json`

Swaps and leverage yield each publish their own spec:

* Swaps: `https://api.sodax.com/v1/swaps/docs` (interactive) and `/v1/swaps/docs-json`
* Leverage yield: `https://api.sodax.com/v1/leverage-yield/docs` (interactive) and `/v1/leverage-yield/docs-json`

The Stateful API — the partner-portal surface behind [API keys](https://docs.sodax.com/developers/how-to/api-keys.md) — publishes
its own spec at `https://api.sodax.com/v1/bes/docs` (interactive) and `/v1/bes/docs-json`. Read it as a
service reference, not a callable base path: the edge publishes only `docs`, `docs-json` and `healthz`
under `/v1/bes`, so the portal and user routes the spec lists answer a gateway `route_not_found` there.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.