Register a webhook
curl --request POST \
--url https://api.hypermid.io/v1/partner/webhooks \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"url": "<string>",
"events": [
"swap.completed"
]
}
'import requests
url = "https://api.hypermid.io/v1/partner/webhooks"
payload = {
"url": "<string>",
"events": ["swap.completed"]
}
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({url: '<string>', events: ['swap.completed']})
};
fetch('https://api.hypermid.io/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.hypermid.io/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' => '<string>',
'events' => [
'swap.completed'
]
]),
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.hypermid.io/v1/partner/webhooks"
payload := strings.NewReader("{\n \"url\": \"<string>\",\n \"events\": [\n \"swap.completed\"\n ]\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.hypermid.io/v1/partner/webhooks")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"<string>\",\n \"events\": [\n \"swap.completed\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hypermid.io/v1/partner/webhooks")
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 \"url\": \"<string>\",\n \"events\": [\n \"swap.completed\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "whk_abc123def456",
"url": "https://yourapp.com/webhooks/hypermid",
"events": ["swap.completed", "swap.failed", "onramp.completed"],
"secret": "whsec_generated_or_provided_secret",
"active": true,
"createdAt": "2024-03-25T10:30:00Z"
},
"error": null,
"meta": {
"requestId": "z6c7d8e9-f0a1-2345-9012-456789012345",
"timestamp": 1711234584,
"rateLimit": {
"limit": 2000,
"remaining": 1974,
"reset": 1711234627
}
}
}
Partner
Create Webhook
Register a new webhook endpoint
POST
/
v1
/
partner
/
webhooks
Register a webhook
curl --request POST \
--url https://api.hypermid.io/v1/partner/webhooks \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"url": "<string>",
"events": [
"swap.completed"
]
}
'import requests
url = "https://api.hypermid.io/v1/partner/webhooks"
payload = {
"url": "<string>",
"events": ["swap.completed"]
}
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({url: '<string>', events: ['swap.completed']})
};
fetch('https://api.hypermid.io/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.hypermid.io/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' => '<string>',
'events' => [
'swap.completed'
]
]),
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.hypermid.io/v1/partner/webhooks"
payload := strings.NewReader("{\n \"url\": \"<string>\",\n \"events\": [\n \"swap.completed\"\n ]\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.hypermid.io/v1/partner/webhooks")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"<string>\",\n \"events\": [\n \"swap.completed\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hypermid.io/v1/partner/webhooks")
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 \"url\": \"<string>\",\n \"events\": [\n \"swap.completed\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "whk_abc123def456",
"url": "https://yourapp.com/webhooks/hypermid",
"events": ["swap.completed", "swap.failed", "onramp.completed"],
"secret": "whsec_generated_or_provided_secret",
"active": true,
"createdAt": "2024-03-25T10:30:00Z"
},
"error": null,
"meta": {
"requestId": "z6c7d8e9-f0a1-2345-9012-456789012345",
"timestamp": 1711234584,
"rateLimit": {
"limit": 2000,
"remaining": 1974,
"reset": 1711234627
}
}
}
Creates a new webhook endpoint to receive real-time notifications for swap and on-ramp events. Requires a valid API key.
The HTTPS URL to receive webhook payloads.
List of event types to subscribe to. See Webhooks Guide for available events.
A signing secret for HMAC-SHA256 signature verification. If not provided, one will be generated.
{
"data": {
"id": "whk_abc123def456",
"url": "https://yourapp.com/webhooks/hypermid",
"events": ["swap.completed", "swap.failed", "onramp.completed"],
"secret": "whsec_generated_or_provided_secret",
"active": true,
"createdAt": "2024-03-25T10:30:00Z"
},
"error": null,
"meta": {
"requestId": "z6c7d8e9-f0a1-2345-9012-456789012345",
"timestamp": 1711234584,
"rateLimit": {
"limit": 2000,
"remaining": 1974,
"reset": 1711234627
}
}
}
const webhook = await client.createWebhook({
url: "https://yourapp.com/webhooks/hypermid",
events: ["swap.completed", "swap.failed", "onramp.completed", "onramp.failed"],
secret: "whsec_my_signing_secret",
});
console.log("Webhook ID:", webhook.data.id);
console.log("Secret:", webhook.data.secret);
curl -X POST "https://api.hypermid.io/v1/partner/webhooks" \
-H "Content-Type: application/json" \
-H "X-API-Key: your-api-key" \
-d '{
"url": "https://yourapp.com/webhooks/hypermid",
"events": ["swap.completed", "swap.failed", "onramp.completed"],
"secret": "whsec_my_signing_secret"
}'
body := `{
"url": "https://yourapp.com/webhooks/hypermid",
"events": ["swap.completed", "swap.failed", "onramp.completed"],
"secret": "whsec_my_signing_secret"
}`
req, _ := http.NewRequest("POST",
"https://api.hypermid.io/v1/partner/webhooks",
strings.NewReader(body))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("X-API-Key", "your-api-key")
resp, _ := http.DefaultClient.Do(req)
Store the webhook
secret securely. You will need it to verify webhook signatures. If you lose it, delete the webhook and create a new one.Authorizations
Partner API key. Optional for public endpoints, required for /v1/partner/*.
Body
application/json
⌘I