Register a webhook endpoint
curl --request POST \
--url https://api.example.com/api/v1/partner/webhooks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "https://example.com/webhooks/exchange",
"events": [
"order.created",
"order.status_changed"
]
}
'import requests
url = "https://api.example.com/api/v1/partner/webhooks"
payload = {
"url": "https://example.com/webhooks/exchange",
"events": ["order.created", "order.status_changed"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
url: 'https://example.com/webhooks/exchange',
events: ['order.created', 'order.status_changed']
})
};
fetch('https://api.example.com/api/v1/partner/webhooks', 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.example.com/api/v1/partner/webhooks",
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([
'url' => 'https://example.com/webhooks/exchange',
'events' => [
'order.created',
'order.status_changed'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.example.com/api/v1/partner/webhooks"
payload := strings.NewReader("{\n \"url\": \"https://example.com/webhooks/exchange\",\n \"events\": [\n \"order.created\",\n \"order.status_changed\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.example.com/api/v1/partner/webhooks")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"https://example.com/webhooks/exchange\",\n \"events\": [\n \"order.created\",\n \"order.status_changed\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/partner/webhooks")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"https://example.com/webhooks/exchange\",\n \"events\": [\n \"order.created\",\n \"order.status_changed\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "550e8400-e29b-41d4-a716-446655440000",
"url": "https://example.com/webhooks/exchange",
"events": [
"order.created",
"order.status_changed"
],
"isActive": true,
"failCount": 0,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"secretKey": "a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2",
"note": "Store this secret key securely — it will not be shown again. Use it to verify HMAC-SHA256 signatures."
}{
"statusCode": 400,
"message": [
"url must be a URL address",
"events should not be empty"
],
"error": "Bad Request"
}{
"statusCode": 401,
"message": "Unauthorized"
}{
"statusCode": 429,
"message": "Too Many Requests"
}Webhooks
Create Webhook
Registers a new webhook endpoint. The response includes the secretKey for HMAC-SHA256 signature verification — it is shown only once. Store it securely.
POST
/
partner
/
webhooks
Register a webhook endpoint
curl --request POST \
--url https://api.example.com/api/v1/partner/webhooks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "https://example.com/webhooks/exchange",
"events": [
"order.created",
"order.status_changed"
]
}
'import requests
url = "https://api.example.com/api/v1/partner/webhooks"
payload = {
"url": "https://example.com/webhooks/exchange",
"events": ["order.created", "order.status_changed"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
url: 'https://example.com/webhooks/exchange',
events: ['order.created', 'order.status_changed']
})
};
fetch('https://api.example.com/api/v1/partner/webhooks', 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.example.com/api/v1/partner/webhooks",
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([
'url' => 'https://example.com/webhooks/exchange',
'events' => [
'order.created',
'order.status_changed'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.example.com/api/v1/partner/webhooks"
payload := strings.NewReader("{\n \"url\": \"https://example.com/webhooks/exchange\",\n \"events\": [\n \"order.created\",\n \"order.status_changed\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.example.com/api/v1/partner/webhooks")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"https://example.com/webhooks/exchange\",\n \"events\": [\n \"order.created\",\n \"order.status_changed\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/partner/webhooks")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"https://example.com/webhooks/exchange\",\n \"events\": [\n \"order.created\",\n \"order.status_changed\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "550e8400-e29b-41d4-a716-446655440000",
"url": "https://example.com/webhooks/exchange",
"events": [
"order.created",
"order.status_changed"
],
"isActive": true,
"failCount": 0,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"secretKey": "a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2",
"note": "Store this secret key securely — it will not be shown again. Use it to verify HMAC-SHA256 signatures."
}{
"statusCode": 400,
"message": [
"url must be a URL address",
"events should not be empty"
],
"error": "Bad Request"
}{
"statusCode": 401,
"message": "Unauthorized"
}{
"statusCode": 429,
"message": "Too Many Requests"
}Authorizations
Partner API key. Format: sk_branch_<32chars>, sk_personal_<32chars>, or pk_<32chars> (public, read-only)
Body
application/json
Response
Webhook registered. The secretKey field is shown only in this response.
Example:
"550e8400-e29b-41d4-a716-446655440000"
Example:
"https://example.com/webhooks/exchange"
Available options:
order.created, order.status_changed, order.cancelled, offer.updated Example:
["order.created", "order.status_changed"]
Example:
true
Example:
0
HMAC-SHA256 signing secret. Shown only once — store securely.
Example:
"a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2"
Example:
"Store this secret key securely — it will not be shown again. Use it to verify HMAC-SHA256 signatures."