API Documentation

Getting Started

Requests & Responses

Conventions

  • All responses are JSON. GET parameters go in the query string; POST and PATCH parameters go in a JSON body with Content-Type: application/json (WordPress also accepts form-encoded bodies).
  • Resources are addressed by numeric ID. Coupon codes are never identifiers: WooCommerce coupon codes are case-insensitive and are not guaranteed unique.
  • Money values are plain JSON numbers in the store's currency — no symbol, no thousands separators. GET /reports/summary reports the currency code.
  • Collections are returned as a bare JSON array, with totals in response headers.

Pagination

Every collection endpoint takes the same two parameters:

ParamTypeDescription
pageintegerPage number, starting at 1. Default 1.
per_pageintegerItems per page, 1–100. Default 20.

And returns the same two headers:

  • X-WP-Total — total matching items.
  • X-WP-TotalPages — total pages at the current per_page.

A page past the end of the result set returns an empty array with correct headers, without running the underlying query.

Dates

  • Request parameters (from, to, expires) use Y-m-d, e.g. 2026-08-01. Anything else is rejected with 400 rest_invalid_param.
  • Response fields use ISO 8601 in the site's timezone, e.g. 2026-08-07T14:03:22. Empty dates are null.
  • Ranges include both ends. When from is given without to, to defaults to today.

Errors

Errors use the standard WordPress REST shape. Every code raised by this plugin is prefixed wcusage_api_:

{
  "code": "wcusage_api_forbidden",
  "message": "You do not have permission to access this resource.",
  "data": { "status": 403 }
}

Rate-limit and throttle errors add retry_after (seconds) to data.

StatusMeaning
400Invalid parameter, or the action is not possible right now (no unpaid balance, status already set, activity log disabled).
401Not authenticated, or the API key is invalid, revoked, expired, or was sent over plain HTTP.
403Authenticated but not permitted — wrong capability, missing scope, or a key used outside the plugin's namespaces.
404Not found. Also returned for a resource that exists but belongs to somebody else, and for an endpoint switched off in the settings.
409Conflict — another request is mid-flight, or the resource changed underneath this one.
429Rate limited, throttled, or locked out after repeated authentication failures.
500Server error, e.g. the site could not generate a secure token.
501The feature this endpoint reads is not present on this install (payouts add-on inactive, table missing).
Note
A resource owned by somebody else answers 404, not 403. That is deliberate: it stops an authenticated affiliate walking the ID space to learn which coupons, payouts or affiliates exist. So do not read a 404 as proof that an ID is unused.

A full list of plugin error codes is in the Error reference.

Rate limiting

Requests to both plugin namespaces are counted per minute, per identity — the API key, the logged-in user, or a shared bucket for anonymous callers:

  • Authenticated: 120 requests per minute
  • Unauthenticated: 30 requests per minute

Over the limit, requests get 429 wcusage_api_rate_limited with retry_after: 60. Malformed requests are counted too, so a client stuck retrying a bad parameter is throttled like any other. Adjust the ceiling with the wcusage_api_rate_limit filter.