Endpoints

POST /webhooks

Register a webhook endpoint and get a signing secret.

POST/webhookssecret key

Register a webhook endpoint. The response includes a per-endpoint secret used to sign deliveries.

Body parameters
  • urlstringrequired
    HTTPS endpoint that will receive deliveries.
  • eventsstring[]required
    Subset of supported event types. `*` subscribes to all.
Request
curl https://sandbox-api.key2pays.com/v1/webhooks \
  -H "Authorization: Bearer sk_test_51N8mP...exampleK3Y" \
  -H "Content-Type: application/json" \
  -d '{ "url": "https://acme.com/webhooks/moonpoay", "events": ["payment.completed"] }'
Response
{
  "id": "we_2zP97…",
  "url": "https://acme.com/webhooks/moonpoay",
  "events": ["payment.completed"],
  "secret": "whsec_2zP97…",
  "status": "active"
}