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

# Get Trade V2 Quote

> Get a server-built swap quote, racing Jupiter `swap/v2/build` against Titan (when configured). The winning quote is cached in Redis for 60 seconds under the returned `requestId`, which is then passed to `POST /trade/v2/swap` to build the unsigned transaction.

Every pair is charged the 1% Bags fee, including token-to-token. The mint and leg are resolved by preference and reported as `feeMint`/`feeSide`: native SOL wins on either leg, otherwise a preferred stablecoin/LST mint if either leg is one, otherwise the input mint. When `feeSide` is `input`, the fee is deducted from `amount` before the provider quote. When `feeSide` is `output`, the full `amount` is quoted and the fee is taken from the proceeds.



## OpenAPI

````yaml GET /trade/v2/quote
openapi: 3.1.0
info:
  title: Bags Public API v2
  description: API endpoints for Bags platform
  version: 2.0.0
  contact:
    name: Bags Support
    url: https://support.bags.fm
servers:
  - url: https://public-api-v2.bags.fm/api/v1
    description: Production server
security:
  - ApiKeyAuth: []
tags:
  - name: Token Launch
    description: Endpoints for creating and managing token launches
  - name: Fee Share
    description: Endpoints for managing fee sharing configs
  - name: Fee Share Admin
    description: >-
      Endpoints for fee share admin operations including listing, transferring
      admin authority, and updating configs
  - name: Analytics
    description: Endpoints for retrieving token analytics and metadata
  - name: Fee Claiming
    description: Endpoints for claiming fees from various sources
  - name: State
    description: Endpoints for retrieving on-chain state and derived state
  - name: Trade
    description: Endpoints for getting trade quotes and executing token swaps
  - name: Partner
    description: Endpoints for managing partner configurations and claiming partner fees
  - name: Solana
    description: Endpoints for direct Solana blockchain interactions
  - name: EVM
    description: Endpoints for reading Bags EVM token data
  - name: Robinhood Chain
    description: Read endpoints for Bags V2 tokens on Robinhood Chain (chain id 4663)
  - name: Dexscreener
    description: >-
      Endpoints for managing Dexscreener token info orders, payments, and image
      uploads
  - name: Auth
    description: Endpoints for retrieving authenticated user information
  - name: Agent
    description: Endpoints for AI agent wallet-signature authentication (V2)
paths:
  /trade/v2/quote:
    get:
      tags:
        - Trade
      summary: Get trade v2 quote
      description: >-
        Get a server-built swap quote, racing Jupiter `swap/v2/build` against
        Titan (when configured). The winning quote is cached in Redis for 60
        seconds under the returned `requestId`, which is then passed to `POST
        /trade/v2/swap` to build the unsigned transaction.


        Every pair is charged the 1% Bags fee, including token-to-token. The
        mint and leg are resolved by preference and reported as
        `feeMint`/`feeSide`: native SOL wins on either leg, otherwise a
        preferred stablecoin/LST mint if either leg is one, otherwise the input
        mint. When `feeSide` is `input`, the fee is deducted from `amount`
        before the provider quote. When `feeSide` is `output`, the full `amount`
        is quoted and the fee is taken from the proceeds.
      parameters:
        - name: inputMint
          in: query
          required: true
          schema:
            type: string
          description: Public key of the input token mint
        - name: outputMint
          in: query
          required: true
          schema:
            type: string
          description: Public key of the output token mint
        - name: taker
          in: query
          required: true
          schema:
            type: string
          description: Public key of the wallet that will sign the swap
        - name: amount
          in: query
          required: true
          schema:
            type: string
          description: >-
            Amount to swap in the token's smallest unit, as a positive integer
            string of raw base units (1-20 digits, no leading zeros)
        - name: slippageBps
          in: query
          required: false
          schema:
            oneOf:
              - type: string
                enum:
                  - auto
              - type: integer
                minimum: 0
                maximum: 10000
            default: auto
          description: '''auto'' or an integer 0-10000 in basis points'
        - name: transactionSpeed
          in: query
          required: false
          schema:
            type: string
            enum:
              - normal
              - fast
              - turbo
            default: turbo
          description: Priority fee tier used when building the transaction
        - name: provider
          in: query
          required: false
          schema:
            type: string
            enum:
              - auto
              - jupiter
              - titan
            default: auto
          description: >-
            Provider to quote against. 'auto' races Jupiter and Titan (when
            Titan is configured) and serves the first success
      responses:
        '200':
          description: Successfully retrieved trade v2 quote
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/SuccessResponse'
                  - type: object
                    properties:
                      response:
                        $ref: '#/components/schemas/TradeV2QuoteResponse'
        '400':
          description: Bad request - Invalid parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized - Invalid or missing API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: No route found for this amount
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    SuccessResponse:
      type: object
      properties:
        success:
          type: boolean
          example: true
        response:
          description: ''
      required:
        - success
    TradeV2QuoteResponse:
      type: object
      properties:
        requestId:
          type: string
          description: >-
            UUID used to fetch the unsigned swap; also the Redis cache key
            suffix. Expires after 60 seconds.
        provider:
          type: string
          enum:
            - jupiter
            - titan
          description: Provider that won the quote
        inputMint:
          type: string
          description: Input token mint public key
        outputMint:
          type: string
          description: Output token mint public key
        inAmount:
          type: string
          description: >-
            Original client amount in raw base units, before buy-side fee
            deduction (as string to support bigint)
        outAmount:
          type: string
          description: Gross build output in raw base units (as string to support bigint)
        slippageBps:
          type: number
          description: Slippage tolerance in basis points
        feeMint:
          type: string
          description: >-
            Mint the fee is charged in: native SOL wins, otherwise a preferred
            stablecoin/LST mint if either leg is one, otherwise the input mint
        feeSide:
          type: string
          enum:
            - input
            - output
          description: >-
            Which leg pays the fee: 'input' is deducted from amount before the
            quote, 'output' is skimmed from the quoted proceeds
        feeLamports:
          type: string
          description: >-
            Bags treasury fee in raw base units of feeMint as string to support
            bigint (only lamports when feeMint is native SOL; every pair is
            charged, none are '0')
        expiresAtMs:
          type: number
          nullable: true
          description: >-
            Titan quote expiry timestamp in milliseconds, or null when the
            provider does not set one
      required:
        - requestId
        - provider
        - inputMint
        - outputMint
        - inAmount
        - outAmount
        - slippageBps
        - feeMint
        - feeSide
        - feeLamports
        - expiresAtMs
    ErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          example: false
        error:
          type: string
          description: Error message
      required:
        - success
        - error
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: API key authentication. Provide your API key as the header value.

````