API Documentation

Getting Started

Enabling the API

The API ships switched off. A site never starts answering API requests just because the plugin was updated — an administrator has to turn it on deliberately.

  1. Go to Coupon Affiliates → Admin Tools → API in wp-admin.
  2. Press Enable API at the top of the page.
  3. Create an API key, or use a WordPress application password.

The same screen shows your base URL, the OpenAPI URL, every registered endpoint with the access level it needs, your API keys, and — on PRO — your webhooks.

Turning individual endpoints on and off

Each endpoint has its own checkbox on the API screen. Unticking one removes it from the route table for every request — it answers 404 with the core code rest_no_route, exactly as though it had never been registered. This is the right tool for narrowing what any integration can reach at all, regardless of who authenticates.

The settings live in the wcusage_api_settings option. Only the exceptions are stored, so an endpoint added in a later release is on by default once the API itself is on.

What the master switch controls

BehaviourAPI onAPI off
wcusage/v2 routesRegisteredNot registered (404)
API key authenticationWorksRefused everywhere, v1 included
Webhook deliveries (PRO)Queued and sentNot queued; already-queued retries are dropped
Adding and testing webhooks in wp-admin (PRO)WorksWorks
Legacy woo-coupon-usage/v1 routesAvailableStill available (application password or cookie auth only)
Warning
Disabling the API stops outbound webhook deliveries as well as inbound requests. If a system depends on webhooks, switching the API off silently stops feeding it.