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

# Get Token Rate

> Public quote on a specific network. Returns **buy** and/or **sell** quotes, order type, and refund timeout.

**Token + fiat:** each of **`from`** / **`to`** is either an enabled **fiat currency code** or an enabled **crypto (token) symbol** on **`network`**. Exactly one must be fiat and one crypto (`.../USDT/100/NGN` and `.../NGN/100/USDT` are equivalent). **`amount`** is the **crypto notional**. Rates are **fiat per 1 token** for each side. **`from` and `to` cannot both be crypto.**

**Ambiguous segment:** if a path value matches **both** an enabled fiat code **and** an enabled crypto symbol on that network (e.g. same string), the request returns **400** unless **`from_source`** and/or **`to_source`** is set to **`fiat`** or **`crypto`** to pick the leg.

**Fiat + fiat:** both segments are fiat codes. The quote **bridges through USDC** on the same **`network`**. **`amount`** is denominated in **`from`** fiat. **`sell`** is **destination fiat per 1 unit of `from` fiat** (buy USDC with `from`, sell USDC for `to`). **`buy`** is **`from` fiat per 1 unit of `to` fiat** (inverse corridor; buy USDC with `to`, sell USDC for `from`)—asymmetric from **`sell`**, not a simple reciprocal.

Path order does **not** imply trade direction for token/fiat pairs; omitting **`side`** returns **both** sides when available.

For the legacy single-number response, use **`GET /v1/rates/{token}/{amount}/{fiat}`** with optional `network` query.


Get buy and/or sell quotes on a **specific network**—either a **token + fiat** pair or a **fiat + fiat** corridor (via USDC). This is the recommended public rates URL for v2 integrations.

<Note>
  The legacy endpoint **`GET /v1/rates/{token}/{amount}/{fiat}`** (optional `network` query) returns a **single numeric** `data` field. The v2 path below returns a structured **`buy` / `sell`** payload.
</Note>

## Path parameters

| Parameter | Description                                                                                                           |
| --------- | --------------------------------------------------------------------------------------------------------------------- |
| `network` | Network id: `ethereum`, `base`, `bnb-smart-chain`, `lisk`, `scroll`, `celo`, `arbitrum-one`, `polygon`, `asset-chain` |
| `from`    | Fiat currency code **or** token symbol on `network` (paired with `to`)                                                |
| `amount`  | For **token + fiat**: crypto (token) notional. For **fiat + fiat**: amount in **`from`** fiat.                        |
| `to`      | Fiat currency code **or** token symbol on `network` (paired with `from`)                                              |

**Token + fiat:** exactly **one** fiat and **one** token (`.../USDT/100/NGN` ≡ `.../NGN/100/USDT`). **`from`/`to` cannot both be tokens.** **Path order does not imply trade direction**—use `side` or read **`data.buy`** / **`data.sell`** for onramp vs offramp display.

**Fiat + fiat:** both are fiat codes; the server quotes through **USDC** on the same network. **`sell.rate`** = **`to` per 1 `from`**. **`buy.rate`** = **`from` per 1 `to`** (inverse corridor, **not** the reciprocal of `sell`—each side uses the appropriate leg bid/ask).

## Query parameters

| Parameter     | Required | Description                                                                                                                             |
| ------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------- |
| `side`        | No       | `buy` or `sell` to return **only** that side. Omit to receive **both** when available.                                                  |
| `from_source` | No       | If `from` matches **both** a fiat currency and a crypto asset on the network, set to **`fiat`** or **`crypto`**. Omit when unambiguous. |
| `to_source`   | No       | If `to` matches **both** a fiat currency and a crypto asset on the network, set to **`fiat`** or **`crypto`**. Omit when unambiguous.   |
| `provider_id` | No       | Exactly **8 alphabetic** characters (`A–Z`, `a–z`) to pin the quote to one provider.                                                    |

## Example

```bash theme={null}
# Both buy and sell quotes on Base (token then fiat)
GET https://api.paycrest.io/v2/rates/base/USDT/100/NGN

# Same pair with fiat then token
GET https://api.paycrest.io/v2/rates/base/NGN/100/USDT

# Sell side only (typical for offramp display)
GET https://api.paycrest.io/v2/rates/base/USDT/100/NGN?side=sell

# Specific provider
GET https://api.paycrest.io/v2/rates/base/USDT/100/NGN?provider_id=AbCdEfGh
```

## Success response (`data`)

Each populated side includes:

| Field                  | Type      | Description                                                                                                               |
| ---------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------- |
| `rate`                 | string    | For token+fiat: fiat per crypto. For fiat+fiat: see path rules above (`sell` = `to` per `from`, `buy` = `from` per `to`). |
| `providerIds`          | string\[] | Provider id(s) for the quote                                                                                              |
| `orderType`            | string    | e.g. `regular` or `otc`                                                                                                   |
| `refundTimeoutMinutes` | integer   | Minutes until automatic refund for that flow                                                                              |

```json theme={null}
{
  "status": "success",
  "message": "Rate fetched successfully",
  "data": {
    "buy": {
      "rate": "1498.25",
      "providerIds": ["AbCdEfGh"],
      "orderType": "regular",
      "refundTimeoutMinutes": 60
    },
    "sell": {
      "rate": "1500.50",
      "providerIds": ["AbCdEfGh"],
      "orderType": "regular",
      "refundTimeoutMinutes": 60
    }
  }
}
```

When `side=buy` or `side=sell`, only that key is present under `data`.

## Errors

| HTTP    | Typical cause                                                                                                                                                                                                                                            |
| ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **400** | Invalid `amount`, invalid `side`, invalid `from_source`/`to_source` (must be `fiat` or `crypto`), ambiguous segment without disambiguation, invalid `provider_id`, unsupported asset on network, or conversion rules (e.g. stable only to its base fiat) |
| **404** | No provider available for the amount/currency/network                                                                                                                                                                                                    |
| **503** | Banking/mobile network issues affecting providers for the currency                                                                                                                                                                                       |
| **500** | Internal error while resolving the rate                                                                                                                                                                                                                  |

## Rate resolution

Behavior matches the priority-queue–based resolution used when creating orders: the quote reflects provider selection and validation for the requested **side** (`buy` vs `sell`). **Path segment order (`from` / `to`) does not select direction**—use `?side=`, or read **`data.sell`** for **offramp** (crypto → fiat) display and **`data.buy`** for **onramp** (fiat → crypto) before `POST /v2/sender/orders`.

See also [Get Token Rate (v1)](/api-reference/general/get-token-rate-v1) for the legacy scalar response.


## OpenAPI

````yaml openapi-v2.yaml GET /rates/{network}/{from}/{amount}/{to}
openapi: 3.0.3
info:
  title: Paycrest Aggregator API
  version: 1.0.0
  description: >
    OpenAPI schema for the Paycrest Aggregator API. This covers sender,
    provider, and general endpoints.
servers:
  - url: https://api.paycrest.io/v2
security: []
tags:
  - name: Sender
    description: Endpoints for senders to create and manage payment orders
  - name: Provider
    description: Endpoints for providers to manage and fulfill orders
  - name: General
    description: General protocol and utility endpoints
paths:
  /rates/{network}/{from}/{amount}/{to}:
    get:
      tags:
        - General
      summary: Get token rate (v2)
      description: >
        Public quote on a specific network. Returns **buy** and/or **sell**
        quotes, order type, and refund timeout.


        **Token + fiat:** each of **`from`** / **`to`** is either an enabled
        **fiat currency code** or an enabled **crypto (token) symbol** on
        **`network`**. Exactly one must be fiat and one crypto
        (`.../USDT/100/NGN` and `.../NGN/100/USDT` are equivalent). **`amount`**
        is the **crypto notional**. Rates are **fiat per 1 token** for each
        side. **`from` and `to` cannot both be crypto.**


        **Ambiguous segment:** if a path value matches **both** an enabled fiat
        code **and** an enabled crypto symbol on that network (e.g. same
        string), the request returns **400** unless **`from_source`** and/or
        **`to_source`** is set to **`fiat`** or **`crypto`** to pick the leg.


        **Fiat + fiat:** both segments are fiat codes. The quote **bridges
        through USDC** on the same **`network`**. **`amount`** is denominated in
        **`from`** fiat. **`sell`** is **destination fiat per 1 unit of `from`
        fiat** (buy USDC with `from`, sell USDC for `to`). **`buy`** is **`from`
        fiat per 1 unit of `to` fiat** (inverse corridor; buy USDC with `to`,
        sell USDC for `from`)—asymmetric from **`sell`**, not a simple
        reciprocal.


        Path order does **not** imply trade direction for token/fiat pairs;
        omitting **`side`** returns **both** sides when available.


        For the legacy single-number response, use **`GET
        /v1/rates/{token}/{amount}/{fiat}`** with optional `network` query.
      parameters:
        - in: path
          name: network
          required: true
          schema:
            type: string
            enum:
              - ethereum
              - base
              - bnb-smart-chain
              - lisk
              - scroll
              - celo
              - arbitrum-one
              - polygon
              - asset-chain
          description: Blockchain network identifier (lowercase in URL).
        - in: path
          name: from
          required: true
          schema:
            type: string
          description: Fiat code or token symbol on `network` (paired with `to`).
        - in: path
          name: amount
          required: true
          schema:
            type: string
          description: >-
            For token+fiat pairs, the **token** notional. For fiat+fiat pairs,
            the amount in **`from`** fiat.
        - in: path
          name: to
          required: true
          schema:
            type: string
          description: Fiat code or token symbol on `network` (paired with `from`).
        - in: query
          name: side
          schema:
            type: string
            enum:
              - buy
              - sell
          description: Return only the buy or sell quote. Omit for both sides.
        - in: query
          name: from_source
          schema:
            type: string
            enum:
              - fiat
              - crypto
          description: >-
            When `from` matches both a fiat and a crypto asset on `network`, set
            to `fiat` or `crypto` to disambiguate. Ignored when `from` is
            unambiguous.
        - in: query
          name: to_source
          schema:
            type: string
            enum:
              - fiat
              - crypto
          description: >-
            When `to` matches both a fiat and a crypto asset on `network`, set
            to `fiat` or `crypto` to disambiguate. Ignored when `to` is
            unambiguous.
        - in: query
          name: provider_id
          schema:
            type: string
            pattern: ^[A-Za-z]{8}$
          description: >-
            Optional. When set, limits the quote to this provider. Must be
            exactly 8 alphabetic characters (A–Z, a–z).
      responses:
        '200':
          description: Token rate quote(s)
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/StandardResponse'
                  - type: object
                    properties:
                      data:
                        $ref: '#/components/schemas/V2RateQuoteResponse'
        '400':
          description: >-
            Bad request (invalid amount, side, provider_id, ambiguous from/to
            without from_source/to_source, unsupported asset/network, etc.)
        '404':
          description: No provider available for the requested swap
        '500':
          description: Internal error while resolving rate
        '503':
          description: Temporary provider or banking/network issue for the currency
      servers:
        - url: https://api.paycrest.io/v2
components:
  schemas:
    StandardResponse:
      type: object
      properties:
        status:
          type: string
          example: success
        message:
          type: string
          example: Operation successful
        data:
          type: object
          description: The actual response data (e.g., ReceiveAddressResponse, etc.)
    V2RateQuoteResponse:
      type: object
      description: >-
        Public token rate quote. Omit `side` to receive both buy and sell; use
        `side=buy` or `side=sell` for a single side.
      properties:
        buy:
          $ref: '#/components/schemas/V2RateQuoteSide'
        sell:
          $ref: '#/components/schemas/V2RateQuoteSide'
    V2RateQuoteSide:
      type: object
      description: Quote details for one side from the public v2 rates endpoint.
      properties:
        rate:
          type: string
          description: Achievable rate (fiat per crypto) for this side and notional.
        providerIds:
          type: array
          items:
            type: string
          description: >-
            Provider id(s) tied to the quote (single id when `provider_id` was
            requested).
        orderType:
          type: string
          description: Order flow type, e.g. `regular` or `otc`.
        refundTimeoutMinutes:
          type: integer
          description: Minutes until automatic refund for this flow.

````