Quickstart
Garden’s API allows you to integrate our trustless Bitcoin bridge with flexible levels of control. This guide walks through the fastest way to set up a working integration, For advanced use cases and customization options, refer to our Cookbook. If you are new to atomic swaps, read our intent flow to get started.
High level flow
-
Fetch a quote for an asset pair and amount.
-
Authenticate using an API key or wallet signature.
-
Create the order with selected quote.
-
Initiate the order by sending funds to the HTLC.
-
Track order status to confirm completion.
Fetch quote
To get started, fetch a quote using the /quote
endpoint. This returns one or more available strategies from Garden's solver network, along with corresponding rates. Choose a strategy and save its strategy_id
for order creation.
curl -X 'GET' \
'https://api.garden.finance/quote/?order_pair=<source_chain>:<source_asset>::<destination_chain>:<destination_asset>&amount=<amount>&exact_out=<true/false>&affiliate_fee=<affiliate_fee_in_bps>' \
-H 'accept: application/json'
Parameters:
order_pair
: Build the order pair in the above format using chain andatomicSwapAddress
of the required assets from the/info
endpoint.amount
: In smallest units based on theexact_out
flag.exact_out
: Indicates whether the quote should be fetched for an exact output amount. If set totrue
, the quote will calculate the required input amount to achieve the specified output. If set tofalse
, the quote will calculate the expected output for a given input amount.affiliate_fee
:The total affiliate fee in basis points (bps), more details here.
Authenticate
Authentication is required before you can interact with the Garden protocol.
Option 1: API key (recommended)
This is the simplest method. Contact the Garden team in the townhall to request an API key. Once you receive it, include it in the request headers using "api-key" as the key and your API key as the value for all authenticated requests.
Option 2: Wallet-based auth (SIWE)
You can also authenticate via Sign-In With Ethereum (SIWE). This flow returns a JWT for use in subsequent requests. Refer to Authentication for more details.