Register a webhook endpoint
curl --request POST \
--url https://api.swapnice.com/v1/webhook-endpoints \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"url": "<string>",
"enabled_events": []
}
'const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({url: '<string>', enabled_events: []})
};
fetch('https://api.swapnice.com/v1/webhook-endpoints', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.swapnice.com/v1/webhook-endpoints"
payload = {
"url": "<string>",
"enabled_events": []
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"endpoint": {
"id": "<string>",
"url": "<string>",
"enabled_events": [
"<string>"
],
"status": "active",
"created_at": "2023-11-07T05:31:56Z"
},
"signing_secret": "<string>"
}{
"error": {
"code": "consent_denied",
"message": "<string>",
"request_id": "<string>",
"details": [
{
"code": "<string>",
"message": "<string>",
"field": "<string>"
}
]
}
}{
"error": {
"code": "consent_denied",
"message": "<string>",
"request_id": "<string>",
"details": [
{
"code": "<string>",
"message": "<string>",
"field": "<string>"
}
]
}
}Webhooks
Register a webhook endpoint
Create a receiver. The signing secret is shown once.
POST
/
v1
/
webhook-endpoints
Register a webhook endpoint
curl --request POST \
--url https://api.swapnice.com/v1/webhook-endpoints \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"url": "<string>",
"enabled_events": []
}
'const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({url: '<string>', enabled_events: []})
};
fetch('https://api.swapnice.com/v1/webhook-endpoints', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.swapnice.com/v1/webhook-endpoints"
payload = {
"url": "<string>",
"enabled_events": []
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"endpoint": {
"id": "<string>",
"url": "<string>",
"enabled_events": [
"<string>"
],
"status": "active",
"created_at": "2023-11-07T05:31:56Z"
},
"signing_secret": "<string>"
}{
"error": {
"code": "consent_denied",
"message": "<string>",
"request_id": "<string>",
"details": [
{
"code": "<string>",
"message": "<string>",
"field": "<string>"
}
]
}
}{
"error": {
"code": "consent_denied",
"message": "<string>",
"request_id": "<string>",
"details": [
{
"code": "<string>",
"message": "<string>",
"field": "<string>"
}
]
}
}Create a receiver. The signing secret is shown once.
Registration is live. Delivery is near-term. See webhooks.
Authorizations
OAuth 2.1 authorization code with PKCE. Implicit and password flows are unsupported.
Headers
Required for mutating requests. Replays with the same key and payload hash return
the original logical result; replays with a different payload hash return 409.
Required string length:
16 - 255Body
application/json
⌘I