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

# API Reference

> Complete endpoint reference for the Ratio API.

This section covers every Ratio API endpoint. For step-by-step integration guidance, see the [Integration Guide](/integration/overview).

## Base URLs

| Environment | Base URL                             |
| ----------- | ------------------------------------ |
| Sandbox     | `https://api.sandbox.ratiofx.com/v1` |
| Production  | `https://api.ratiofx.com/v1`         |

Sandbox connects to the Kaia Kairos testnet. No real funds are involved. Production connects to the Kaia mainnet and involves live stablecoins.

## Authentication

Every request requires the following headers:

| Header          | Value              |
| --------------- | ------------------ |
| `Authorization` | `Bearer {api_key}` |
| `X-Partner-ID`  | `{partner_id}`     |
| `Content-Type`  | `application/json` |

API keys are 256-bit random tokens issued during onboarding. Sandbox and production keys are separate.

```bash theme={null}
curl -X GET "https://api.ratiofx.com/v1/quote?pair=USD-IDR&side=BUY&amount=10000" \
  -H "Authorization: Bearer sk_live_abc123..." \
  -H "X-Partner-ID: partner_uuid_xyz" \
  -H "Content-Type: application/json"
```

## Endpoint index

### Quotes and execution

| Method | Endpoint         | Description                                      | Reference                               |
| ------ | ---------------- | ------------------------------------------------ | --------------------------------------- |
| `GET`  | `/v1/quote`      | Indicative quote — no inventory reservation      | [Quotes API](/api-reference/quotes-api) |
| `POST` | `/v1/firm-quote` | Firm executable quote with inventory reservation | [Quotes API](/api-reference/quotes-api) |
| `POST` | `/v1/execute`    | Execute a firm quote for on-chain settlement     | [Swaps API](/api-reference/swaps-api)   |

### System

| Method | Endpoint           | Description                       | Reference                             |
| ------ | ------------------ | --------------------------------- | ------------------------------------- |
| `GET`  | `/v1/system/state` | Current system state per corridor | [Swaps API](/api-reference/swaps-api) |

## Webhook events

| Event                  | Trigger                              | Reference                           |
| ---------------------- | ------------------------------------ | ----------------------------------- |
| `settlement.confirmed` | Swap settled on-chain successfully   | [Webhooks](/api-reference/webhooks) |
| `settlement.failed`    | Swap execution failed                | [Webhooks](/api-reference/webhooks) |
| `quote.expired`        | Firm quote expired without execution | [Webhooks](/api-reference/webhooks) |
| `system.state_change`  | A corridor's system state changed    | [Webhooks](/api-reference/webhooks) |
