API and webhooks
Webhook endpoints
A webhook endpoint is a URL on your server that receives Plandalf's webhook events. You register endpoints through the API; there's no dashboard screen for them.
Example
curl -X POST https://admin.plandalf.dev/api/v1/webhook_endpoints \
-H "Authorization: Bearer $PLANDALF_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com/webhooks/plandalf", "description": "Fulfilment", "events": ["checkout.completed", "invoice.refunded", "subscription.canceled"]}'
The response includes the endpoint's signing secret (whsec_…). It's shown this once, so store it now: you need it to verify signatures.
eventslists event types, or["*"]for every event.- The URL must be public and use
https. - The endpoint's mode follows the key you register it with: a
test_key's endpoint gets test-mode events only, alive_key's live ones only. Register one of each if you want both. - Deleting an endpoint stops its deliveries, including retries still waiting.
- An endpoint is turned off if it has gone 3 days without a successful delivery. See Delivery and retries.
Endpoints
List webhook endpoints
GET /api/v1/webhook_endpoints
Newest first. An OAuth site connection sees only the endpoints it registered.
curl https://admin.plandalf.dev/api/v1/webhook_endpoints \
-H "Authorization: Bearer $PLANDALF_API_KEY"
Response
{
"data": [
{
"id": 0,
"url": "string",
"events": [
"string"
],
"mode": "string",
"status": "string",
"description": "string",
"created_at": "string"
}
]
}
Errors
| Status | When |
|---|---|
401 | The API key or OAuth token is missing or invalid. |
Create a webhook endpoint
POST /api/v1/webhook_endpoints
The endpoint's mode follows the key that registered it: a test_ key's endpoint receives
test-mode events only, a live_ key's live-mode events only. events lists event types,
or * for all of them. The response includes the signing secret, once; store it to
verify the Plandalf-Signature header. The URL must be public https.
Body
| Field | Type | What it is |
|---|---|---|
url | string | |
description optional | string | null | |
events | "*" | "checkout.completed" | "invoice.paid" | "invoice.payment_failed" | "invoice.voided" | "invoice.refunded" | "subscription.updated" | "subscription.canceled"[] |
curl -X POST https://admin.plandalf.dev/api/v1/webhook_endpoints \
-H "Authorization: Bearer $PLANDALF_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url":"string","description":"string","events":["*"]}'
Response
{
"id": 0,
"url": "string",
"events": [
"string"
],
"mode": "string",
"status": "string",
"description": "string",
"created_at": "string",
"secret": "string"
}
Errors
| Status | When |
|---|---|
401 | The API key or OAuth token is missing or invalid. |
403 | The credentials are valid but not allowed here: a site-connection token outside its scope, or the organization can't make this request. |
422 | The request failed validation; errors lists the problems by field. |
Delete a webhook endpoint
DELETE /api/v1/webhook_endpoints/{webhookEndpoint}
Stops deliveries to it, including retries that are still pending.
Parameters
| Name | In | Type | What it is |
|---|---|---|---|
webhookEndpoint | path | integer |
curl -X DELETE https://admin.plandalf.dev/api/v1/webhook_endpoints/:webhookEndpoint \
-H "Authorization: Bearer $PLANDALF_API_KEY"
Response
{
"id": 0,
"deleted": true
}
Errors
| Status | When |
|---|---|
401 | The API key or OAuth token is missing or invalid. |