PilotFoxDocs

Create an affiliate

POST
/api/v1/sites/{siteId}/affiliates

A named affiliate: visits whose landing URL carries its slug in one of the site's affiliate parameters (settings.affiliates.params) are its own; commissionPercent (0 to 100, two decimals at most; 0 by default) sets its share of their revenue. 400 for a slug with nothing left once normalized, 409 for a slug the site already has.

Requires affiliates:write on the site (an API key, or a signed-in member's role). Share links: 401.

Authorization

headerx-api-key<token>

An organization API key (ak_…), with the permissions and the sites it was created with. For servers and scripts: no cookie and no Origin check. Also accepted as Authorization: Bearer ak_… (apiKeyBearer). A request carries one credential: a key sent with a share token or a live session cookie is 400 (details.reason: ambiguous_credentials).

Scope: affiliates:write

Path Parameters

siteId*string

Request Body

application/json
  1. body
name*string
Length1 <= length <= 80
slug*string

Normalized as ingest normalizes the link's value: lowercased, only a-z 0-9 _ - kept, cut to 64

Lengthlength <= 256
commissionPercent?number
Range0 <= value <= 100

Response Body

Created

application/json
  1. response
data*
Example Request
curl -X POST 'https://pilotfox.app/api/v1/sites/string/affiliates' \  -H 'Content-Type: application/json' \  -d '{  "name": "string",  "slug": "string"}'
Example Response201
{  "data": {    "id": "string",    "name": "string",    "slug": "string",    "commissionPercent": 0,    "shareEnabled": true,    "createdAt": "string",    "updatedAt": "string"  }}