Affiliate apply
id: affiliatewp-affiliates-apply owner: affiliatewp method: POST path: /wp-json/headlesswp/v1/affiliates/apply title: Affiliate apply usedBySite: true
POST /wp-json/headlesswp/v1/affiliates/apply
Allows a logged-in user to submit an affiliate application.
Auth + CSRF
- Auth: cookie session required.
- Proxy nonce required: yes.
Request schema
{
"firstName": "string (required)",
"lastName": "string (required)",
"email": "string (required, valid email)",
"website": "string (required, non-empty, valid URL; https:// is prefixed when scheme is missing)",
"promotionMethod": "string (required, non-empty)",
"partnerMarketingOptIn": "boolean (optional; missing/null treated as false)"
}
Unknown fields are rejected with 422 VALIDATION_FAILED.
Contract notes:
websiteis mirrored to the WordPress user profileuser_urlso AffiliateWP admin displays the value on the user edit screen.promotionMethodis persisted to AffiliateWP meta underpromotional_methods(withpromotion_methodfallback for compatibility) for staff review.- Marketing consent persistence is deterministic for both customer and partner campaigns:
- user meta
headlesswp_marketing_opt_in/headlesswp_marketing_opt_in_atalways remain explicit ('yes'|'no'; timestamp only when'yes'). - user meta
headlesswp_partner_marketing_opt_in/headlesswp_partner_marketing_opt_in_atare written frompartnerMarketingOptIn('yes'|'no'; timestamp only when'yes'). - affiliate meta keys include both consent families:
marketing_opt_in*andpartner_marketing_opt_in*. - notes are updated idempotently to contain one line for each consent:
Marketing opt-in: yes|noandPartner marketing opt-in: yes|no. - WordPress user bio (
description) is overwritten with a deterministic consent block that includes both customer and partner consent status/timestamps.
- user meta
Response schema
{
"data": {
"affiliate": {
"id": "number",
"userId": "number",
"email": "string",
"firstName": "string",
"lastName": "string",
"website": "string",
"promotionMethod": "string",
"status": "string (defaults to pending when blank)"
}
}
}
Error codes
| Status | Code | Notes |
|---|---|---|
| 401 | NOT_AUTHENTICATED | Login required. |
| 403 | AFFILIATE_TERMS_REQUIRED | Terms acceptance required before application submission. |
| 409 | AFFILIATE_EXISTS | Existing affiliate account; includes details.affiliateId. |
| 422 | VALIDATION_FAILED | Field validation or unknown fields failed. |
| 400 | APPLICATION_FAILED | AffiliateWP rejected/failed application creation. |
| 500 | CONFIG_INVALID_AFFILIATE_TERMS_VERSION | Terms config invalid while gating active. |
| 503 | DEPENDENCY_UNAVAILABLE | AffiliateWP dependency missing/unavailable. |