1Click API

What is 1Click Swap API?

1Click simplifies NEAR Intents by temporarily transferring assets to a trusted swapping agent that coordinates with Market Makers to execute your intent. This REST API abstracts away the complexity of intent creation, solver coordination, and transaction execution, letting you focus on your user experience.

It features:

  • Simple REST endpoints for intent creation and management

  • Automatic solver discovery and competitive pricing

  • Built-in transaction handling and status tracking

  • Support for cross-chain intents

How 1Click API Works

1Click API Flow
  1. Request a quote - Send the user's intent request to 1Click's Request Quote endpoint

    • Receive the best available quote with a unique deposit address

  2. Transfer tokens - If provided quote is satisfactory, deposit tokens to the unique address provided

    • 1Click automatically begins the swapping process upon receipt

  3. Submit deposit transaction - (optional)

  4. Monitor progress - (optional)

Result: The swap either succeeds with tokens delivered to your specified address, or fails with funds automatically refunded to your refund address. Failed swaps can be retried by repeating this flow.

Centralized exchanges (CEXes) often use intermediate or per-user deposit addresses. These may not credit deposits sent via NEAR Intents until they are recognized or whitelisted. We recommend sending a small test amount before attempting full-scale transfers.

Quickstart 1Click Tutorial

To quickly get started with 1Click API, see this example breaking down each of the above steps:

This repo will show you how to quickly get started performing cross-chain swaps using 1Click's TypeScript SDK.

API Specification (v0)

Auto-generate clients using our OpenAPI spec.

Authentication: Please obtain a JWT token to avoid 0.1% (10 basis points) fee while using 1Click Swap API.

SDKs

Pre-built SDKs for popular languages:

Swap Statuses

1Click Swap goes through these states in its lifecycle:

  • PENDING_DEPOSIT — Awaiting the deposit to the deposit address.

  • PROCESSING — Once the deposit on deposit address is detected, information is processed and executed by Market Makers.

  • SUCCESS — Funds are delivered to the specified destination chain/address.

  • INCOMPLETE_DEPOSIT — Deposit is received but below required bridge or quoted amount.

  • REFUNDED — If the swap is not completed, funds are automatically returned to the refund address.

  • FAILED - Swap failed due to the error.

NEAR Intents 1Click Swap Statuses

API Endpoints

Base URL: https://1click.chaindefuser.com/

Name
Route
Description

/v0/tokens

Retrieves list of tokens currently supported by 1Click

/v0/quote

Generates a swap quote based on input parameters (Intent)

/v0/deposit/submit

Optional route to speed up process with early deposit notification to 1Click

/v0/status

Gets current status of a swap using unique deposit address

Use dry: true to display the quote price without generating a transaction. Set dry: false only at confirmation to reduce system load.

Get supported tokens

get

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.

Responses
200Success
application/json
get
GET /v0/tokens HTTP/1.1
Host: 1click.chaindefuser.com
Accept: */*
200Success
[
  {
    "assetId": "nep141:wrap.near",
    "decimals": 24,
    "blockchain": "near",
    "symbol": "wNEAR",
    "price": "2.79",
    "priceUpdatedAt": "2025-03-28T12:23:00.070Z",
    "contractAddress": "wrap.near"
  }
]

Request a swap quote

post

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.

Authorizations
Body
drybooleanRequired

Flag indicating whether this is a dry run request. If true, the response will NOT contain the following fields:

  • depositAddress
  • timeWhenInactive
  • deadline
Example: true
depositModestring · enumOptional

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.
Default: SIMPLEExample: SIMPLEPossible values:
swapTypestring · enumRequired

How to interpret amount when performing the swap:

  • EXACT_INPUT - requests the output amount for an exact input.
  • EXACT_OUTPUT - requests the input amount for an exact output. The refundTo address always receives any excess tokens after the swap is complete.
  • FLEX_INPUT - a flexible input amount that allows for partial deposits and variable amounts.
Possible values:
slippageTolerancenumberRequired

Slippage tolerance for the swap. This value is in basis points (1/100th of a percent), e.g. 100 for 1% slippage.

Example: 100
originAssetstringRequired

ID of the origin asset.

Example: nep141:arb-0xaf88d065e77c8cc2239327c5edb3a432268e5831.omft.near
depositTypestring · enumRequired

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.
Possible values:
destinationAssetstringRequired

ID of the destination asset.

Example: nep141:sol-5ce3bf3a31af18be40ba30f721101b4341690186.omft.near
amountstringRequired

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
refundTostringRequired

Address used for refunds.

Example: 0x2527D02599Ba641c19FEa793cD0F167589a0f10D
refundTypestring · enumRequired

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.
Possible values:
recipientstringRequired

Recipient address. The format must match recipientType.

Example: 13QkxhNMrTPxoCkRdYdJ65tFuwXPhL5gLS2Z5Nr6gjRK
virtualChainRecipientstringOptional

EVM address of a transfer recipient in a virtual chain

Example: 0xb4c2fbec9d610F9A3a9b843c47b1A8095ceC887C
virtualChainRefundRecipientstringOptional

EVM address of a refund recipient in a virtual chain

Example: 0xb4c2fbec9d610F9A3a9b843c47b1A8095ceC887C
customRecipientMsgstringOptional

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
recipientTypestring · enumRequired

Type of recipient address:

  • DESTINATION_CHAIN - assets are transferred to the chain of destinationAsset.
  • INTENTS - assets are transferred to an account inside Intents
Possible values:
deadlinestring · date-timeRequired

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
referralstringOptional

Referral identifier (lowercase only). It will be reflected in the on-chain data and displayed on public analytics platforms.

Example: referral
quoteWaitingTimeMsnumberOptional

Time in milliseconds the user is willing to wait for a quote from the relay.

Default: 3000Example: 3000
Responses
200Success
application/json
post
POST /v0/quote HTTP/1.1
Host: 1click.chaindefuser.com
Authorization: Bearer JWT
Content-Type: application/json
Accept: */*
Content-Length: 803

{
  "dry": true,
  "depositMode": "SIMPLE",
  "swapType": "EXACT_INPUT",
  "slippageTolerance": 100,
  "originAsset": "nep141:arb-0xaf88d065e77c8cc2239327c5edb3a432268e5831.omft.near",
  "depositType": "ORIGIN_CHAIN",
  "destinationAsset": "nep141:sol-5ce3bf3a31af18be40ba30f721101b4341690186.omft.near",
  "amount": "1000",
  "refundTo": "0x2527D02599Ba641c19FEa793cD0F167589a0f10D",
  "refundType": "ORIGIN_CHAIN",
  "recipient": "13QkxhNMrTPxoCkRdYdJ65tFuwXPhL5gLS2Z5Nr6gjRK",
  "virtualChainRecipient": "0xb4c2fbec9d610F9A3a9b843c47b1A8095ceC887C",
  "virtualChainRefundRecipient": "0xb4c2fbec9d610F9A3a9b843c47b1A8095ceC887C",
  "customRecipientMsg": "smart-contract-recipient.near",
  "recipientType": "DESTINATION_CHAIN",
  "deadline": "2019-08-24T14:15:22Z",
  "referral": "referral",
  "quoteWaitingTimeMs": 3000,
  "appFees": [
    {
      "recipient": "recipient.near",
      "fee": 100
    }
  ]
}
{
  "timestamp": "2019-08-24T14:15:22Z",
  "signature": "text",
  "quoteRequest": {
    "dry": true,
    "depositMode": "SIMPLE",
    "swapType": "EXACT_INPUT",
    "slippageTolerance": 100,
    "originAsset": "nep141:arb-0xaf88d065e77c8cc2239327c5edb3a432268e5831.omft.near",
    "depositType": "ORIGIN_CHAIN",
    "destinationAsset": "nep141:sol-5ce3bf3a31af18be40ba30f721101b4341690186.omft.near",
    "amount": "1000",
    "refundTo": "0x2527D02599Ba641c19FEa793cD0F167589a0f10D",
    "refundType": "ORIGIN_CHAIN",
    "recipient": "13QkxhNMrTPxoCkRdYdJ65tFuwXPhL5gLS2Z5Nr6gjRK",
    "virtualChainRecipient": "0xb4c2fbec9d610F9A3a9b843c47b1A8095ceC887C",
    "virtualChainRefundRecipient": "0xb4c2fbec9d610F9A3a9b843c47b1A8095ceC887C",
    "customRecipientMsg": "smart-contract-recipient.near",
    "recipientType": "DESTINATION_CHAIN",
    "deadline": "2019-08-24T14:15:22Z",
    "referral": "referral",
    "quoteWaitingTimeMs": 3000,
    "appFees": [
      {
        "recipient": "recipient.near",
        "fee": 100
      }
    ]
  },
  "quote": {
    "depositAddress": "0x76b4c56085ED136a8744D52bE956396624a730E8",
    "depositMemo": "1111111",
    "amountIn": "1000000",
    "amountInFormatted": "1",
    "amountInUsd": "1",
    "minAmountIn": "995000",
    "amountOut": "9950000",
    "amountOutFormatted": "9.95",
    "amountOutUsd": "9.95",
    "minAmountOut": "9900000",
    "deadline": "2025-03-04T15:00:00Z",
    "timeWhenInactive": "2025-03-04T15:00:00Z",
    "timeEstimate": 120,
    "virtualChainRecipient": "0xb4c2fbec9d610F9A3a9b843c47b1A8095ceC887C",
    "virtualChainRefundRecipient": "0xb4c2fbec9d610F9A3a9b843c47b1A8095ceC887C",
    "customRecipientMsg": "smart-contract-recipient.near"
  }
}

Submit deposit transaction hash

post

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.

Authorizations
Body
txHashstringRequired

Transaction hash of your deposit

Example: 0x123abc456def789
depositAddressstringRequired

Deposit address for the quote

Example: 0x2527D02599Ba641c19FEa793cD0F167589a0f10D
Responses
200Success
application/json
post
POST /v0/deposit/submit HTTP/1.1
Host: 1click.chaindefuser.com
Authorization: Bearer JWT
Content-Type: application/json
Accept: */*
Content-Length: 92

{
  "txHash": "0x123abc456def789",
  "depositAddress": "0x2527D02599Ba641c19FEa793cD0F167589a0f10D"
}
{
  "quoteResponse": {
    "timestamp": "2019-08-24T14:15:22Z",
    "signature": "text",
    "quoteRequest": {
      "dry": true,
      "depositMode": "SIMPLE",
      "swapType": "EXACT_INPUT",
      "slippageTolerance": 100,
      "originAsset": "nep141:arb-0xaf88d065e77c8cc2239327c5edb3a432268e5831.omft.near",
      "depositType": "ORIGIN_CHAIN",
      "destinationAsset": "nep141:sol-5ce3bf3a31af18be40ba30f721101b4341690186.omft.near",
      "amount": "1000",
      "refundTo": "0x2527D02599Ba641c19FEa793cD0F167589a0f10D",
      "refundType": "ORIGIN_CHAIN",
      "recipient": "13QkxhNMrTPxoCkRdYdJ65tFuwXPhL5gLS2Z5Nr6gjRK",
      "virtualChainRecipient": "0xb4c2fbec9d610F9A3a9b843c47b1A8095ceC887C",
      "virtualChainRefundRecipient": "0xb4c2fbec9d610F9A3a9b843c47b1A8095ceC887C",
      "customRecipientMsg": "smart-contract-recipient.near",
      "recipientType": "DESTINATION_CHAIN",
      "deadline": "2019-08-24T14:15:22Z",
      "referral": "referral",
      "quoteWaitingTimeMs": 3000,
      "appFees": [
        {
          "recipient": "recipient.near",
          "fee": 100
        }
      ]
    },
    "quote": {
      "depositAddress": "0x76b4c56085ED136a8744D52bE956396624a730E8",
      "depositMemo": "1111111",
      "amountIn": "1000000",
      "amountInFormatted": "1",
      "amountInUsd": "1",
      "minAmountIn": "995000",
      "amountOut": "9950000",
      "amountOutFormatted": "9.95",
      "amountOutUsd": "9.95",
      "minAmountOut": "9900000",
      "deadline": "2025-03-04T15:00:00Z",
      "timeWhenInactive": "2025-03-04T15:00:00Z",
      "timeEstimate": 120,
      "virtualChainRecipient": "0xb4c2fbec9d610F9A3a9b843c47b1A8095ceC887C",
      "virtualChainRefundRecipient": "0xb4c2fbec9d610F9A3a9b843c47b1A8095ceC887C",
      "customRecipientMsg": "smart-contract-recipient.near"
    }
  },
  "status": "KNOWN_DEPOSIT_TX",
  "updatedAt": "2025-08-31T18:04:19.684Z",
  "swapDetails": {
    "intentHashes": [
      "text"
    ],
    "nearTxHashes": [
      "text"
    ],
    "amountIn": "1000",
    "amountInFormatted": "0.1",
    "amountInUsd": "0.1",
    "amountOut": "9950000",
    "amountOutFormatted": "9.95",
    "amountOutUsd": "9.95",
    "slippage": 50,
    "originChainTxHashes": [
      {
        "hash": "0x123abc456def789",
        "explorerUrl": "text"
      }
    ],
    "destinationChainTxHashes": [
      {
        "hash": "0x123abc456def789",
        "explorerUrl": "text"
      }
    ],
    "refundedAmount": "1000",
    "refundedAmountFormatted": "0.1",
    "refundedAmountUsd": "0.1"
  }
}

Check swap execution status

get

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.

Authorizations
Query parameters
depositAddressstringRequired
depositMemostringOptional
Responses
200Success
application/json
get
GET /v0/status HTTP/1.1
Host: 1click.chaindefuser.com
Authorization: Bearer JWT
Accept: */*
{
  "quoteResponse": {
    "timestamp": "2019-08-24T14:15:22Z",
    "signature": "text",
    "quoteRequest": {
      "dry": true,
      "depositMode": "SIMPLE",
      "swapType": "EXACT_INPUT",
      "slippageTolerance": 100,
      "originAsset": "nep141:arb-0xaf88d065e77c8cc2239327c5edb3a432268e5831.omft.near",
      "depositType": "ORIGIN_CHAIN",
      "destinationAsset": "nep141:sol-5ce3bf3a31af18be40ba30f721101b4341690186.omft.near",
      "amount": "1000",
      "refundTo": "0x2527D02599Ba641c19FEa793cD0F167589a0f10D",
      "refundType": "ORIGIN_CHAIN",
      "recipient": "13QkxhNMrTPxoCkRdYdJ65tFuwXPhL5gLS2Z5Nr6gjRK",
      "virtualChainRecipient": "0xb4c2fbec9d610F9A3a9b843c47b1A8095ceC887C",
      "virtualChainRefundRecipient": "0xb4c2fbec9d610F9A3a9b843c47b1A8095ceC887C",
      "customRecipientMsg": "smart-contract-recipient.near",
      "recipientType": "DESTINATION_CHAIN",
      "deadline": "2019-08-24T14:15:22Z",
      "referral": "referral",
      "quoteWaitingTimeMs": 3000,
      "appFees": [
        {
          "recipient": "recipient.near",
          "fee": 100
        }
      ]
    },
    "quote": {
      "depositAddress": "0x76b4c56085ED136a8744D52bE956396624a730E8",
      "depositMemo": "1111111",
      "amountIn": "1000000",
      "amountInFormatted": "1",
      "amountInUsd": "1",
      "minAmountIn": "995000",
      "amountOut": "9950000",
      "amountOutFormatted": "9.95",
      "amountOutUsd": "9.95",
      "minAmountOut": "9900000",
      "deadline": "2025-03-04T15:00:00Z",
      "timeWhenInactive": "2025-03-04T15:00:00Z",
      "timeEstimate": 120,
      "virtualChainRecipient": "0xb4c2fbec9d610F9A3a9b843c47b1A8095ceC887C",
      "virtualChainRefundRecipient": "0xb4c2fbec9d610F9A3a9b843c47b1A8095ceC887C",
      "customRecipientMsg": "smart-contract-recipient.near"
    }
  },
  "status": "KNOWN_DEPOSIT_TX",
  "updatedAt": "2025-08-31T18:04:19.684Z",
  "swapDetails": {
    "intentHashes": [
      "text"
    ],
    "nearTxHashes": [
      "text"
    ],
    "amountIn": "1000",
    "amountInFormatted": "0.1",
    "amountInUsd": "0.1",
    "amountOut": "9950000",
    "amountOutFormatted": "9.95",
    "amountOutUsd": "9.95",
    "slippage": 50,
    "originChainTxHashes": [
      {
        "hash": "0x123abc456def789",
        "explorerUrl": "text"
      }
    ],
    "destinationChainTxHashes": [
      {
        "hash": "0x123abc456def789",
        "explorerUrl": "text"
      }
    ],
    "refundedAmount": "1000",
    "refundedAmountFormatted": "0.1",
    "refundedAmountUsd": "0.1"
  }
}

Last updated