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

# Create a swap

> Create a swap request to exchange one cryptocurrency for another within the same chain or across chains.




## OpenAPI

````yaml https://production.hifi.com/api/v2/openapi.json post /v2/wallets/swaps
openapi: 3.0.0
info:
  title: Hifi API
  version: 2.0.0
  description: API documentation for Hifi
servers:
  - url: https://production.hifibridge.com
    description: Production server
  - url: https://sandbox.hifibridge.com
    description: Sandbox server
security:
  - bearerAuth: []
tags:
  - name: Common
    description: Common endpoints
  - name: User
    description: User endpoints
  - name: Kyc
    description: Kyc endpoints
  - name: Wallet
    description: Wallet endpoints
  - name: Account
    description: Account endpoints
  - name: External Account
    description: External Account endpoints for managing beneficiary bank accounts
  - name: Fiat Account
    description: Fiat Account endpoints
  - name: Virtual Account
    description: Virtual Account endpoints
  - name: Onramp
    description: Onramp endpoints
  - name: Offramp
    description: Offramp endpoints
  - name: Orchestration Address
    description: >-
      Orchestration Address endpoints — persistent on-chain wallets that
      automatically off-ramp incoming stablecoin deposits to a USD bank account
  - name: Crypto Transfer
    description: Crypto Transfer endpoints
  - name: Cross-Chain Bridge
    description: Cross-Chain Bridge endpoints
  - name: Token Swap
    description: Token Swap endpoints
  - name: Canton Offers
    description: Canton Offers endpoints
  - name: Transfer Rules
    description: Transfer approval rules and configuration
  - name: Transfer Approvals
    description: Transfer approval workflow and admin actions
  - name: File
    description: File endpoints
  - name: Reporting
    description: Reporting and metrics endpoints
paths:
  /v2/wallets/swaps:
    post:
      tags:
        - Token Swap
      summary: Create a swap
      description: >
        Create a swap request to exchange one cryptocurrency for another within
        the same chain or across chains.
      requestBody:
        $ref: '#/components/requestBodies/CreateWalletSwapBody'
      responses:
        '200':
          $ref: '#/components/responses/WalletSwapResponse'
        '401':
          $ref: '#/components/responses/UnauthorizedResponse'
        '404':
          $ref: '#/components/responses/NotFoundResponse'
        '500':
          $ref: '#/components/responses/InternalServerErrorResponse'
components:
  requestBodies:
    CreateWalletSwapBody:
      required: true
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/CreateWalletSwap'
  responses:
    WalletSwapResponse:
      description: Success
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/WalletSwapObject'
    UnauthorizedResponse:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Unauthorized'
    NotFoundResponse:
      description: Resource not found
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                enum:
                  - error
              error:
                type: object
                properties:
                  code:
                    type: string
                  message:
                    type: string
    InternalServerErrorResponse:
      description: Internal Server Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/InternalServerError'
  schemas:
    CreateWalletSwap:
      type: object
      required:
        - requestId
        - source
        - destination
      properties:
        requestId:
          type: string
          format: uuid
          description: Unique identifier for the swap request (recommend using uuid v4)
          example: 1ab3e6e0-4839-4dbe-89c3-b06d9645ae86
        source:
          type: object
          description: Source wallet information for the swap
          required:
            - userId
            - chain
            - currency
          properties:
            userId:
              type: string
              format: uuid
              description: User ID of the source wallet owner
              example: 05179f69-1988-4b46-a847-dd4eea0984d6
            chain:
              type: string
              enum:
                - POLYGON
                - ETHEREUM
                - SOLANA
                - TRON
              description: Blockchain network for the source wallet
              example: POLYGON
            currency:
              type: string
              enum:
                - usdc
                - usdt
              description: Source cryptocurrency to swap from
              example: usdt
            amount:
              type: string
              description: >-
                Amount to swap (either source.amount or destination.amount must
                be provided)
              example: '10000'
        destination:
          type: object
          description: Destination wallet information for the swap
          required:
            - chain
            - currency
          properties:
            userId:
              type: string
              format: uuid
              description: User ID of the destination wallet owner
              example: 05179f69-1988-4b46-a847-dd4eea0984d6
            externalWalletId:
              type: string
              format: uuid
              description: External wallet ID (Exclude with userId)
              example: 64fc4e9d-4839-4384-b4a0-0376af2c9b2e
            walletAddress:
              type: string
              pattern: ^0x[a-fA-F0-9]{40}$
              description: Wallet address (Exclude with userId)
              example: '0xE9cfBf1D690565579D823264170eE357f80e9A34'
            chain:
              type: string
              enum:
                - POLYGON
                - ETHEREUM
                - SOLANA
                - TRON
              description: Blockchain network for the destination wallet
              example: POLYGON
            currency:
              type: string
              enum:
                - usdc
                - usdt
                - usdg
              description: Destination cryptocurrency to swap to
              example: usdc
            amount:
              type: string
              description: >-
                Amount to receive (either source.amount or destination.amount
                must be provided)
              example: '10000'
    WalletSwapObject:
      type: object
      properties:
        transferType:
          type: string
          example: WALLET.SWAP
        transferDetails:
          $ref: '#/components/schemas/WalletSwapDetailsObject'
    Unauthorized:
      type: object
      properties:
        code:
          type: integer
          description: Error code
        error:
          type: string
          description: Error type
        errorDetails:
          type: string
          description: Detailed error message
    InternalServerError:
      type: object
      properties:
        code:
          type: integer
          description: Error code
        error:
          type: string
          description: Error type
        errorDetails:
          type: string
          description: Detailed error message
    WalletSwapDetailsObject:
      type: object
      properties:
        id:
          type: string
          format: uuid
          example: dc923cc1-d74b-58f6-9fe4-9e9c6eb8dc37
        requestId:
          type: string
          format: uuid
          example: 1ab3e6e0-4839-4dbe-89c3-b06d9645ae86
        status:
          type: string
          enum:
            - OPEN_QUOTE
            - CREATED
            - PENDING
            - COMPLETED
            - QUOTE_FAILED
            - FAILED
          example: COMPLETED
        createdAt:
          type: string
          format: date-time
          example: '2025-08-20T03:55:29.437108+00:00'
        updatedAt:
          type: string
          format: date-time
          example: '2025-08-20T04:08:10.837+00:00'
        source:
          $ref: '#/components/schemas/WalletSwapSourceObject'
        destination:
          $ref: '#/components/schemas/WalletSwapDestinationObject'
        error:
          type: string
          nullable: true
          example: null
        errorDetails:
          type: string
          nullable: true
          example: null
        quoteInformation:
          $ref: '#/components/schemas/WalletSwapQuoteInformationObject'
    WalletSwapSourceObject:
      type: object
      properties:
        currency:
          type: string
          enum:
            - usdc
            - usdt
            - usdg
            - pyusd
            - pyusd0
          example: usdc
        amount:
          type: number
          example: 10
        chain:
          type: string
          enum:
            - POLYGON
            - ETHEREUM
            - SOLANA
            - FLOW_EVM
        userId:
          type: string
          format: uuid
          example: 05179f69-1988-4b46-a847-dd4eea0984d6
    WalletSwapDestinationObject:
      type: object
      properties:
        currency:
          type: string
          enum:
            - usdc
            - usdt
            - usdg
            - pyusd
            - pyusd0
          example: usdt
        userId:
          type: string
          format: uuid
          example: 05179f69-1988-4b46-a847-dd4eea0984d6
        externalWalletId:
          type: string
          format: uuid
          nullable: true
          example: null
        amount:
          type: number
          nullable: true
          example: null
        chain:
          type: string
          enum:
            - POLYGON
            - ETHEREUM
            - SOLANA
            - FLOW_EVM
          example: POLYGON
        walletAddress:
          type: string
          pattern: ^0x[a-fA-F0-9]{40}$
          example: '0xe5727a4B1d93A26D6A7Adfaae145EFa41ED7f204'
    WalletSwapQuoteInformationObject:
      type: object
      properties:
        sendGross:
          $ref: '#/components/schemas/WalletSwapAmountObject'
        sendNet:
          $ref: '#/components/schemas/WalletSwapAmountObject'
        receiveGross:
          $ref: '#/components/schemas/WalletSwapAmountObject'
        receiveNet:
          $ref: '#/components/schemas/WalletSwapAmountObject'
        rate:
          type: string
          example: '1'
        expiresAt:
          type: string
          format: date-time
          example: '2025-08-20T03:55:59.539+00:00'
    WalletSwapAmountObject:
      type: object
      properties:
        amount:
          type: string
          example: '10'
        currency:
          type: string
          example: usdc
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````