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

# Post api swap

> POST building an unsigned swap transaction



## OpenAPI

````yaml /openapi-tron.json post /api/{blockchain}/swap
openapi: 3.1.0
info:
  title: ggp-tron-swap
  description: ''
  license:
    name: ''
  version: 0.1.0
servers:
  - url: https://swap.ggp.gg
security: []
tags:
  - name: swap
    description: Swap API endpoints
  - name: approve
    description: TRC-20 approve endpoints
  - name: tokens
    description: Tokens API endpoints
  - name: healthcheck
    description: Health Check API endpoints
paths:
  /api/{blockchain}/swap:
    post:
      tags:
        - tron
      description: POST building an unsigned swap transaction
      operationId: create_swap
      parameters:
        - name: blockchain
          in: path
          required: true
          schema:
            type: string
            description: Blockchain served by this service.
            enum:
              - tron
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SwapBody'
        required: true
      responses:
        '200':
          description: Swap call and unsigned transaction
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TronSwapResponse'
        '400':
          description: Bad request
components:
  schemas:
    SwapBody:
      type: object
      required:
        - path
        - dstAddress
      properties:
        dstAddress:
          type: string
          description: Wallet that signs the transaction and receives the output.
        fromAddress:
          type:
            - string
            - 'null'
          description: >-
            Source wallet. On Tron the signer receives the output, so when set
            it

            must be the same address as `dstAddress`.
        path:
          $ref: '#/components/schemas/InputPath'
          description: >-
            Quote path: `data` of the quote response can be passed as is. Only

            `addressTokenIn`, `addressTokenOut` and `amountIn` are used; the
            route is

            quoted again on the current pool state.
        slippageBps:
          type:
            - integer
            - 'null'
          format: int32
          description: >-
            Slippage in bps for `minReturnAmountOut` (not below the service
            minimum,

            50 bps).
          minimum: 0
    TronSwapResponse:
      type: object
      required:
        - data
        - to
        - value
        - minReturnAmountOut
        - amountOut
        - feeLimit
        - unsignedTx
      properties:
        amountOut:
          type: string
          description: Expected output of the route the transaction was built for.
        data:
          type: string
          description: Calldata of the call (selector + ABI arguments), 0x-prefixed hex
        feeLimit:
          type: integer
          format: int64
          description: Fee limit of the transaction, in SUN
          minimum: 0
        minReturnAmountOut:
          type: string
          description: Minimum amount to receive in destination token's smallest units.
        to:
          type: string
          description: Contract called by the transaction (transaction `to`)
        tokenApprovalAddress:
          type:
            - string
            - 'null'
          description: |-
            Address that the user must approve for TRC-20 spending.
            Null when the input token is native TRX or for TRX <-> WTRX.
        unsignedTx:
          description: >-
            Unsigned transaction from the node (`/wallet/triggersmartcontract`

            response, same as `unsigned_tx` of `POST /api/swap`): sign and
            broadcast

            its `transaction`.
        value:
          type: string
          description: TRX attached to the call (`callValue`), in SUN
    InputPath:
      type: object
      required:
        - addressTokenIn
        - addressTokenOut
        - amountIn
      properties:
        addressTokenIn:
          type: string
          description: Source token address (base58 `T...` or hex)
        addressTokenOut:
          type: string
          description: Destination token address (base58 `T...` or hex)
        amountIn:
          type: string
          description: >-
            Amount of source token to swap (in token's smallest unit, e.g. SUN
            for TRX)

````

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