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

# Swap

This endpoint returns swap instructions (calldata + constraints) for you to execute.

For execution options, see [Swap](/business/endpoint/swap).


## OpenAPI

````yaml post /v1/swap
openapi: 3.1.0
info:
  title: Fiet Trading API (Core)
  version: 0.1.0
  description: >
    Hosted control-plane API for the Fiet Interface.


    ## Non-custodial posture

    - This service **does not** sign transactions.

    - This service **does not** broadcast transactions.

    - This service has **no access** to customer funds or keys.


    ## Quote semantics

    `GET /v1/quote` returns **derived** values from live chain state and indexed
    markets.

    It does not create or persist a “quote entity”.
servers:
  - url: https://api.fiet.finance
    description: Production (example)
security:
  - basicAuth: []
tags:
  - name: Health
  - name: Markets
  - name: Quote
  - name: Swap
  - name: Payments
paths:
  /v1/swap:
    post:
      tags:
        - Swap
      summary: Produce swap instruction (calldata) for client execution
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SwapPlanRequest'
            examples:
              sample:
                value:
                  chainId: 1
                  tokenIn: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'
                  tokenOut: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'
                  tradeType: EXACT_IN
                  amount: '1000000'
                  slippageBps: 50
      responses:
        '200':
          description: Swap plan
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SwapPlan'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Problem'
components:
  schemas:
    SwapPlanRequest:
      type: object
      required:
        - chainId
        - tokenIn
        - tokenOut
        - tradeType
        - amount
        - slippageBps
      properties:
        chainId:
          $ref: '#/components/schemas/ChainId'
        tokenIn:
          $ref: '#/components/schemas/EvmAddress'
        tokenOut:
          $ref: '#/components/schemas/EvmAddress'
        tradeType:
          type: string
          enum:
            - EXACT_IN
            - EXACT_OUT
        amount:
          type: string
          description: >-
            Amount (smallest units as string). Interpretation depends on
            tradeType.
          examples:
            - '1000000'
        slippageBps:
          type: integer
          minimum: 0
          maximum: 5000
          default: 50
        recipient:
          allOf:
            - $ref: '#/components/schemas/EvmAddress'
          description: Recipient address for swap outputs (when applicable)
        deadline:
          type: string
          format: date-time
    SwapPlan:
      type: object
      required:
        - quote
      properties:
        quote:
          $ref: '#/components/schemas/Quote'
        instructions:
          type: array
          description: >
            Ordered list of on-chain instructions required to complete the plan.


            Notes:

            - For same-chain swaps, this will usually contain exactly 1
            instruction.

            - Future upgrades (e.g. approvals, multi-call routers, cross-chain)
            can return 2+ items.
          items:
            $ref: '#/components/schemas/Instruction'
    Problem:
      type: object
      required:
        - type
        - title
        - status
      properties:
        type:
          type: string
        title:
          type: string
        status:
          type: integer
        detail:
          type: string
    ChainId:
      type: integer
      format: uint64
      examples:
        - 1
    EvmAddress:
      type: string
      pattern: ^0x[a-fA-F0-9]{40}$
      examples:
        - '0x742d35Cc6634C0532925a3b844Bc9e7595f5fE4b'
    Quote:
      type: object
      required:
        - asOf
        - expiresAt
        - chainId
        - tokenIn
        - tokenOut
        - tradeType
        - amountIn
        - amountOut
      properties:
        asOf:
          $ref: '#/components/schemas/AsOf'
        expiresAt:
          type: string
          format: date-time
        chainId:
          $ref: '#/components/schemas/ChainId'
        tokenIn:
          $ref: '#/components/schemas/EvmAddress'
        tokenOut:
          $ref: '#/components/schemas/EvmAddress'
        tradeType:
          type: string
          enum:
            - EXACT_IN
            - EXACT_OUT
        amountIn:
          type: string
          description: Exact input amount (smallest units as a string)
          examples:
            - '1000000'
        amountOut:
          type: string
          description: Exact output amount (smallest units as a string)
          examples:
            - '999000'
        fees:
          type: object
          description: Fee breakdown (protocol, gas estimate, etc.)
          additionalProperties: true
        route:
          type: object
          description: Router/path details (implementation-defined)
          additionalProperties: true
    Instruction:
      type: object
      required:
        - kind
        - chainId
        - to
        - data
        - value
        - constraints
      properties:
        kind:
          type: string
          enum:
            - EVM_CALL
        chainId:
          $ref: '#/components/schemas/ChainId'
        to:
          $ref: '#/components/schemas/EvmAddress'
        data:
          type: string
          description: Calldata hex
          examples:
            - 0x
        value:
          type: string
          description: Wei as a string
          examples:
            - '0'
        constraints:
          type: object
          properties:
            notAfter:
              type: string
              format: date-time
            maxSlippageBps:
              type: integer
              minimum: 0
              maximum: 5000
              examples:
                - 50
    AsOf:
      type: object
      required:
        - timestamp
      properties:
        blockNumber:
          type: integer
          format: uint64
          description: Block number used for derivation (when available)
          examples:
            - 19500000
        timestamp:
          type: string
          format: date-time
          description: Timestamp for the derived response
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
      description: Basic Auth (assumed at gateway for MVP)

````