API Documentation

Webhooks

Webhook Management API

All routes require an admin with the manage scope, except the event catalog, which needs read. PRO only — none of these routes are registered in the free build, so they answer 404 rest_no_route there.

List webhooks

GET /wp-json/wcusage/v2/webhooks

[
  {
    "id": 1,
    "name": "Ops Slack relay",
    "url": "https://hooks.example.net/coupon-affiliates",
    "events": ["payout.requested", "payout.paid"],
    "status": "active",
    "failures": 0,
    "last_delivery": "2026-08-07T14:05:01",
    "last_error": "",
    "date_created": "2026-07-30T11:00:00"
  }
]

Signing secrets are not included in list responses. Full administrators can read them on the admin page; other plugin admins see them masked.

Create a webhook

POST /wp-json/wcusage/v2/webhooks

Body paramTypeDescription
namestringLabel for the webhook. Up to 100 characters.
urlstringRequired. HTTPS delivery URL. Validated against loopback and private addresses.
eventsarrayRequired. Event names from the catalog, or ["*"] for all. Unknown names are dropped; if nothing valid remains the request fails with 400 wcusage_api_no_events.

Returns 201 including the signing secret. Store it — it is the only way to verify deliveries, and this is the only response that carries it.

Update a webhook

PATCH /wp-json/wcusage/v2/webhooks/{id}

Body paramTypeDescription
statusstringactive or disabled. Re-activating resets the failure counter and clears the last error.
eventsarrayReplaces the subscribed events entirely.

Sending neither returns 400 wcusage_api_no_fields.

Note
The delivery URL cannot be changed after creation, by design — it is validated against SSRF only on the way in. To point a webhook somewhere else, delete it and create a new one. The signing secret is likewise fixed.

Test a webhook

POST /wp-json/wcusage/v2/webhooks/{id}/test

Sends a signed ping delivery immediately and synchronously, and returns the HTTP status your endpoint answered with:

{ "code": 200 }

A transport-level failure (DNS, TLS, timeout) returns 502 wcusage_api_delivery_failed with the underlying message. Test deliveries do not count towards the failure counter.

Delete a webhook

DELETE /wp-json/wcusage/v2/webhooks/{id}

{ "deleted": true }

Event catalog

GET /wp-json/wcusage/v2/webhooks/events

Permission: admin, read scope.

[
  { "event": "referral.created", "description": "A referred order was attributed to an affiliate." },
  { "event": "payout.paid", "description": "A payout was marked as paid." }
]

Read this rather than hard-coding the list: it reflects exactly which add-ons are active on the install.