API Documentation

Primeros pasos

Introduction

The Coupon Affiliates REST API gives external tools, scripts and AI agents structured JSON access to your affiliate program: affiliates, coupons, referred orders, commission, payouts, registrations, click tracking, a change-event feed and store-wide reports. It also delivers outbound webhooks (PRO), so other systems can react the moment something happens in your program. On the free version the same ground is covered by polling the change-event feed, which carries a cursor for exactly that.

Everything lives under one base URL on your own site:

https://example.com/wp-json/wcusage/v2

A first request, using a WordPress application password for an admin user:

curl https://example.com/wp-json/wcusage/v2/me \
  -u "admin:abcd efgh ijkl mnop qrst uvwx"
{
  "user": { "id": 1, "display_name": "Admin", "login": "admin", "email": "[email protected]" },
  "is_admin": true,
  "is_affiliate": false,
  "auth": { "method": "wordpress", "key_id": null, "scopes": null },
  "coupons": [],
  "api_version": "8.2.0"
}

What you can do with it

  • Report — pull program totals, per-affiliate stats, per-coupon sales and commission, and referred-order lists into a BI tool, spreadsheet or custom dashboard.
  • Automate — approve or decline affiliate applications, create payout requests, and react to program events in real time.
  • Integrate — connect Zapier/Make-style automation, a CRM, an accounting system, or an AI agent that answers questions about your affiliates.
  • Build affiliate-facing tools — an affiliate can authenticate as themselves and read only their own data, so you can build a custom affiliate app without handing out admin access.

Who can use it

  • Admins — any user who passes the plugin's admin access check (usually manage_woocommerce, or whichever capability you configured) can read and manage everything.
  • Afiliados — can read their own coupons, stats, referred orders, click stats and payouts, and can request a payout for their own coupon. They cannot see other affiliates, store-wide reports or the events feed.
  • Multi-level uplines (PRO) — can also read a downline affiliate's coupon, stats and referred orders.
  • Nobody else. There are no anonymous endpoints other than the OpenAPI document.

Requirements

  • Afiliados al cupón 8.2 or later, with the API switched on (see the next page).
  • The WordPress REST API enabled — it is by default.
  • Pretty permalinks, if you want to use the /wp-json/… URL form. On a site with plain permalinks, use https://example.com/?rest_route=/wcusage/v2/me instead: the /wp-json/ path is not a REST request at all on such a site, and API keys will not authenticate against it.
  • HTTPS. API keys are refused over plain HTTP outside local and development environments.
  • Some endpoints depend on features that may not be present (payouts, registrations, clicks, activity log). Those answer 501 rather than pretending to be empty — see Availability.
Warning
Before connecting anything to a live store, read Security & Disclaimers. This API returns personal data about real people and can perform actions that cannot be undone through the API — and on some configurations, actions that move real money.