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

# Quote and Build a Solana Swap in One Request

> Get a Raptor quote and the swap transaction in one call. Use POST /quote-and-swap when the user does not need to review the price before signing.



## OpenAPI

````yaml /raptor/http/openapi.json post /quote-and-swap
openapi: 3.0.3
info:
  title: Raptor Swap API
  description: >-
    Solana swap quotes, ready-to-sign swap transactions, transaction sending and
    status tracking. No API key is required.
  version: 1.0.0
  contact:
    name: Solana Tracker Discord
    url: https://discord.gg/JH2e9rR9fc
servers:
  - url: https://raptor.solanatracker.io
    description: Hosted Raptor
security: []
paths:
  /quote-and-swap:
    post:
      summary: Quote and swap in one request
      description: >-
        Get a quote and the transaction in one call. Use it when the user does
        not need to review the price before signing.
      operationId: quoteAndSwap
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/QuoteAndSwapRequest'
            example:
              userPublicKey: YOUR_WALLET_ADDRESS
              inputMint: So11111111111111111111111111111111111111112
              outputMint: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
              amount: 100000000
              slippageBps: '50'
              priorityFee: high
      responses:
        '200':
          description: Quote and unsigned transaction
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QuoteAndSwapResponse'
              example:
                quote:
                  inputMint: So11111111111111111111111111111111111111112
                  outputMint: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
                  amountIn: '100000000'
                  amountOut: '11703794'
                  minAmountOut: '11645275'
                  priceImpact: 0
                  slippageBps: 50
                  routePlan:
                    - programId: 9H6tua7jkLhdm3w8BvgpTn5LZNU7g4ZynDmCiNN3q6Rp
                      dex: Humidifi
                      pool: 8sKQHfjNhvmAw94PhfvfMcytmqW6jmxvwieYyzXCCPu
                      inputMint: So11111111111111111111111111111111111111112
                      outputMint: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
                      amountIn: '100000000'
                      amountOut: '11703794'
                      priceImpact: 0
                      percent: 100
                  swapUsdValue: '11.72'
                  contextSlot: 454215370
                  timeTaken: 0.026
                swapTransaction: >-
                  AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAQAHEf…
                lastValidBlockHeight: 432253100
                contextSlot: 454215370
                prioritizationFeeLamports: 20000
        '400':
          $ref: '#/components/responses/BadRequest'
        '422':
          $ref: '#/components/responses/InvalidBody'
        '500':
          $ref: '#/components/responses/BuildFailed'
components:
  schemas:
    QuoteAndSwapRequest:
      type: object
      required:
        - userPublicKey
        - inputMint
        - outputMint
        - amount
      properties:
        userPublicKey:
          type: string
          description: Wallet that signs and pays for the swap
        inputMint:
          type: string
          description: Mint of the token you sell
        outputMint:
          type: string
          description: Mint of the token you buy
        amount:
          type: integer
          description: Amount to sell, in the input token's smallest unit
        slippageBps:
          type: string
          default: '50'
          description: Slippage in basis points, or `dynamic`
        dexes:
          type: string
          description: Only route through these DEXes (comma-separated)
        pools:
          type: string
          description: Only route through these pools (comma-separated)
        maxHops:
          type: integer
          minimum: 1
          maximum: 4
          default: 4
        onlyDirectRoutes:
          type: boolean
          default: false
        jitRouting:
          type: string
          enum:
            - auto
            - 'true'
            - 'false'
          default: auto
        searchMode:
          type: string
          enum:
            - fast
            - deep
          default: fast
        wrapUnwrapSol:
          type: boolean
          default: true
        txVersion:
          type: string
          enum:
            - V0
            - LEGACY
            - V1
          default: V0
          description: 'Case-sensitive. `LEGACY` and `V1` need `jitRouting: false`.'
        asLegacyTransaction:
          type: boolean
          default: false
          description: 'Same as `txVersion: "LEGACY"`'
        priorityFee:
          type: string
          description: >-
            A level (`min`, `low`, `medium`, `auto`, `high`, `veryHigh`,
            `turbo`, `unsafeMax`) or a total fee in lamports as a string.
            Default `auto`.
        maxPriorityFee:
          type: integer
          description: Cap on the compute unit price, in micro-lamports
        computeUnitPriceMicroLamports:
          type: integer
        computeUnitLimit:
          type: integer
        tipAccount:
          type: string
        tipLamports:
          type: integer
        destinationTokenAccount:
          type: string
          description: >-
            Send the output to this token account instead of the wallet's
            associated token account
        feeAccount:
          type: string
        feeBps:
          type: integer
        feeFromInput:
          type: boolean
          default: false
        chargeBps:
          type: integer
    QuoteAndSwapResponse:
      type: object
      required:
        - quote
        - swapTransaction
        - lastValidBlockHeight
      properties:
        quote:
          $ref: '#/components/schemas/QuoteResponse'
        swapTransaction:
          type: string
          description: Unsigned transaction, base64
        lastValidBlockHeight:
          type: integer
        contextSlot:
          type: integer
        prioritizationFeeLamports:
          type: integer
          description: Priority fee included, in lamports
    QuoteResponse:
      type: object
      description: >-
        Quote returned by `GET /quote`. Send it back unchanged as
        `quoteResponse`.
      required:
        - inputMint
        - outputMint
        - amountIn
        - amountOut
        - minAmountOut
        - priceImpact
        - slippageBps
        - routePlan
        - contextSlot
        - timeTaken
      properties:
        inputMint:
          type: string
          description: Mint of the token sold
        outputMint:
          type: string
          description: Mint of the token bought
        amountIn:
          type: string
          description: Amount sold, in the input token's smallest unit
        amountOut:
          type: string
          description: Expected amount received, in the output token's smallest unit
        minAmountOut:
          type: string
          description: >-
            Least amount the swap will accept after slippage. The transaction
            fails rather than fill below this.
        feeAmount:
          type: string
          description: Pool fees for the route, when reported
        priceImpact:
          type: number
          description: Price impact in percent (`0.25` = 0.25%)
        slippageBps:
          type: integer
          description: Slippage used, in basis points
        routePlan:
          type: array
          description: Steps of the route, in order
          items:
            $ref: '#/components/schemas/RouteStep'
        swapUsdValue:
          type: string
          description: USD value of the input amount
        platformFee:
          $ref: '#/components/schemas/PlatformFee'
        tokenTransfers:
          $ref: '#/components/schemas/TokenTransfers'
        contextSlot:
          type: integer
          description: Slot the quote was computed at
        timeTaken:
          type: number
          description: Time to compute the quote, in seconds
        jitRouting:
          type: boolean
          description: '`true` when the quote uses a just-in-time route'
        quoteId:
          type: string
          description: Reference to the stored execution plan. Expires after a few seconds.
        searchMode:
          type: string
          enum:
            - fast
            - deep
          description: Search mode used
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: string
          description: What went wrong
        code:
          type: integer
          description: HTTP status code
    RouteStep:
      type: object
      required:
        - programId
        - dex
        - pool
        - inputMint
        - outputMint
        - amountIn
        - amountOut
        - priceImpact
      properties:
        programId:
          type: string
          description: DEX program ID
        dex:
          type: string
          description: DEX name
        pool:
          type: string
          description: Pool address
        inputMint:
          type: string
          description: Mint going into this step
        outputMint:
          type: string
          description: Mint coming out of this step
        amountIn:
          type: string
          description: Amount into this step
        amountOut:
          type: string
          description: Amount out of this step
        feeAmount:
          type: string
          description: Pool fee for this step, when reported
        priceImpact:
          type: number
          description: Price impact of this step, in percent
        percent:
          type: integer
          description: Share of the input sent through this step
    PlatformFee:
      type: object
      description: Your platform fee settings, as applied to the quote
      properties:
        feeAccount:
          type: string
          description: Wallet that receives the fee
        feeBps:
          type: integer
          description: Fee in basis points
        feeFromInput:
          type: boolean
          description: '`true` if the fee is taken from the input token'
        chargeBps:
          type: integer
          description: Fee on positive slippage, in basis points
    TokenTransfers:
      type: object
      description: >-
        Present only when the input or output token charges a Token-2022
        transfer fee. Amounts are strings in the token's smallest unit.
      properties:
        depositFee:
          type: string
          description: Transfer fee charged on the input token
        deliveryFee:
          type: string
          description: Transfer fee charged on the output token
        netOutput:
          type: string
          description: What reaches the wallet after platform and transfer fees
  responses:
    BadRequest:
      description: A parameter is missing or invalid
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error: 'Invalid amount: must be greater than 0'
            code: 400
        text/plain:
          schema:
            type: string
          example: 'Failed to deserialize query string: missing field `amount`'
    InvalidBody:
      description: >-
        No route was found (JSON), or the JSON body has a missing, unknown-value
        or wrongly typed field, or the quote was changed or expired (plain
        text).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error: 'Failed to get quote: No multi-hop route found'
            code: 422
        text/plain:
          schema:
            type: string
          examples:
            staleQuote:
              summary: Quote expired or modified
              value: >-
                Failed to deserialize the JSON body into the target type:
                quoteResponse: Quote expired, modified or unavailable on this
                API instance; request a fresh quote
            badTxVersion:
              summary: Wrong txVersion casing
              value: >-
                Failed to deserialize the JSON body into the target type:
                txVersion: unknown variant `v0`, expected one of `V1`, `V0`,
                `LEGACY`
    BuildFailed:
      description: >-
        The transaction could not be built. If the error mentions an expired
        plan, get a new quote and retry.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error: 'Failed to build swap: Execution plan expired'
            code: 500

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.