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

# Quoting Stream

> Real-time WebSocket stream for continuously refreshed swap quotes

<Tip> This endpoint is only available to Growth and Enterprise plans. </Tip>

## Endpoint Details

* **URL**: `wss://api.mobula.io`
* **Event Type**: `quoting`

The `quoting` stream continuously emits swap quotes for a fixed `tokenIn -> tokenOut` request. It sends:

* a quote immediately after subscription,
* a periodic quote every `intervalMs` milliseconds,
* an extra quote whenever a trade touches either `tokenIn` or `tokenOut`,
* never more frequently than `minIntervalMs`.

By default, `intervalMs` is `1000` and `minIntervalMs` is `300`. The minimum accepted `minIntervalMs` is `100`.

## Subscription Format

```json theme={null}
{
  "type": "quoting",
  "authorization": "YOUR_API_KEY",
  "payload": {
    "chainId": "solana:solana",
    "tokenIn": "So11111111111111111111111111111111111111112",
    "tokenOut": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
    "amountRaw": "1000000000",
    "walletAddress": "YourWalletAddress",
    "slippage": 1,
    "intervalMs": 500,
    "minIntervalMs": 100,
    "subscriptionTracking": true
  }
}
```

## Parameters

* **`chainId`** or **`blockchain`** (required): Blockchain identifier, for example `solana:solana`, `solana`, `evm:1`, or `ethereum`.
* **`tokenIn`** (required): Address of the token to swap from.
* **`tokenOut`** (required): Address of the token to swap to.
* **`amount`**, **`amountRaw`**, or **`amountUSD`** (required): Exactly one amount selector. `amountRaw` is recommended for execution-grade precision.
* **`walletAddress`** (required): Wallet used to build executable quote calldata.
* **`slippage`** (optional): Slippage tolerance in percent. Default: `1`.
* **`intervalMs`** (optional): Periodic refresh interval in milliseconds. Default: `1000`, minimum: `100`.
* **`minIntervalMs`** (optional): Minimum delay between two emitted quotes. Default: `300`, minimum: `100`.
* **`poolAddress`** (optional): Restrict the route to a specific pool.
* **`onlyRouters`** (optional): Router allow-list, for example `["jupiter"]` or `"jupiter,naos"`.
* **`onlyProtocols`** / **`excludedProtocols`** (optional): Protocol filters, same semantics as the REST swap quoting endpoint.
* **`prioritizationFeeLamports`**, **`dynamicComputeUnitLimit`**, **`jitoTipLamports`**, **`payerAddress`** (optional): Solana execution options.
* **`feePercentage`**, **`feeWallet`**, **`minFeesNative`** (optional): Fee options.
* **`onlyVerifiedTokens`** (optional): Reject unverified launchpad tokens when true.
* **`directRoutes`** (optional): Force direct routes only.
* **`subscriptionId`** (optional): Custom subscription id.
* **`subscriptionTracking`** (optional): Sends a `subscribed` acknowledgement when true.

## Trade Triggering

Trade-triggered quotes are keyed on both sides of the quote. If you subscribe to `tokenIn = SOL` and `tokenOut = TOKEN`, a trade on either SOL or TOKEN can trigger a new quote, even when the trade is not directly in the requested buy direction.

During heavy trade bursts, the stream coalesces updates using `minIntervalMs`. For example, with `intervalMs = 500` and `minIntervalMs = 100`, the stream sends at least the periodic quotes and can react to trades, but it will not emit more than one quote per 100ms for that subscription.

## Response Format

```json theme={null}
{
  "type": "quoting",
  "subscriptionId": "sub_abc123",
  "event": "quote",
  "quoteTrigger": "swap",
  "quoteSequence": 12,
  "requestId": "6d9e5d8e-4c2d-4ed3-a31c-5a6a35fb03ef",
  "chainId": "solana:solana",
  "tokenInAddress": "So11111111111111111111111111111111111111112",
  "tokenOutAddress": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
  "amountOutTokens": "154.23",
  "slippagePercentage": 3.5,
  "marketImpactPercentage": 0.18,
  "amountInUSD": 145.21,
  "amountOutUSD": 144.94,
  "tokenIn": {
    "address": "So11111111111111111111111111111111111111112",
    "symbol": "SOL",
    "decimals": 9
  },
  "tokenOut": {
    "address": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
    "symbol": "USDC",
    "decimals": 6
  },
  "solana": {
    "transaction": {
      "serialized": "BASE64_TRANSACTION",
      "variant": "versioned"
    },
    "lastValidBlockHeight": 269450123
  },
  "latencyMs": 42,
  "timestamp": 1779970000000
}
```

`quoteTrigger` is one of:

* `initial`: first quote after subscription
* `interval`: periodic refresh
* `swap`: trade-triggered refresh

If quote generation fails, the frame keeps the same envelope and includes `error`.

## Unsubscribe

```json theme={null}
{
  "type": "unsubscribe",
  "payload": {
    "type": "quoting",
    "subscriptionId": "sub_abc123"
  }
}
```
