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

# Market quote

> Get a spot market quote for any asset pair using from/to or an exchange pair symbol.

Returns a live market quote from Binance or Bybit. Supports **any-to-any** conversion via `from` and `to`, with automatic fallback to a USDT cross rate when no direct pair is listed.

<ParamField header="x-api-key" type="string" required placeholder="your-api-key">
  Your StarkFi API key.
</ParamField>

<ParamField query="from" type="string">
  Source asset symbol (e.g. `ETH`, `BTC`, `USDT`, `BRL`). Use together with `to` for any-to-any quotes.
</ParamField>

<ParamField query="to" type="string">
  Target asset symbol. Required with `from` when not using `pair`.
</ParamField>

<ParamField query="pair" type="string">
  Legacy exchange pair symbol (e.g. `BTCUSDT`). Omit when using `from` and `to`.
</ParamField>

<ParamField query="try_one" type="string">
  First pair orientation to try (e.g. `USDTETH`). Use with `try_two` for legacy fiat-oriented flows.
</ParamField>

<ParamField query="try_two" type="string">
  Second pair orientation to try (e.g. `ETHUSDT`). Use with `try_one`.
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl --request GET \
    --url 'https://api.starkfi.io/quote/market?from=ETH&to=USDT' \
    --header 'x-api-key: <api_key>'
  ```

  ```javascript Node.js theme={null}
  const params = new URLSearchParams({ from: "ETH", to: "USDT" });
  const response = await fetch(
    `https://api.starkfi.io/quote/market?${params}`,
    { headers: { "x-api-key": process.env.STARKFI_API_KEY } }
  );

  const data = await response.json();
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      "https://api.starkfi.io/quote/market",
      params={"from": "ETH", "to": "USDT"},
      headers={"x-api-key": "<api_key>"},
  )
  data = response.json()
  ```
</RequestExample>

<ResponseExample>
  ```json 200 - Direct pair theme={null}
  {
    "statusCode": 200,
    "success": true,
    "status": "quote_ok",
    "message": "Market quote",
    "data": {
      "symbol": "ETHUSDT",
      "price": "3000",
      "source": "binance",
      "market": {
        "symbol": "ETHUSDT",
        "price": "3000"
      },
      "exchange": {
        "symbol": "ETHUSDT",
        "base": "ETH",
        "quote": "USDT",
        "meaning": "Exchange spot: 1 ETH costs 3000 USDT"
      },
      "rates": [
        {
          "from": "ETH",
          "to": "USDT",
          "price": "3000",
          "description": "1 ETH = 3000 USDT"
        },
        {
          "from": "USDT",
          "to": "ETH",
          "price": "0.00033333",
          "description": "1 USDT = 0.00033333 ETH"
        }
      ],
      "requested": {
        "from": "ETH",
        "to": "USDT",
        "price": "3000",
        "description": "1 ETH = 3000 USDT"
      }
    }
  }
  ```

  ```json 200 - Via USDT cross theme={null}
  {
    "statusCode": 200,
    "success": true,
    "status": "quote_ok",
    "message": "Market quote via USDT",
    "data": {
      "symbol": null,
      "price": "300000000",
      "source": "binance",
      "route": {
        "type": "via_usdt",
        "intermediary": "USDT",
        "from": "ETH",
        "to": "PEPE",
        "legs": [
          { "symbol": "ETHUSDT", "price": "3000", "source": "binance" },
          { "symbol": "PEPEUSDT", "price": "0.00001", "source": "binance" }
        ]
      },
      "exchange": {
        "symbol": null,
        "base": "ETH",
        "quote": "PEPE",
        "meaning": "Cross rate via USDT: 1 ETH = 300000000 PEPE"
      },
      "requested": {
        "from": "ETH",
        "to": "PEPE",
        "price": "300000000",
        "description": "1 ETH = 300000000 PEPE"
      }
    }
  }
  ```

  ```json 400 - Params mismatch theme={null}
  {
    "statusCode": 400,
    "success": false,
    "status": "params_mismatch",
    "message": "Provide pair or from and to assets"
  }
  ```

  ```json 400 - Pair not found theme={null}
  {
    "statusCode": 400,
    "success": false,
    "status": "pair_not_found",
    "message": "Pair to price conversion not found"
  }
  ```
</ResponseExample>

### Notes

* Asset symbols must match exchange tickers (letters, numbers, `.`, `_`, `-`; max 64 characters).
* Prices follow the spot convention **BASEQUOTE**: `price` is how much **quote** asset one **base** costs.
* StarkFi queries Binance first, then Bybit, for each candidate symbol.
