Webhook
Create Webhook
AuthorizationBearer <token>
In: header
namestring
A name or identifier of the webhook.
Length
length <= 500
description?string
A description of the webhook purpose and event's subscribed.
Length
length <= 500
urlstring
The HTTP URL endpoint that SpherePay will send notifications of event to.
Format
"uri"
eventsarray<string>
The names of the events that the webhook will listen for. All events are listed under here. Use '*'
to listen to all events.
Response Body
curl -X POST "https://api.sandbox.spherepay.co/v1/webhook" \
-H "Content-Type: application/json" \
-d '{
"name": "Example Webhook",
"description": "An example webhook",
"url": "https://webhook.site/e0459019-e68f-446f-9eb0-b96ead041430",
"events": [
"*"
]
}'
const body = JSON.stringify({
"name": "Example Webhook",
"description": "An example webhook",
"url": "https://webhook.site/e0459019-e68f-446f-9eb0-b96ead041430",
"events": [
"*"
]
})
fetch("https://api.sandbox.spherepay.co/v1/webhook", {
body
})
package main
import (
"fmt"
"net/http"
"io/ioutil"
"strings"
)
func main() {
url := "https://api.sandbox.spherepay.co/v1/webhook"
body := strings.NewReader(`{
"name": "Example Webhook",
"description": "An example webhook",
"url": "https://webhook.site/e0459019-e68f-446f-9eb0-b96ead041430",
"events": [
"*"
]
}`)
req, _ := http.NewRequest("POST", url, body)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
import requests
url = "https://api.sandbox.spherepay.co/v1/webhook"
body = {
"name": "Example Webhook",
"description": "An example webhook",
"url": "https://webhook.site/e0459019-e68f-446f-9eb0-b96ead041430",
"events": [
"*"
]
}
response = requests.request("POST", url, json = body, headers = {
"Content-Type": "application/json"
})
print(response.text)
{
"ok": true,
"object": "object",
"statusCode": 200,
"error": null,
"message": "success",
"data": {
"webhook": {
"id": "webhook_868e8a70c8f24aed9e56405429790307",
"name": "Example Webhook",
"description": "An example webhook",
"active": true,
"deliveryRate": "1",
"status": "healthy",
"events": [
"customer.create",
"customer.update",
"customer.tos.pending",
"customer.tos.successful",
"customer.kyc.successful",
"bankAccount.create",
"wallet.create"
],
"url": "https://webhook.site/b14a90e9-42b6-4f99-b9f3-371538104646",
"secret": "secret_9e0c4371b49a4662ba91d232297f5873",
"updated": "2025-04-10T21:21:33.705Z",
"created": "2025-04-10T21:21:33.705Z"
}
},
"ts": "2025-04-10T21:21:33.718Z",
"request": "request_64985247b39345a6914813bab01c09b7"
}
{
"ok": false,
"object": "error",
"statusCode": 400,
"error": {
"url": [
"String must contain at least 1 character(s)",
"Invalid url"
]
},
"message": "String must contain at least 1 character(s), Invalid url",
"data": null,
"ts": "2025-04-20T21:47:41.608Z",
"request": "request_886f5c7985734ea6b4e57411baa90e9a"
}