Affiliate Programs API

Create programs with CPC/CPA commission and manage partners (Builder+)

The Affiliate API has two roles: merchant (you create a program and approve partners) and partner (you join another user's program). Programs support three commission types: cost-per-click (cpc), cost-per-acquisition with return (cpa_return), or both (both). Creating programs requires Builder or higher; joining programs is available on all paid plans.

Base URL

https://awsys.co

Authentication

All affiliate endpoints require a valid API key. See the Authentication page for details.

Authorization: Bearer YOUR_API_KEY

Merchant Flow

Create an Affiliate Program

POST /api/affiliate/programs Builder+

Request body

{
  "name": "ACME Partner Program",
  "description": "Earn commission for every click you send our way.",
  "commissionType": "cpc",
  "cpcRate": 0.05,
  "cpaRate": null,
  "isPublic": true
}
FieldTypeRequiredDescription
namestringYesProgram display name
descriptionstringNoPublic description shown to potential partners
commissionTypestringYescpc, cpa_return, or both
cpcRatenumberIf CPCUSD per click (0.01–10.00)
cpaRatenumberIf CPAUSD per conversion (1–100)
isPublicbooleanNoWhether the program appears in the discovery feed (default false)

curl example

curl -X POST https://awsys.co/api/affiliate/programs \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "ACME Partner Program",
    "commissionType": "cpc",
    "cpcRate": 0.05,
    "isPublic": true
  }'

List My Programs (Merchant)

GET /api/affiliate/programs

curl https://awsys.co/api/affiliate/programs \
  -H "Authorization: Bearer YOUR_API_KEY"

Get Program Details

GET /api/affiliate/programs/:id

Update a Program

PATCH /api/affiliate/programs/:id

Update any of the create fields (name, description, commission rates, public status).

Get Program Statistics

GET /api/affiliate/programs/:id/stats?period=30d

Supported periods: 7d, 30d, 90d.

List Program Partners

GET /api/affiliate/programs/:id/partners

Returns all partners who have joined this program.

Approve or Reject a Partner

PATCH /api/affiliate/programs/:id/partners/:pid

{ "status": "approved" }

Valid values for status: approved, rejected.

Partner Flow

Discover Public Programs

GET /api/affiliate/discover?limit=20

Browse public affiliate programs available to join. Maximum 50 results per request.

curl https://awsys.co/api/affiliate/discover \
  -H "Authorization: Bearer YOUR_API_KEY"

Join a Program

POST /api/affiliate/join/:programId

{
  "partnerCode": "optional-custom-code"
}

The optional partnerCode lets you request a specific tracking code. If omitted, one is generated automatically.

curl -X POST https://awsys.co/api/affiliate/join/prog_abc123 \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

List My Partnerships (Partner)

GET /api/affiliate/partnerships

Returns all programs you have joined as a partner.

Get Partnership Statistics

GET /api/affiliate/partnerships/:id/stats?period=30d

Leave a Program

DELETE /api/affiliate/partnerships/:id

Tier Limits

GET /api/affiliate/limits

Returns your current tier's affiliate limits and current usage counts.

{
  "tier": "builder",
  "limits": {
    "maxPrograms": 5,
    "maxPartnerships": 20,
    "canDiscover": true
  },
  "usage": {
    "programs": 1,
    "partnerships": 3
  }
}

Error Codes

HTTPDescription
400Invalid request — check commission type values and rate ranges
403Access denied — wrong tier or not the program owner
404Program or partnership not found

Commission type values are strict. commissionType must be exactly cpc, cpa_return, or both — other values return a 400 error. CPC rate must be 0.01–10.00. CPA rate must be 1–100.