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

# Prepare a builder swap

> Requires swap scope. Use the same API key that created the quote. Ordinary EOA wallets are supported; delegated and contract wallets are currently rejected. Free includes 10 distinct successful swap preparations per rolling hour, counted atomically against the authenticated workspace when the preparation is saved. A prepared but unsubmitted swap counts; approval and receipt calls do not. A refreshed quote is a new preparation. Swap preparations are additionally limited to Free 6/minute, Developer 6/minute, Launch 12/minute and Pro 60/minute. Shared service capacity applies.

[Authentication](/api-reference/authentication) · [Builder integration](/builders)


## OpenAPI

````yaml openapi.json POST /api/v2/builders/swap
openapi: 3.1.0
info:
  title: route
  version: 2.15.0
  description: >-
    Route compares swap paths offchain and executes swaps on Robinhood Chain.
    The API returns quotes and unsigned transactions. It does not sign or submit
    for you. V2 deducts a disclosed pair-dependent output fee up to 0.50%; pool
    fees, provider charges and gas may still apply. Contracts are experimental
    and unaudited. Public routing and data endpoints require no API key. Use the
    documented /api/v2 endpoints for integrations. Builder endpoints require a
    scoped x-api-key from build.route.fun. Public quote, swap and data endpoints
    remain keyless.
servers:
  - url: https://api.route.fun
security: []
paths:
  /api/v2/builders/swap:
    post:
      tags:
        - Builder API
      summary: Prepare a builder swap
      description: >-
        Requires swap scope. Use the same API key that created the quote.
        Ordinary EOA wallets are supported; delegated and contract wallets are
        currently rejected. Free includes 10 distinct successful swap
        preparations per rolling hour, counted atomically against the
        authenticated workspace when the preparation is saved. A prepared but
        unsubmitted swap counts; approval and receipt calls do not. A refreshed
        quote is a new preparation. Swap preparations are additionally limited
        to Free 6/minute, Developer 6/minute, Launch 12/minute and Pro
        60/minute. Shared service capacity applies.
      operationId: builderSwap
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              required:
                - quoteId
              properties:
                quoteId:
                  type: string
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                allOf:
                  - type: object
                    required:
                      - quoteId
                      - builderCode
                      - amountOut
                      - minimumAmountOut
                      - fees
                      - expiresAt
                      - settlementAvailable
                    properties:
                      quoteId:
                        type: string
                      builderCode:
                        type: string
                        pattern: ^[A-Za-z0-9_-]{3,32}$
                        description: >-
                          Public, case-sensitive registered attribution code.
                          May differ from the API key workspace. Omitted: use
                          the key workspace code.
                      chainId:
                        type: integer
                        const: 4663
                      payer:
                        type: string
                        pattern: ^0x[0-9a-fA-F]{40}$
                      recipient:
                        type: string
                        pattern: ^0x[0-9a-fA-F]{40}$
                      tokenIn:
                        type: string
                        pattern: ^0x[0-9a-fA-F]{40}$
                      tokenOut:
                        type: string
                        pattern: ^0x[0-9a-fA-F]{40}$
                      amountIn:
                        type: string
                        pattern: ^[0-9]+$
                      grossAmountOut:
                        type: string
                        pattern: ^[0-9]+$
                      routeFee:
                        type: string
                        pattern: ^[0-9]+$
                      builderFee:
                        type: string
                        pattern: ^[0-9]+$
                      amountOut:
                        type: string
                        pattern: ^[0-9]+$
                      minimumAmountOut:
                        type: string
                        pattern: ^[0-9]+$
                      fees:
                        type: object
                        required:
                          - routeBps
                          - builderBps
                          - policyVersion
                        properties:
                          routeBps:
                            type: integer
                            minimum: 0
                            maximum: 50
                          builderBps:
                            type: integer
                            minimum: 0
                            maximum: 50
                          builderRecipient:
                            anyOf:
                              - type: string
                                pattern: ^0x[0-9a-fA-F]{40}$
                              - type: 'null'
                          policyVersion:
                            type: integer
                      policySource:
                        type: string
                        enum:
                          - onchain
                          - local-preview
                      registry:
                        type:
                          - string
                          - 'null'
                      expiresAt:
                        type: integer
                      settlementAvailable:
                        type: boolean
                      provider:
                        type: string
                      routes:
                        type: array
                        items:
                          type: object
                      warnings:
                        type: array
                        items:
                          type: string
                  - type: object
                    properties:
                      transaction:
                        type: object
                        properties:
                          to:
                            type: string
                            pattern: ^0x[0-9a-fA-F]{40}$
                          from:
                            type: string
                            pattern: ^0x[0-9a-fA-F]{40}$
                          data:
                            type: string
                          value:
                            type: string
                            pattern: ^[0-9]+$
                          chainId:
                            type: integer
                            const: 4663
                      approval:
                        type:
                          - object
                          - 'null'
                      gas:
                        type: string
                        pattern: ^[0-9]+$
                      simulation:
                        type: object
                      review:
                        type: string
        '400':
          description: Invalid request or fee above cap
        '401':
          description: Missing, invalid, expired or revoked key
        '402':
          description: >-
            PLAN_UPGRADE_REQUIRED: Free allows 10 distinct successful swap
            preparations per rolling hour across all workspace keys. Same-quote
            retries and receipt checks do not consume another slot. Active paid
            subscriptions allow Developer 100, Launch 500 and Pro 2,500
            preparations per rolling hour. Upgrade or renew in the developer
            portal.
        '403':
          description: Key scope, builder identity or access denied
        '409':
          description: Expired quote, changed policy, price or receipt conflict
        '429':
          description: Workspace or global capacity limit; obey Retry-After
        '503':
          description: Network unavailable or builder settlement not commissioned
      security:
        - BuilderKey: []
components:
  securitySchemes:
    BuilderKey:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        Server-side key created in an authenticated developer workspace. Builder
        codes are public attribution, not credentials.

````