Skip to content
GPLWP Guides

How to manage affiliate data through a WordPress REST API

Developer Tools Time About 30 minutes for setup and a first request Updated 26 Oct 2026

DEVELOPER TOOLS
The short answer

AffiliateWP core lets you read affiliates, referrals, payouts, creatives and visits through authenticated REST endpoints. Creating, updating or deleting that data is not available in core, so you need custom development or the REST API Extended add-on for those operations.

What you need

  • A WordPress site with AffiliateWP installed and configured
  • Administrator access or an account with the required AffiliateWP capabilities
  • An HTTPS connection and an API client such as cURL or Postman
The fast route

Let AffiliateWP REST API Extended do it

Adds create, update, and delete API endpoints for affiliate data when read-only REST access is not enough.

Get AffiliateWP REST API Extended

Questions

Can AffiliateWP manage affiliate data through its core REST API?
AffiliateWP core can read affiliate data but cannot create, update or delete it through the REST API. It provides authenticated GET endpoints for affiliates, referrals, payouts, creatives and visits. Use those endpoints for reporting or synchronisation. For write operations, you must build custom integration code or install an extension that adds the missing CRUD methods.
How do I authenticate AffiliateWP REST API requests?
Authenticate each request with an API key pair generated in AffiliateWP or Affiliates → Tools → API Keys. Send the public key as the Basic Authentication username and the token as the password. The key owner must have suitable AffiliateWP capabilities, and the request should use HTTPS. Incorrect credentials or permissions commonly return a 403 rest_forbidden response.
How do I create an affiliate through the API?
Creating an affiliate requires the REST API Extended functionality or equivalent custom code. Send a POST or PUT request to the affiliates endpoint with an existing user_id, or use create_user=1 with a unique payment_email to create the WordPress user and affiliate together. You can also supply the rate, rate_type, status and notes fields.
Why does my API request return 403 or an empty result?
A 403 response usually means the API key is missing, incorrect or linked to a user without the required capabilities. An empty result can be caused by filters such as status, affiliate_id, number or offset. Check the exact URL, authentication header, WordPress site, resource settings and endpoint schema returned by an OPTIONS request.
Can I delete an affiliate with the REST API?
Yes, but not with AffiliateWP core alone. With REST API Extended enabled, send an authenticated DELETE request to /wp-json/affwp/v1/affiliates/{id}. A successful response includes deleted: true and the previous affiliate object. Treat this as a destructive operation: verify the ID first and keep the response for an audit record.