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.

API Specification (v0)

Auto-generate clients using our OpenAPI spec.

Authentication: While testing can be done without authentication, we recommend obtaining a JWT token for higher rate limits, reliable service, and to help us maintain service quality.

SDKs

Pre-built SDKs for popular languages:

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

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

Whether to use the amount as the output or the input for the basis of the swap:

  • EXACT_INPUT - request output amount for exact input.
  • EXACT_OUTPUT - request output amount for exact output. The refundTo address will always receive excess tokens back even after the swap is complete.
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 the deposit address:

  • ORIGIN_CHAIN - deposit address on the origin chain
  • INTENTS - account ID inside near intents to which you should transfer assets inside intents.
Possible values:
destinationAssetstringRequired

ID of the destination asset.

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

Amount to swap as the base amount (can be switched to exact input/output using the dedicated flag), denoted in the smallest unit of the specified currency (e.g., wei for ETH).

Example: 1000
refundTostringRequired

Address for user refund.

Example: 0x2527D02599Ba641c19FEa793cD0F167589a0f10D
refundTypestring · enumRequired

Type of refund address:

  • ORIGIN_CHAIN - assets will be refunded to refundTo address on the origin chain
  • INTENTS - assets will be refunded to refundTo intents account
Possible values:
recipientstringRequired

Recipient address. The format should match recipientType.

Example: 13QkxhNMrTPxoCkRdYdJ65tFuwXPhL5gLS2Z5Nr6gjRK
recipientTypestring · enumRequired

Type of recipient address:

  • DESTINATION_CHAIN - assets will be transferred to chain of destinationAsset
  • INTENTS - assets will be transferred to account inside intents
Possible values:
deadlinestring · date-timeRequired

Timestamp in ISO format, that identifies when user refund will begin if the swap isn't completed by then. It needs to exceed the time required for the deposit tx to be minted, e.g. for Bitcoin it might require ~1h depending on the gas fees paid.

Example: 2019-08-24T14:15:22Z
referralstringOptional

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

Example: referral
quoteWaitingTimeMsnumberOptional

Time in milliseconds user is willing to wait for quote from 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: 583

{
  "dry": true,
  "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",
  "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,
    "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",
    "recipientType": "DESTINATION_CHAIN",
    "deadline": "2019-08-24T14:15:22Z",
    "referral": "referral",
    "quoteWaitingTimeMs": 3000,
    "appFees": [
      {
        "recipient": "recipient.near",
        "fee": 100
      }
    ]
  },
  "quote": {
    "depositAddress": "0x76b4c56085ED136a8744D52bE956396624a730E8",
    "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
  }
}

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,
      "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",
      "recipientType": "DESTINATION_CHAIN",
      "deadline": "2019-08-24T14:15:22Z",
      "referral": "referral",
      "quoteWaitingTimeMs": 3000,
      "appFees": [
        {
          "recipient": "recipient.near",
          "fee": 100
        }
      ]
    },
    "quote": {
      "depositAddress": "0x76b4c56085ED136a8744D52bE956396624a730E8",
      "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
    }
  },
  "status": "KNOWN_DEPOSIT_TX",
  "updatedAt": "2025-06-25T04:33:16.791Z",
  "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.

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
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,
      "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",
      "recipientType": "DESTINATION_CHAIN",
      "deadline": "2019-08-24T14:15:22Z",
      "referral": "referral",
      "quoteWaitingTimeMs": 3000,
      "appFees": [
        {
          "recipient": "recipient.near",
          "fee": 100
        }
      ]
    },
    "quote": {
      "depositAddress": "0x76b4c56085ED136a8744D52bE956396624a730E8",
      "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
    }
  },
  "status": "KNOWN_DEPOSIT_TX",
  "updatedAt": "2025-06-25T04:33:16.791Z",
  "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