Create order.
curl --request POST \
--url https://{environment}.garden.finance/v2/orders \
--header 'Content-Type: application/json' \
--header 'garden-app-id: <api-key>' \
--data '
{
"source": {
"owner": "<string>",
"amount": "<string>",
"delegate": "<string>"
},
"destination": {
"owner": "<string>",
"amount": "<string>"
},
"slippage": 50,
"nonce": "1736152215456",
"solver_id": "0x9dd9c2d208b07bf9a4ef9ca311f36d7185749635",
"affiliate_fees": [
{
"address": "<string>",
"fee": 10
}
]
}
'import requests
url = "https://{environment}.garden.finance/v2/orders"
payload = {
"source": {
"owner": "<string>",
"amount": "<string>",
"delegate": "<string>"
},
"destination": {
"owner": "<string>",
"amount": "<string>"
},
"slippage": 50,
"nonce": "1736152215456",
"solver_id": "0x9dd9c2d208b07bf9a4ef9ca311f36d7185749635",
"affiliate_fees": [
{
"address": "<string>",
"fee": 10
}
]
}
headers = {
"garden-app-id": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'garden-app-id': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
source: {owner: '<string>', amount: '<string>', delegate: '<string>'},
destination: {owner: '<string>', amount: '<string>'},
slippage: 50,
nonce: '1736152215456',
solver_id: '0x9dd9c2d208b07bf9a4ef9ca311f36d7185749635',
affiliate_fees: [{address: '<string>', fee: 10}]
})
};
fetch('https://{environment}.garden.finance/v2/orders', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{environment}.garden.finance/v2/orders",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'source' => [
'owner' => '<string>',
'amount' => '<string>',
'delegate' => '<string>'
],
'destination' => [
'owner' => '<string>',
'amount' => '<string>'
],
'slippage' => 50,
'nonce' => '1736152215456',
'solver_id' => '0x9dd9c2d208b07bf9a4ef9ca311f36d7185749635',
'affiliate_fees' => [
[
'address' => '<string>',
'fee' => 10
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"garden-app-id: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{environment}.garden.finance/v2/orders"
payload := strings.NewReader("{\n \"source\": {\n \"owner\": \"<string>\",\n \"amount\": \"<string>\",\n \"delegate\": \"<string>\"\n },\n \"destination\": {\n \"owner\": \"<string>\",\n \"amount\": \"<string>\"\n },\n \"slippage\": 50,\n \"nonce\": \"1736152215456\",\n \"solver_id\": \"0x9dd9c2d208b07bf9a4ef9ca311f36d7185749635\",\n \"affiliate_fees\": [\n {\n \"address\": \"<string>\",\n \"fee\": 10\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("garden-app-id", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{environment}.garden.finance/v2/orders")
.header("garden-app-id", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"source\": {\n \"owner\": \"<string>\",\n \"amount\": \"<string>\",\n \"delegate\": \"<string>\"\n },\n \"destination\": {\n \"owner\": \"<string>\",\n \"amount\": \"<string>\"\n },\n \"slippage\": 50,\n \"nonce\": \"1736152215456\",\n \"solver_id\": \"0x9dd9c2d208b07bf9a4ef9ca311f36d7185749635\",\n \"affiliate_fees\": [\n {\n \"address\": \"<string>\",\n \"fee\": 10\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{environment}.garden.finance/v2/orders")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["garden-app-id"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"source\": {\n \"owner\": \"<string>\",\n \"amount\": \"<string>\",\n \"delegate\": \"<string>\"\n },\n \"destination\": {\n \"owner\": \"<string>\",\n \"amount\": \"<string>\"\n },\n \"slippage\": 50,\n \"nonce\": \"1736152215456\",\n \"solver_id\": \"0x9dd9c2d208b07bf9a4ef9ca311f36d7185749635\",\n \"affiliate_fees\": [\n {\n \"address\": \"<string>\",\n \"fee\": 10\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"error": "<string>",
"result": {
"order_id": "<string>",
"to": "<string>",
"amount": 123
}
}Orders
Create Order
POST
/
orders
Create order.
curl --request POST \
--url https://{environment}.garden.finance/v2/orders \
--header 'Content-Type: application/json' \
--header 'garden-app-id: <api-key>' \
--data '
{
"source": {
"owner": "<string>",
"amount": "<string>",
"delegate": "<string>"
},
"destination": {
"owner": "<string>",
"amount": "<string>"
},
"slippage": 50,
"nonce": "1736152215456",
"solver_id": "0x9dd9c2d208b07bf9a4ef9ca311f36d7185749635",
"affiliate_fees": [
{
"address": "<string>",
"fee": 10
}
]
}
'import requests
url = "https://{environment}.garden.finance/v2/orders"
payload = {
"source": {
"owner": "<string>",
"amount": "<string>",
"delegate": "<string>"
},
"destination": {
"owner": "<string>",
"amount": "<string>"
},
"slippage": 50,
"nonce": "1736152215456",
"solver_id": "0x9dd9c2d208b07bf9a4ef9ca311f36d7185749635",
"affiliate_fees": [
{
"address": "<string>",
"fee": 10
}
]
}
headers = {
"garden-app-id": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'garden-app-id': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
source: {owner: '<string>', amount: '<string>', delegate: '<string>'},
destination: {owner: '<string>', amount: '<string>'},
slippage: 50,
nonce: '1736152215456',
solver_id: '0x9dd9c2d208b07bf9a4ef9ca311f36d7185749635',
affiliate_fees: [{address: '<string>', fee: 10}]
})
};
fetch('https://{environment}.garden.finance/v2/orders', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{environment}.garden.finance/v2/orders",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'source' => [
'owner' => '<string>',
'amount' => '<string>',
'delegate' => '<string>'
],
'destination' => [
'owner' => '<string>',
'amount' => '<string>'
],
'slippage' => 50,
'nonce' => '1736152215456',
'solver_id' => '0x9dd9c2d208b07bf9a4ef9ca311f36d7185749635',
'affiliate_fees' => [
[
'address' => '<string>',
'fee' => 10
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"garden-app-id: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{environment}.garden.finance/v2/orders"
payload := strings.NewReader("{\n \"source\": {\n \"owner\": \"<string>\",\n \"amount\": \"<string>\",\n \"delegate\": \"<string>\"\n },\n \"destination\": {\n \"owner\": \"<string>\",\n \"amount\": \"<string>\"\n },\n \"slippage\": 50,\n \"nonce\": \"1736152215456\",\n \"solver_id\": \"0x9dd9c2d208b07bf9a4ef9ca311f36d7185749635\",\n \"affiliate_fees\": [\n {\n \"address\": \"<string>\",\n \"fee\": 10\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("garden-app-id", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{environment}.garden.finance/v2/orders")
.header("garden-app-id", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"source\": {\n \"owner\": \"<string>\",\n \"amount\": \"<string>\",\n \"delegate\": \"<string>\"\n },\n \"destination\": {\n \"owner\": \"<string>\",\n \"amount\": \"<string>\"\n },\n \"slippage\": 50,\n \"nonce\": \"1736152215456\",\n \"solver_id\": \"0x9dd9c2d208b07bf9a4ef9ca311f36d7185749635\",\n \"affiliate_fees\": [\n {\n \"address\": \"<string>\",\n \"fee\": 10\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{environment}.garden.finance/v2/orders")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["garden-app-id"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"source\": {\n \"owner\": \"<string>\",\n \"amount\": \"<string>\",\n \"delegate\": \"<string>\"\n },\n \"destination\": {\n \"owner\": \"<string>\",\n \"amount\": \"<string>\"\n },\n \"slippage\": 50,\n \"nonce\": \"1736152215456\",\n \"solver_id\": \"0x9dd9c2d208b07bf9a4ef9ca311f36d7185749635\",\n \"affiliate_fees\": [\n {\n \"address\": \"<string>\",\n \"fee\": 10\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"error": "<string>",
"result": {
"order_id": "<string>",
"to": "<string>",
"amount": 123
}
}Create a new swap order to exchange assets across blockchain networks. This starts the atomic swap process and returns a pre-built transaction to initiate a swap on-chain.
Authorizations
Body
application/json
Show child attributes
Show child attributes
Show child attributes
Show child attributes
(Optional) In BIPS (base index points), 100 bips = 1%. When not specified, the slippage configured in app settings is used, or zero if no default is configured.
Example:
50
(Optional) Custom nonce for the order. If not provided, one will be generated.
Example:
"1736152215456"
(Optional) Specific solver ID to use for this order.
Example:
"0x9dd9c2d208b07bf9a4ef9ca311f36d7185749635"
(Optional) Add an affiliate fee to each swap, defined in bips (100 bips = 1%).
Show child attributes
Show child attributes
Was this page helpful?
⌘I