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

# Real-time quotes (WebSocket)

> Receive ramp quotes over Socket.IO every time the rate changes.

Subscribe to a quote channel to receive the price of a ramp every time the rate changes, instead of polling [Quote Ramp (Send Based)](/business/api-reference/ramp-orders/quote-ramp-send-based).

| Environment | URL | Path |
| - | - | - |
| Test | `wss://ws-test.kravata.co` | `/kmsramps/socket.io` |
| Production | `wss://ws.kravata.co` | `/kmsramps/socket.io` |

The server uses [Socket.IO](https://socket.io/) (protocol v4). Use an official Socket.IO client, such as `socket.io-client` for JavaScript or `python-socketio` for Python.

## Subscribe

```javascript theme={null}
import { io } from "socket.io-client";

const socket = io("wss://ws.kravata.co", {
  path: "/kmsramps/socket.io",
  transports: ["websocket"],
});

socket.emit(
  "subscribe",
  { pair: "usdc_all_cop", side: "sell", amountSent: 1000, clientId: "YOUR_CLIENT_ID" },
  (ack) => console.log(ack), // {"status": "ok"}
);

socket.on("rate_update", (quote) => console.log(quote));
```

| Field | Type | Required | Description |
| - | - | - | - |
| pair | string | Yes | `{token}_{network}_{fiat}` in lowercase, e.g. `usdc_all_cop` or `usdt_polygon_cop`. Use `all` as network when it does not matter. |
| side | string | Yes | `buy` for an on-ramp (you send fiat and receive the token) or `sell` for an off-ramp (you send the token and receive fiat). |
| amountSent | number | No | Amount you send, greater than 0. Defaults to `1000`. |
| clientId | string | No | Your client ID, from [Get Client Info](/business/api-reference/authentication/get-client-info). Send it to receive **your** pricing. |
| network | string | No | Overrides the network of the pair. |

The acknowledgement is `{"status": "ok"}`, or `{"status": "error", "reason": "..."}`:

| Reason | Cause |
| - | - |
| `pair/side missing` | `pair` or `side` was not sent. |
| `pair must be token_network_fiat and side buy/sell` | Invalid format. |
| `amountSent must be a number` / `amountSent must be greater than 0` | Invalid amount. |

Each connection has one subscription: emitting `subscribe` again replaces it. To stop receiving updates, disconnect.

## Updates

`rate_update` carries the same fields as [Quote Ramp (Send Based)](/business/api-reference/ramp-orders/quote-ramp-send-based), plus the `date` of the rate. Fields whose value is zero are omitted.

```json theme={null}
{
  "date": "2026-10-01 10:15:00",
  "amountSent": 1000.0,
  "amountToReceive": 3897500.0,
  "costInfra": 2500.0,
  "rateClient": 3900.0,
  "symbolTypeSent": "USDC",
  "symbolTypeReceived": "COP",
  "rampType": "off_ramp",
  "validUntil": "2026-10-01T15:15:30.000000Z"
}
```

If the quote cannot be calculated, `rate_update` carries `{"status": "error", "reason": "..."}`.

Updates are sent every time the rate of the pair changes. For COP pairs, the rate is updated every minute between **8:00 and 22:00 (Bogotá time)**.

<Note>
  Socket quotes are informative and do not include a `quoteId`. To lock a price, request a quote with [Quote Ramp (Send Based)](/business/api-reference/ramp-orders/quote-ramp-send-based) and send its `quoteId` when you [create the ramp](/business/api-reference/ramp-orders/create-ramp-send-based).
</Note>
