---
title: "Get trade quote"
method: GET
path: "/trade/quote"
tags: ["Trade"]
---

# Get trade quote

`GET /trade/quote`

## Request

- Base URL: `https://public-api-v2.bags.fm/api/v1`
- URL: `https://public-api-v2.bags.fm/api/v1/trade/quote`
- Auth: API key in header `x-api-key`
- TypeScript: <https://skmtc.dev/bags/apis/bags-public-api-v2/docs/trade/quote/get.ts> (a function with typed inputs; its response is checked against the schema)

Get a quote for swapping tokens. Returns expected output amount, price impact, slippage, and route plan.

## Query parameters

- `inputMint` string, required
- `outputMint` string, required
- `amount` number, required
- `slippageMode` 'auto' | 'manual'
- `slippageBps` number

## Response `200`

Successfully retrieved trade quote

- object
  - `success` boolean, required
  - `response` object
    - `requestId` string, required: Unique identifier for the quote request
    - `contextSlot` number, required: The slot at which the quote was generated
    - `inAmount` string, required: Input amount
    - `inputMint` string, required: Input token mint public key
    - `outAmount` string, required: Expected output amount
    - `outputMint` string, required: Output token mint public key
    - `minOutAmount` string, required: Minimum output amount considering slippage
    - `otherAmountThreshold` string, required: Other amount threshold for the swap
    - `priceImpactPct` string, required: Price impact percentage
    - `slippageBps` number, required: Slippage tolerance in basis points
    - `routePlan` RoutePlanLeg[], required: Array of route legs showing the swap path
      - `venue` string, required: Name of the DEX or venue
      - `inAmount` string, required: Input amount for this leg
      - `outAmount` string, required: Output amount for this leg
      - `inputMint` string, required: Input token mint for this leg
      - `outputMint` string, required: Output token mint for this leg
      - `inputMintDecimals` number, required: Decimals of the input token mint
      - `outputMintDecimals` number, required: Decimals of the output token mint
      - `marketKey` string, required: Market key for this leg
      - `data` string, required: Additional data for this leg
    - `platformFee` PlatformFee
      - `amount` string, required: Platform fee amount
      - `feeBps` number, required: Platform fee in basis points
      - `feeAccount` string, required: Public key of the fee account
      - `segmenterFeeAmount` string, required: Segmenter fee amount
      - `segmenterFeePct` number, required: Segmenter fee percentage
    - `outTransferFee` string, nullable: Output transfer fee if applicable
    - `simulatedComputeUnits` number, nullable: Simulated compute units for the swap transaction

## Other responses

- `400`: Bad request - Invalid parameters or insufficient liquidity
- `401`: Unauthorized - Invalid or missing API key
- `500`: Internal server error

---

[API](https://skmtc.dev/bags/apis/bags-public-api-v2.md) - [All operations](https://skmtc.dev/bags/apis/bags-public-api-v2/llms.txt) - [OpenAPI document](https://skmtc.dev/bags/apis/bags-public-api-v2/revisions/4a14b82cd39d?raw)
