openapi: 3.0.0
paths:
  /v0/tokens:
    get:
      description: >-
        Retrieves a list of tokens currently supported by the 1Click API for
        asset swaps.


        Each token entry includes its blockchain, contract address (if
        available), price in USD, and other metadata such as symbol and
        decimals.
      operationId: getTokens
      parameters: []
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/TokenResponse'
      summary: Get supported tokens
      tags:
        - OneClick
  /v0/quote:
    post:
      description: >-
        Generates a swap quote based on input parameters such as the assets,
        amount, slippage tolerance, and recipient/refund information.


        Returns pricing details, estimated time, and a unique **deposit
        address** to which tokens must be transferred to initiate the swap.


        You can set the `dry` parameter to `true` to simulate the quote request
        **without generating a deposit address** or initiating the swap process.
        This is useful for previewing swap parameters or validating input data
        without committing to an actual swap.


        This endpoint is the first required step in the swap process.
      operationId: getQuote
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/QuoteRequest'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QuoteResponse'
        '400':
          description: Bad Request - Invalid input data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestResponse'
        '401':
          description: Unauthorized - JWT token is invalid
      security:
        - JWT-auth: []
      summary: Request a swap quote
      tags:
        - OneClick
  /v0/status:
    get:
      description: >-
        Retrieves the current status of a swap using the unique deposit address
        from the quote, if quote response included deposit memo, it is required
        as well.


        The response includes the state of the swap (e.g., pending, processing,
        success, refunded) and any associated swap and transaction details.
      operationId: getExecutionStatus
      parameters:
        - name: depositAddress
          required: true
          in: query
          schema:
            type: string
        - name: depositMemo
          required: false
          in: query
          schema:
            type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetExecutionStatusResponse'
        '401':
          description: Unauthorized - JWT token is invalid
        '404':
          description: Deposit address not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestResponse'
      security:
        - JWT-auth: []
      summary: Check swap execution status
      tags:
        - OneClick
  /v0/any-input/withdrawals:
    get:
      description: >-
        Retrieves all withdrawals by ANY_INPUT quote with filtering, pagination
        and sorting
      operationId: getAnyInputQuoteWithdrawals
      parameters:
        - name: depositAddress
          required: true
          in: query
          schema:
            type: string
        - name: depositMemo
          required: false
          in: query
          schema:
            type: string
        - name: timestampFrom
          required: false
          in: query
          description: Filter withdrawals from this timestamp (ISO string)
          schema:
            type: string
        - name: page
          required: false
          in: query
          description: 'Page number for pagination (default: 1)'
          schema:
            type: number
        - name: limit
          required: false
          in: query
          description: 'Number of withdrawals per page (max: 50, default: 50)'
          schema:
            type: number
        - name: sortOrder
          required: false
          in: query
          description: Sort order
          schema:
            enum:
              - asc
              - desc
            type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetAnyInputQuoteWithdrawals'
        '401':
          description: Unauthorized - JWT token is invalid
        '404':
          description: Deposit address not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestResponse'
      security:
        - JWT-auth: []
      summary: Get ANY_INPUT withdrawals
      tags:
        - OneClick
  /v0/deposit/submit:
    post:
      description: >-
        Optionally notifies the 1Click service that a deposit has been sent to
        the specified address, using the blockchain transaction hash.


        This step can speed up swap processing by allowing the system to
        preemptively verify the deposit.
      operationId: submitDepositTx
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SubmitDepositTxRequest'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubmitDepositTxResponse'
        '400':
          description: Bad Request - Invalid input data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestResponse'
        '401':
          description: Unauthorized - JWT token is invalid
      security:
        - JWT-auth: []
      summary: Submit deposit transaction hash
      tags:
        - OneClick
info:
  title: 1Click Swap API
  description: API for One-Click Swaps
  version: 0.1.10
  contact: {}
tags: []
servers:
  - url: https://1click.chaindefuser.com
components:
  securitySchemes:
    JWT-auth:
      scheme: bearer
      bearerFormat: JWT
      type: http
      description: Enter JWT token (optional)
  schemas:
    TokenResponse:
      type: object
      properties:
        assetId:
          type: string
          description: Unique asset identifier
          example: nep141:wrap.near
        decimals:
          type: number
          description: Number of decimals for the token
          example: 24
        blockchain:
          type: string
          enum:
            - near
            - eth
            - base
            - arb
            - btc
            - sol
            - ton
            - dash
            - doge
            - xrp
            - zec
            - gnosis
            - bera
            - bsc
            - pol
            - tron
            - sui
            - op
            - avax
            - cardano
            - ltc
            - xlayer
            - monad
            - bch
            - adi
            - plasma
            - scroll
            - starknet
            - aleo
          description: Blockchain associated with the token
          example: near
        symbol:
          type: string
          description: Token symbol (e.g. BTC, ETH)
          example: wNEAR
        price:
          type: number
          description: Current price of the token in USD
          example: '2.79'
        priceUpdatedAt:
          format: date-time
          type: string
          description: Date when the token price was last updated
          example: '2025-03-28T12:23:00.070Z'
        contractAddress:
          type: string
          description: Contract address of the token
          example: wrap.near
      required:
        - assetId
        - decimals
        - blockchain
        - symbol
        - price
        - priceUpdatedAt
    AppFee:
      type: object
      properties:
        recipient:
          type: string
          description: Account ID within Intents to which this fee will be transferred
          example: recipient.near
        fee:
          type: number
          description: >-
            Fee for this recipient as part of amountIn in basis points (1/100th
            of a percent), e.g. 100 for 1% fee
          example: 100
      required:
        - recipient
        - fee
    QuoteRequest:
      type: object
      properties:
        dry:
          type: boolean
          description: |-
            Flag indicating whether this is a dry run request.
            If `true`, the response will **NOT** contain the following fields:
            - `depositAddress`
            - `timeWhenInactive`
            - `deadline`
          example: true
        depositMode:
          type: string
          description: >-
            What deposit address mode you will get in the response, most chain
            supports only `SIMPLE` and some(for example `stellar`) only `MEMO`:

            - `SIMPLE` - usual deposit with only deposit address.

            - `MEMO` - some chains will **REQUIRE** the `memo` together with
            `depositAddress` for swap to work.
          enum:
            - SIMPLE
            - MEMO
          default: SIMPLE
          example: SIMPLE
        swapType:
          type: string
          description: >-
            How to interpret `amount` (and refunds) when performing the swap:


            - `EXACT_INPUT` — requests the output amount for an exact input.
              - If deposit is less than `amountIn`, the deposit is refunded by deadline.
              - If deposit is above than `amountIn`, the swap is processed and the excess is refunded to `refundTo` address after swap is complete.

            - `EXACT_OUTPUT` — requests the input amount for an exact output.
              - The quote response would have two fields `minAmountIn` and `maxAmountIn`.
              - If the input is above than `maxAmountIn` the swap is processed and the excess is refunded to `refundTo` address after swap is complete.
              - If the input is less than  `minAmountIn`, the deposit is refunded by deadline.

            - `FLEX_INPUT` — a flexible input amount that allows for partial
            deposits and variable amounts.
              - `slippage` applies both to `amountOut` and `amountIn` and defines an acceptable range (`minAmountIn` and `minAmountOut`).
              - Any amount higher than `minAmountIn` is accepted and converted to the output asset as long as `minAmountOut` is met.
              - The `amountIn` can be less, as long as the 'slippage + 1%' constraint is met. If the total received by the deadline is below the lower bound, the deposit is refunded.
              - If deposits exceed the upper bound, the swap is still processed
          enum:
            - EXACT_INPUT
            - EXACT_OUTPUT
            - FLEX_INPUT
            - ANY_INPUT
        slippageTolerance:
          type: number
          description: >-
            Slippage tolerance for the swap. This value is in basis points
            (1/100th of a percent), e.g. 100 for 1% slippage.
          example: 100
        originAsset:
          type: string
          description: ID of the origin asset.
          example: nep141:arb-0xaf88d065e77c8cc2239327c5edb3a432268e5831.omft.near
        depositType:
          type: string
          description: >-
            Type of deposit address:

            - `ORIGIN_CHAIN` - deposit address on the origin chain.

            - `INTENTS` - the account ID within NEAR Intents to which you should
            transfer assets.
          enum:
            - ORIGIN_CHAIN
            - INTENTS
        destinationAsset:
          type: string
          description: ID of the destination asset.
          example: nep141:sol-5ce3bf3a31af18be40ba30f721101b4341690186.omft.near
        amount:
          type: string
          description: >-
            Amount to swap as the base amount. It is interpreted as the input or
            output amount based on the `swapType` flag and is specified in the
            smallest unit of the currency (e.g., wei for ETH).
          example: '1000'
        refundTo:
          type: string
          description: Address used for refunds.
          example: '0x2527D02599Ba641c19FEa793cD0F167589a0f10D'
        refundType:
          type: string
          description: >-
            Type of refund address:

            - `ORIGIN_CHAIN` - assets are refunded to the `refundTo` address on
            the origin chain.

            - `INTENTS` - assets are refunded to the `refundTo` Intents account.
          enum:
            - ORIGIN_CHAIN
            - INTENTS
        recipient:
          type: string
          description: Recipient address. The format must match `recipientType`.
          example: 13QkxhNMrTPxoCkRdYdJ65tFuwXPhL5gLS2Z5Nr6gjRK
        connectedWallets:
          description: Addresses of connected wallets.
          example:
            - 0x123...
            - 0x456...
          type: array
          items:
            type: string
        sessionId:
          type: string
          description: Unique client session identifier for 1Click.
          example: session_abc123
        virtualChainRecipient:
          type: string
          description: EVM address of a transfer recipient in a virtual chain
          example: '0xb4c2fbec9d610F9A3a9b843c47b1A8095ceC887C'
        virtualChainRefundRecipient:
          type: string
          description: EVM address of a refund recipient in a virtual chain
          example: '0xb4c2fbec9d610F9A3a9b843c47b1A8095ceC887C'
        customRecipientMsg:
          type: string
          description: >-
            **HIGHLY EXPERIMENTAL** Message to pass to `ft_transfer_call` when
            withdrawing assets to NEAR.


            Otherwise, `ft_transfer` will be used.


            **WARNING**: Funds will be lost if used with non NEP-141 tokens, in
            case of insufficient `storage_deposit` or if the recipient does not
            implement `ft_on_transfer` method.
          example: smart-contract-recipient.near
        recipientType:
          type: string
          description: >-
            Type of recipient address:

            - `DESTINATION_CHAIN` - assets are transferred to the chain of
            `destinationAsset`.

            - `INTENTS` - assets are transferred to an account inside Intents
          enum:
            - DESTINATION_CHAIN
            - INTENTS
        deadline:
          format: date-time
          type: string
          description: >-
            Timestamp in ISO format that identifies when the user refund begins
            if the swap isn't completed by then. It must exceed the time
            required for the deposit transaction to be mined. For example,
            Bitcoin may require around one hour depending on the fees paid.
          example: '2019-08-24T14:15:22Z'
        referral:
          type: string
          description: >-
            Referral identifier (lowercase only). It will be reflected in the
            on-chain data and displayed on public analytics platforms.
          example: referral
        quoteWaitingTimeMs:
          type: number
          description: >-
            Time in milliseconds the user is willing to wait for a quote from
            the relay.

            **If you want to receive the fastest quote - use `0` as a value** 
          example: 3000
          default: 3000
        appFees:
          description: List of recipients and their fees
          type: array
          items:
            $ref: '#/components/schemas/AppFee'
      required:
        - dry
        - swapType
        - slippageTolerance
        - originAsset
        - depositType
        - destinationAsset
        - amount
        - refundTo
        - refundType
        - recipient
        - recipientType
        - deadline
    Quote:
      type: object
      properties:
        depositAddress:
          type: string
          description: >-
            The deposit address on the chain of `originAsset` when `depositType`
            is `ORIGIN_CHAIN`.


            The deposit address inside NEAR Intents (the verifier smart
            contract) when `depositType` is `INTENTS`.
          example: '0x76b4c56085ED136a8744D52bE956396624a730E8'
        depositMemo:
          type: string
          description: >-
            Some of the deposit addresses **REQUIRE** to also include the `memo`
            for the deposit to be processed
          example: '1111111'
        amountIn:
          type: string
          description: Amount of the origin asset
          example: '1000000'
        amountInFormatted:
          type: string
          description: Amount of the origin asset in readable format
          example: '1'
        amountInUsd:
          type: string
          description: Amount of the origin assets equivalent in USD
          example: '1'
        minAmountIn:
          type: string
          description: Minimum amount of the origin asset that will be used for the swap
          example: '995000'
        amountOut:
          type: string
          description: Amount of the destination asset
          example: '9950000'
        amountOutFormatted:
          type: string
          description: Amount of the destination asset in readable format
          example: '9.95'
        amountOutUsd:
          type: string
          description: Amount of the destination asset equivalent in USD
          example: '9.95'
        minAmountOut:
          type: string
          description: Minimum output amount after slippage is applied
          example: '9900000'
        deadline:
          format: date-time
          type: string
          description: Time when the deposit address becomes inactive and funds may be lost
          example: '2025-03-04T15:00:00Z'
        timeWhenInactive:
          format: date-time
          type: string
          description: >-
            Time when the deposit address becomes cold, causing swap processing
            to take longer
          example: '2025-03-04T15:00:00Z'
        timeEstimate:
          type: number
          description: >-
            Estimated time in seconds for the swap to be executed after the
            deposit transaction is confirmed
          example: 120
        virtualChainRecipient:
          type: string
          description: EVM address of a transfer recipient in a virtual chain
          example: '0xb4c2fbec9d610F9A3a9b843c47b1A8095ceC887C'
        virtualChainRefundRecipient:
          type: string
          description: EVM address of a refund recipient in a virtual chain
          example: '0xb4c2fbec9d610F9A3a9b843c47b1A8095ceC887C'
        customRecipientMsg:
          type: string
          description: >-
            **HIGHLY EXPERIMENTAL** Message passed to `ft_transfer_call` when
            withdrawing assets to NEAR.


            Otherwise, `ft_transfer` will be used.


            **WARNING**: Funds will be lost if used with non NEP-141 tokens, in
            case of insufficient `storage_deposit` or if the recipient does not
            implement `ft_on_transfer` method.
          example: smart-contract-recipient.near
        refundFee:
          type: string
          description: >-
            Fee charged for refunding assets to the refund address in the
            smallest unit of the origin asset
          example: '10000'
      required:
        - amountIn
        - amountInFormatted
        - amountInUsd
        - minAmountIn
        - amountOut
        - amountOutFormatted
        - amountOutUsd
        - minAmountOut
        - timeEstimate
    QuoteResponse:
      type: object
      properties:
        correlationId:
          type: string
          description: Unique identifier for request tracing and debugging
          example: 550e8400-e29b-41d4-a716-446655440000
        timestamp:
          format: date-time
          type: string
          description: Timestamp in ISO format that was used to derive the deposit address
          example: '2019-08-24T14:15:22Z'
        signature:
          type: string
          description: >-
            Signature of the 1Click service confirming the quote for the
            specific deposit address. Must be saved on the client side (along
            with the whole quote) in order to resolve any disputes or mistakes.
        quoteRequest:
          description: User request
          allOf:
            - $ref: '#/components/schemas/QuoteRequest'
        quote:
          description: >-
            Response containing the deposit address for sending the `amount` of
            `originAsset` and the expected output amount.
          allOf:
            - $ref: '#/components/schemas/Quote'
      required:
        - correlationId
        - timestamp
        - signature
        - quoteRequest
        - quote
    BadRequestResponse:
      type: object
      properties:
        message:
          type: string
          example: error message
      required:
        - message
    TransactionDetails:
      type: object
      properties:
        hash:
          type: string
          description: Transaction hash
          example: '0x123abc456def789'
        explorerUrl:
          type: string
          description: Explorer URL for the transaction
      required:
        - hash
        - explorerUrl
    SwapDetails:
      type: object
      properties:
        intentHashes:
          description: All intent hashes that took part in this swap
          type: array
          items:
            type: string
        nearTxHashes:
          description: All NEAR transactions executed for this swap
          type: array
          items:
            type: string
        amountIn:
          type: string
          description: Exact amount of `originToken` after the trade was settled
          example: '1000'
        amountInFormatted:
          type: string
          description: >-
            Exact amount of `originToken` in readable format after the trade was
            settled
          example: '0.1'
        amountInUsd:
          type: string
          description: Exact amount of `originToken` equivalent in USD
          example: '0.1'
        amountOut:
          type: string
          description: Exact amount of `destinationToken` after the trade was settled
          example: '9950000'
        amountOutFormatted:
          type: string
          description: >-
            Exact amount of `destinationToken` in readable format after the
            trade was settled
          example: '9.95'
        amountOutUsd:
          type: string
          description: Exact amount of `destinationToken` equivalent in USD
          example: '9.95'
        slippage:
          type: number
          description: Actual slippage
          example: 50
        originChainTxHashes:
          description: Hashes and explorer URLs for all transactions on the origin chain
          type: array
          items:
            $ref: '#/components/schemas/TransactionDetails'
        destinationChainTxHashes:
          description: >-
            Hashes and explorer URLs for all transactions on the destination
            chain
          type: array
          items:
            $ref: '#/components/schemas/TransactionDetails'
        refundedAmount:
          type: string
          description: Amount of `originAsset` transferred to `refundTo`
          example: '1000'
        refundedAmountFormatted:
          type: string
          description: Refunded amount in readable format
          example: '0.1'
        refundedAmountUsd:
          type: string
          description: Refunded amount equivalent in USD
          example: '0.1'
        refundReason:
          type: string
          description: Reason for refund
          example: PARTIAL_DEPOSIT
        depositedAmount:
          type: string
          description: Amount deposited to `depositAddress` onchain
        depositedAmountFormatted:
          type: string
          description: Amount deposited in readable format
        depositedAmountUsd:
          type: string
          description: Amount deposited equivalent in USD
        referral:
          type: string
          description: Referral identifier
          example: referral
      required:
        - intentHashes
        - nearTxHashes
        - originChainTxHashes
        - destinationChainTxHashes
    GetExecutionStatusResponse:
      type: object
      properties:
        correlationId:
          type: string
          description: Unique identifier for request tracing and debugging
          example: 550e8400-e29b-41d4-a716-446655440000
        quoteResponse:
          description: Quote response from the original request
          allOf:
            - $ref: '#/components/schemas/QuoteResponse'
        status:
          type: string
          enum:
            - KNOWN_DEPOSIT_TX
            - PENDING_DEPOSIT
            - INCOMPLETE_DEPOSIT
            - PROCESSING
            - SUCCESS
            - REFUNDED
            - FAILED
        updatedAt:
          format: date-time
          type: string
          description: Last time the state was updated
        swapDetails:
          description: Details of actual swaps and withdrawals
          allOf:
            - $ref: '#/components/schemas/SwapDetails'
      required:
        - correlationId
        - quoteResponse
        - status
        - updatedAt
        - swapDetails
    AnyInputQuoteWithdrawal:
      type: object
      properties:
        status:
          type: string
          enum:
            - SUCCESS
            - FAILED
          description: Withdrawal status
        amountOutFormatted:
          type: string
          description: Amount out in readable format
          example: '9.95'
        amountOutUsd:
          type: string
          description: Amount out in USD
          example: '9.95'
        amountOut:
          type: string
          description: Amount out in smallest unit
          example: '9950000'
        withdrawFeeFormatted:
          type: string
          description: Withdrawal fee in readable format
          example: '0.01'
        withdrawFee:
          type: string
          description: Withdrawal fee in smallest unit
          example: '10000'
        withdrawFeeUsd:
          type: string
          description: Withdrawal fee in USD
          example: '0.01'
        timestamp:
          type: string
          description: Timestamp of withdrawal
          example: '2019-08-24T14:15:22Z'
        hash:
          type: string
          description: Transaction hash
          example: '0x123abc456def789'
      required:
        - status
        - amountOutFormatted
        - amountOutUsd
        - amountOut
        - withdrawFeeFormatted
        - withdrawFee
        - withdrawFeeUsd
        - timestamp
        - hash
    GetAnyInputQuoteWithdrawals:
      type: object
      properties:
        asset:
          type: string
          description: ID of the destination asset.
          example: nep141:sol-5ce3bf3a31af18be40ba30f721101b4341690186.omft.near
        recipient:
          type: string
          description: Recipient address
          example: '0x2527d02599ba641c19fea793cd0f167589a0f10d'
        affiliateRecipient:
          type: string
          description: Affiliate recipient address
          example: '0x2527d02599ba641c19fea793cd0f167589a0f10d'
        withdrawals:
          description: Details of withdrawals
          allOf:
            - $ref: '#/components/schemas/AnyInputQuoteWithdrawal'
      required:
        - asset
        - recipient
        - affiliateRecipient
    SubmitDepositTxRequest:
      type: object
      properties:
        txHash:
          type: string
          description: Transaction hash of your deposit
          example: '0x123abc456def789'
        depositAddress:
          type: string
          description: Deposit address for the quote
          example: '0x2527D02599Ba641c19FEa793cD0F167589a0f10D'
        nearSenderAccount:
          type: string
          description: Sender account (used only for NEAR blockchain)
          example: relay.tg
        memo:
          type: string
          description: Memo (use if deposit was submitted with one)
          example: '123456'
      required:
        - txHash
        - depositAddress
    SubmitDepositTxResponse:
      type: object
      properties:
        correlationId:
          type: string
          description: Unique identifier for request tracing and debugging
          example: 550e8400-e29b-41d4-a716-446655440000
        quoteResponse:
          description: Quote response from the original request
          allOf:
            - $ref: '#/components/schemas/QuoteResponse'
        status:
          type: string
          enum:
            - KNOWN_DEPOSIT_TX
            - PENDING_DEPOSIT
            - INCOMPLETE_DEPOSIT
            - PROCESSING
            - SUCCESS
            - REFUNDED
            - FAILED
        updatedAt:
          format: date-time
          type: string
          description: Last time the state was updated
        swapDetails:
          description: Details of actual swaps and withdrawals
          allOf:
            - $ref: '#/components/schemas/SwapDetails'
      required:
        - correlationId
        - quoteResponse
        - status
        - updatedAt
        - swapDetails
