# GET /v1/xrpl/slippage

Slippage and average price for buying an amount of base currency.

## Purpose

Walks the asks of the cached order book to estimate the average price and `slippage_pct` (a percentage; `null` when liquidity is insufficient) of buying `amount` of `base` paying `quote`. For an issued currency the issuer's transfer fee is reported when it can be loaded. The top-level fields describe the CLOB; `venues` compares the CLOB with the AMM pool for the same amount (`best` is the cheaper venue by average price, ties go to the CLOB, no routing split) and `venues.amm_status` is `ok`, `stale`, `no_pool` or `unavailable`. `venues.amm` is `null` when the pair has no pool or the pool could not be read; the response never fails because of the AMM. CLOB slippage is measured against the best ask and AMM slippage against the pool spot price (so it includes the trading fee).

## When to use

Before placing a market-style trade, to size it against available depth and to see whether the CLOB or the AMM pool is the cheaper venue.

## When not to use

It is an estimate, not a quote, and it does not split an amount across venues or route through other pairs. To read pool reserves, use the amm page.

## Parameters

| Name | In | Required | Description | Constraints | Example |
|---|---|---|---|---|---|
| `base` | query | yes | Currency to buy. | `XRP` or `CODE.issuer`. `XRP` takes no issuer; any other code needs one. The code is 3 letters or digits (A-Z, 0-9) or 40 hexadecimal digits and is upper-cased; the issuer is a valid classic XRPL address (r..., checksum verified) | `XRP` |
| `quote` | query | yes | Currency paid. | `XRP` or `CODE.issuer`. `XRP` takes no issuer; any other code needs one. The code is 3 letters or digits (A-Z, 0-9) or 40 hexadecimal digits and is upper-cased; the issuer is a valid classic XRPL address (r..., checksum verified) | `USD.rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh` |
| `amount` | query | yes | Amount of `base` to buy, as a decimal string. | Positive decimal such as `1000` or `0.5`; never a number literal in JSON | `1000` |
| `depth` | query | no | Order book levels per side. | Positive integer, rounded up to 10, 50, 100 or 200 and capped at 200 (so 11 becomes 50 and 500 becomes 200); default 200 | `10` |

## Request example

```sh
curl -s "https://api.criptonlabs.com/v1/xrpl/slippage?base=XRP&quote=USD.rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh&amount=1000"
```

## Response example (200)

```json
{
  "base": "XRP",
  "quote": "USD.rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
  "side": "buy",
  "depth": 200,
  "amount": "1000",
  "filled": "1000",
  "partial": false,
  "insufficient_liquidity": false,
  "best_price": "2.1",
  "avg_price": "2.1042",
  "slippage_pct": "0.2",
  "transfer_fee_applied": false,
  "transfer_fee": null,
  "avg_price_after_fees": null,
  "venues": {
    "best": "clob",
    "amm_status": "ok",
    "clob": {
      "avg_price": "2.1042",
      "cost": "2104.2",
      "slippage_pct": "0.2",
      "insufficient_liquidity": false,
      "avg_price_after_fees": null
    },
    "amm": {
      "avg_price": "2.1331",
      "cost": "2133.1",
      "slippage_pct": "1.5762",
      "insufficient_liquidity": false,
      "avg_price_after_fees": null,
      "spot_price": "2.1",
      "trading_fee": "0.005"
    }
  },
  "meta": {
    "ledger_index": 100234566,
    "as_of": "2026-10-06T12:00:03.000Z",
    "age_seconds": 2,
    "cache": "hit",
    "stale": false
  }
}
```

## Errors

- 400 [invalid-parameters](https://api.criptonlabs.com/errors/invalid-parameters.md)
- 400 [bad-request](https://api.criptonlabs.com/errors/bad-request.md)
- 429 [rate-limited](https://api.criptonlabs.com/errors/rate-limited.md)
- 503 [upstream-unavailable](https://api.criptonlabs.com/errors/upstream-unavailable.md)

## Caching

Fresh for 4 seconds; on upstream failure the last good value is served for up to 30 seconds (`meta.stale` is `true`), then the service answers 503. See the [freshness guide](https://api.criptonlabs.com/docs/guides/freshness.md).

## Rate limit

Tier `expensive`. See the [rate-limits guide](https://api.criptonlabs.com/docs/guides/rate-limits.md).

## MCP tool

The MCP tool `xrpl_slippage` returns the same data. See the [MCP quickstart](https://api.criptonlabs.com/docs/guides/mcp-quickstart.md).
