curl --request GET \
--url https://api.ternswap.xyz/v1/quotes/{id} \
--header 'x-api-key: <api-key>'import requests
url = "https://api.ternswap.xyz/v1/quotes/{id}"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.ternswap.xyz/v1/quotes/{id}', 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://api.ternswap.xyz/v1/quotes/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: <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"
"net/http"
"io"
)
func main() {
url := "https://api.ternswap.xyz/v1/quotes/{id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.ternswap.xyz/v1/quotes/{id}")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ternswap.xyz/v1/quotes/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"id": "q_01JB8Z5W3F6V9Q2X4K7M1N0P8R",
"status": "completed",
"route": "escrow",
"from": {
"chain": "base",
"asset": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
"amount": "100000000",
"txHash": "0x9a1e5c4f0b2d7e8a3c6f9b1d4e7a0c3f6b9d2e5a8c1f4b7d0e3a6c9f2b5d40c2",
"confirmedAt": 1793084112
},
"to": {
"chain": "starknet",
"asset": "0x053c91253bc9682c04929ca02ed00b3e423f6710d2ee7e0d5ebb06f3ecf368a8",
"amount": "99880000",
"minAmount": "99880000",
"txHash": "0x5d2b7e4a1c8f3d6b9e2a5c8f1d4b7e0a3c6f9d2b5e8a1c4f7d0b3e6a9c27b19",
"lockedAt": 1793084139,
"escrows": [
{
"id": "0x1f9c4b7e0a3d6f9c2b5e8a1d4f7c0b3e6a9d2f5c8b1e4a7d0f3c6b9e2a5da210",
"txHash": "0x7b1d4e7a0c3f6b9d2e5a8c1f4b7d0e3a6c9f2b5d8e1a4c7f0b3d6e9a2c59e4d",
"amount": "99880000"
}
]
},
"fees": {
"totalUsd": "0.13",
"items": [
{
"kind": "network",
"usd": "0.06"
},
{
"kind": "solver",
"usd": "0.07"
}
]
},
"etaSecs": 40,
"execute": {
"depositAddress": "0x3c1f0e0a9b7d6c5e4f3a2b1c0d9e8f7a6b5c4d3e"
},
"createdAt": 1793084030,
"expiresAt": 1793085830
}{
"type": "https://docs.ternswap.xyz/api-reference/errors#no_route",
"title": "No route",
"status": 422,
"code": "invalid_request",
"detail": "no solver quoted this route",
"requestId": "01JC2W6Q0Z8V5K3M7N1P4R9T2X",
"errors": [
{
"pointer": "#/fromAmount",
"detail": "must be a positive base-10 integer"
}
]
}{
"type": "https://docs.ternswap.xyz/api-reference/errors#no_route",
"title": "No route",
"status": 422,
"code": "invalid_request",
"detail": "no solver quoted this route",
"requestId": "01JC2W6Q0Z8V5K3M7N1P4R9T2X",
"errors": [
{
"pointer": "#/fromAmount",
"detail": "must be a positive base-10 integer"
}
]
}{
"type": "https://docs.ternswap.xyz/api-reference/errors#no_route",
"title": "No route",
"status": 422,
"code": "invalid_request",
"detail": "no solver quoted this route",
"requestId": "01JC2W6Q0Z8V5K3M7N1P4R9T2X",
"errors": [
{
"pointer": "#/fromAmount",
"detail": "must be a positive base-10 integer"
}
]
}{
"type": "https://docs.ternswap.xyz/api-reference/errors#no_route",
"title": "No route",
"status": 422,
"code": "invalid_request",
"detail": "no solver quoted this route",
"requestId": "01JC2W6Q0Z8V5K3M7N1P4R9T2X",
"errors": [
{
"pointer": "#/fromAmount",
"detail": "must be a positive base-10 integer"
}
]
}{
"type": "https://docs.ternswap.xyz/api-reference/errors#no_route",
"title": "No route",
"status": 422,
"code": "invalid_request",
"detail": "no solver quoted this route",
"requestId": "01JC2W6Q0Z8V5K3M7N1P4R9T2X",
"errors": [
{
"pointer": "#/fromAmount",
"detail": "must be a positive base-10 integer"
}
]
}Get a quote
A firm quote and where it stands. status is awaiting_deposit until the deposit is final, deposit_confirmed
while the solver fills, in_progress once the destination funds are locked (reveal the fulfillment then), and
finally completed, refunded, or expired. A swap is awaiting_deposit until its transaction is final, then
completed. Amounts are the on-chain ones once known.
From in_progress on, to.escrows names the solver’s destination escrows: read each one on chain before
revealing. After a reload, withTransactions=true returns an unfunded escrow quote’s steps again.
curl --request GET \
--url https://api.ternswap.xyz/v1/quotes/{id} \
--header 'x-api-key: <api-key>'import requests
url = "https://api.ternswap.xyz/v1/quotes/{id}"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.ternswap.xyz/v1/quotes/{id}', 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://api.ternswap.xyz/v1/quotes/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: <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"
"net/http"
"io"
)
func main() {
url := "https://api.ternswap.xyz/v1/quotes/{id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.ternswap.xyz/v1/quotes/{id}")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ternswap.xyz/v1/quotes/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"id": "q_01JB8Z5W3F6V9Q2X4K7M1N0P8R",
"status": "completed",
"route": "escrow",
"from": {
"chain": "base",
"asset": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
"amount": "100000000",
"txHash": "0x9a1e5c4f0b2d7e8a3c6f9b1d4e7a0c3f6b9d2e5a8c1f4b7d0e3a6c9f2b5d40c2",
"confirmedAt": 1793084112
},
"to": {
"chain": "starknet",
"asset": "0x053c91253bc9682c04929ca02ed00b3e423f6710d2ee7e0d5ebb06f3ecf368a8",
"amount": "99880000",
"minAmount": "99880000",
"txHash": "0x5d2b7e4a1c8f3d6b9e2a5c8f1d4b7e0a3c6f9d2b5e8a1c4f7d0b3e6a9c27b19",
"lockedAt": 1793084139,
"escrows": [
{
"id": "0x1f9c4b7e0a3d6f9c2b5e8a1d4f7c0b3e6a9d2f5c8b1e4a7d0f3c6b9e2a5da210",
"txHash": "0x7b1d4e7a0c3f6b9d2e5a8c1f4b7d0e3a6c9f2b5d8e1a4c7f0b3d6e9a2c59e4d",
"amount": "99880000"
}
]
},
"fees": {
"totalUsd": "0.13",
"items": [
{
"kind": "network",
"usd": "0.06"
},
{
"kind": "solver",
"usd": "0.07"
}
]
},
"etaSecs": 40,
"execute": {
"depositAddress": "0x3c1f0e0a9b7d6c5e4f3a2b1c0d9e8f7a6b5c4d3e"
},
"createdAt": 1793084030,
"expiresAt": 1793085830
}{
"type": "https://docs.ternswap.xyz/api-reference/errors#no_route",
"title": "No route",
"status": 422,
"code": "invalid_request",
"detail": "no solver quoted this route",
"requestId": "01JC2W6Q0Z8V5K3M7N1P4R9T2X",
"errors": [
{
"pointer": "#/fromAmount",
"detail": "must be a positive base-10 integer"
}
]
}{
"type": "https://docs.ternswap.xyz/api-reference/errors#no_route",
"title": "No route",
"status": 422,
"code": "invalid_request",
"detail": "no solver quoted this route",
"requestId": "01JC2W6Q0Z8V5K3M7N1P4R9T2X",
"errors": [
{
"pointer": "#/fromAmount",
"detail": "must be a positive base-10 integer"
}
]
}{
"type": "https://docs.ternswap.xyz/api-reference/errors#no_route",
"title": "No route",
"status": 422,
"code": "invalid_request",
"detail": "no solver quoted this route",
"requestId": "01JC2W6Q0Z8V5K3M7N1P4R9T2X",
"errors": [
{
"pointer": "#/fromAmount",
"detail": "must be a positive base-10 integer"
}
]
}{
"type": "https://docs.ternswap.xyz/api-reference/errors#no_route",
"title": "No route",
"status": 422,
"code": "invalid_request",
"detail": "no solver quoted this route",
"requestId": "01JC2W6Q0Z8V5K3M7N1P4R9T2X",
"errors": [
{
"pointer": "#/fromAmount",
"detail": "must be a positive base-10 integer"
}
]
}{
"type": "https://docs.ternswap.xyz/api-reference/errors#no_route",
"title": "No route",
"status": 422,
"code": "invalid_request",
"detail": "no solver quoted this route",
"requestId": "01JC2W6Q0Z8V5K3M7N1P4R9T2X",
"errors": [
{
"pointer": "#/fromAmount",
"detail": "must be a positive base-10 integer"
}
]
}Authorizations
Query Parameters
true: an escrow quote still awaiting its deposit, before expiresAt, carries its steps again in execute,
rebuilt from its stored terms, with the approval only if the sender's allowance is still short.
Ignored for swaps and for quotes whose deposit is seen or which have expired.
Response
The quote
A firm quote: a solver's commitment (or a swap's route), and its progress. Every quote route and webhook returns this one object.