Reveal the fulfillment
curl --request POST \
--url https://api.ternswap.xyz/v1/quotes/{id}/fulfill \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"fulfillment": "0x8f3b2c1d0e9f8a7b6c5d4e3f2a1b0c9d8e7f6a5b4c3d2e1f0a9b8c7d6e5f4a3b"
}
'import requests
url = "https://api.ternswap.xyz/v1/quotes/{id}/fulfill"
payload = { "fulfillment": "0x8f3b2c1d0e9f8a7b6c5d4e3f2a1b0c9d8e7f6a5b4c3d2e1f0a9b8c7d6e5f4a3b" }
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
fulfillment: '0x8f3b2c1d0e9f8a7b6c5d4e3f2a1b0c9d8e7f6a5b4c3d2e1f0a9b8c7d6e5f4a3b'
})
};
fetch('https://api.ternswap.xyz/v1/quotes/{id}/fulfill', 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}/fulfill",
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([
'fulfillment' => '0x8f3b2c1d0e9f8a7b6c5d4e3f2a1b0c9d8e7f6a5b4c3d2e1f0a9b8c7d6e5f4a3b'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.ternswap.xyz/v1/quotes/{id}/fulfill"
payload := strings.NewReader("{\n \"fulfillment\": \"0x8f3b2c1d0e9f8a7b6c5d4e3f2a1b0c9d8e7f6a5b4c3d2e1f0a9b8c7d6e5f4a3b\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<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://api.ternswap.xyz/v1/quotes/{id}/fulfill")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"fulfillment\": \"0x8f3b2c1d0e9f8a7b6c5d4e3f2a1b0c9d8e7f6a5b4c3d2e1f0a9b8c7d6e5f4a3b\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ternswap.xyz/v1/quotes/{id}/fulfill")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"fulfillment\": \"0x8f3b2c1d0e9f8a7b6c5d4e3f2a1b0c9d8e7f6a5b4c3d2e1f0a9b8c7d6e5f4a3b\"\n}"
response = http.request(request)
puts response.read_body{
"id": "q_01JB8Z5W3F6V9Q2X4K7M1N0P8R",
"status": "in_progress",
"route": "escrow",
"from": {
"chain": "base",
"asset": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
"amount": "100000000",
"txHash": "0x9a1e5c4f0b2d7e8a3c6f9b1d4e7a0c3f6b9d2e5a8c1f4b7d0e3a6c9f2b5d40c2",
"confirmedAt": 1793084112
},
"to": {
"chain": "starknet",
"asset": "0x053c91253bc9682c04929ca02ed00b3e423f6710d2ee7e0d5ebb06f3ecf368a8",
"amount": "99880000",
"minAmount": "99880000",
"lockedAt": 1793084139,
"escrows": [
{
"id": "0x1f9c4b7e0a3d6f9c2b5e8a1d4f7c0b3e6a9d2f5c8b1e4a7d0f3c6b9e2a5da210",
"txHash": "0x7b1d4e7a0c3f6b9d2e5a8c1f4b7d0e3a6c9f2b5d8e1a4c7f0b3d6e9a2c59e4d",
"amount": "99880000"
}
]
},
"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"
}
]
}{
"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"
}
]
}Quotes
Reveal the fulfillment
Reveals the 32-byte fulfillment whose SHA-256 is the quote’s executionCondition, once the solver has locked the
destination funds (in_progress). The relayer then claims them for the recipient. Check the destination escrows
on chain before revealing, by reading each of to.escrows: once revealed, the fulfillment is public.
POST
/
v1
/
quotes
/
{id}
/
fulfill
Reveal the fulfillment
curl --request POST \
--url https://api.ternswap.xyz/v1/quotes/{id}/fulfill \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"fulfillment": "0x8f3b2c1d0e9f8a7b6c5d4e3f2a1b0c9d8e7f6a5b4c3d2e1f0a9b8c7d6e5f4a3b"
}
'import requests
url = "https://api.ternswap.xyz/v1/quotes/{id}/fulfill"
payload = { "fulfillment": "0x8f3b2c1d0e9f8a7b6c5d4e3f2a1b0c9d8e7f6a5b4c3d2e1f0a9b8c7d6e5f4a3b" }
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
fulfillment: '0x8f3b2c1d0e9f8a7b6c5d4e3f2a1b0c9d8e7f6a5b4c3d2e1f0a9b8c7d6e5f4a3b'
})
};
fetch('https://api.ternswap.xyz/v1/quotes/{id}/fulfill', 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}/fulfill",
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([
'fulfillment' => '0x8f3b2c1d0e9f8a7b6c5d4e3f2a1b0c9d8e7f6a5b4c3d2e1f0a9b8c7d6e5f4a3b'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.ternswap.xyz/v1/quotes/{id}/fulfill"
payload := strings.NewReader("{\n \"fulfillment\": \"0x8f3b2c1d0e9f8a7b6c5d4e3f2a1b0c9d8e7f6a5b4c3d2e1f0a9b8c7d6e5f4a3b\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<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://api.ternswap.xyz/v1/quotes/{id}/fulfill")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"fulfillment\": \"0x8f3b2c1d0e9f8a7b6c5d4e3f2a1b0c9d8e7f6a5b4c3d2e1f0a9b8c7d6e5f4a3b\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ternswap.xyz/v1/quotes/{id}/fulfill")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"fulfillment\": \"0x8f3b2c1d0e9f8a7b6c5d4e3f2a1b0c9d8e7f6a5b4c3d2e1f0a9b8c7d6e5f4a3b\"\n}"
response = http.request(request)
puts response.read_body{
"id": "q_01JB8Z5W3F6V9Q2X4K7M1N0P8R",
"status": "in_progress",
"route": "escrow",
"from": {
"chain": "base",
"asset": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
"amount": "100000000",
"txHash": "0x9a1e5c4f0b2d7e8a3c6f9b1d4e7a0c3f6b9d2e5a8c1f4b7d0e3a6c9f2b5d40c2",
"confirmedAt": 1793084112
},
"to": {
"chain": "starknet",
"asset": "0x053c91253bc9682c04929ca02ed00b3e423f6710d2ee7e0d5ebb06f3ecf368a8",
"amount": "99880000",
"minAmount": "99880000",
"lockedAt": 1793084139,
"escrows": [
{
"id": "0x1f9c4b7e0a3d6f9c2b5e8a1d4f7c0b3e6a9d2f5c8b1e4a7d0f3c6b9e2a5da210",
"txHash": "0x7b1d4e7a0c3f6b9d2e5a8c1f4b7d0e3a6c9f2b5d8e1a4c7f0b3d6e9a2c59e4d",
"amount": "99880000"
}
]
},
"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"
}
]
}{
"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
Headers
Body
application/json
The body of POST /v1/quotes/{id}/fulfill: the fulfillment whose SHA-256 is the quote's execution condition. Reveal
it only after checking the destination escrows on chain. Debug never prints it.
Response
The relayer submits the fulfill; follow 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.