> For the complete documentation index, see [llms.txt](https://developers.spiffy.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.spiffy.co/api/affiliates/affiliates.md). Agents can also search and read this documentation through its [MCP server](https://developers.spiffy.co/~gitbook/mcp).

# Affiliates

Manage affiliates and check slug availability.

## List affiliates

> Retrieve a paginated list of affiliates

```json
{"openapi":"3.0.3","info":{"title":"Spiffy API","version":"2.0.0"},"tags":[{"name":"affiliate-records","description":"Manage affiliates and check slug availability."}],"servers":[{"url":"https://api.spiffy.co","description":"Production"}],"security":[{"ApiKeyAuth":[]},{"OAuth2":["affiliates"]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"http","scheme":"bearer","bearerFormat":"API Key","description":"Account API key authentication. Pass an API key as a Bearer token in the `Authorization` header. An account may have multiple named keys; any of them grants full access to all endpoints — equivalent to all OAuth scopes."},"OAuth2":{"type":"oauth2","description":"OAuth 2.0 authentication for third-party integrations. Access is limited to the scopes granted by the merchant during authorization.","flows":{"authorizationCode":{"authorizationUrl":"https://app.spiffy.co/oauth/authorize","tokenUrl":"https://api.spiffy.co/oauth/token","refreshUrl":"https://api.spiffy.co/oauth/token","scopes":{"account":"Access account details and settings","users":"Manage users","customers":"Read and manage customers","checkouts":"Read and manage checkouts","subscriptions":"Read and manage subscriptions","subscription_metered_billing":"Manage metered billing for subscriptions","integrations":"Manage integrations","orders":"Read and manage orders","payments":"Read and manage payments","paymentplans":"Read and manage payment plans","webhooks":"Manage webhook endpoints and view event logs","promos":"Read and manage promotions and their codes","affiliates":"Read and manage affiliates and programs","products":"Read and manage products","analytics":"Read analytics data (revenue, orders, subscriptions, MRR)","reports":"Create, run, and read saved reports and their results"}}}}},"schemas":{"Error401":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["unauthorized"]},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]},"Error403":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["forbidden"]},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]},"Error500":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["internal_error"]},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}},"paths":{"/v2/affiliates":{"get":{"tags":["affiliate-records"],"summary":"List affiliates","description":"Retrieve a paginated list of affiliates","parameters":[{"schema":{"type":"integer","minimum":0,"exclusiveMinimum":true,"description":"Page number"},"required":false,"description":"Page number","name":"page","in":"query"},{"schema":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":100,"description":"Items per page (max 100)"},"required":false,"description":"Items per page (max 100)","name":"per_page","in":"query"},{"schema":{"type":"string","description":"Search across: name_first, name_last, email, slug, paypal_email"},"required":false,"description":"Search across: name_first, name_last, email, slug, paypal_email","name":"search","in":"query"},{"schema":{"type":"string","description":"Filter by id (exact match)."},"required":false,"description":"Filter by id (exact match).","name":"filter[id]","in":"query"},{"schema":{"type":"string","description":"Filter by id (greater than or equal)"},"required":false,"description":"Filter by id (greater than or equal)","name":"filter[id.gte]","in":"query"},{"schema":{"type":"string","description":"Filter by id (less than or equal)"},"required":false,"description":"Filter by id (less than or equal)","name":"filter[id.lte]","in":"query"},{"schema":{"type":"string","description":"Filter by id (comma-separated list). Fetches many records in one request instead of one request per id."},"required":false,"description":"Filter by id (comma-separated list). Fetches many records in one request instead of one request per id.","name":"filter[id.in]","in":"query"},{"schema":{"type":"string","description":"Filter by id (excluding a comma-separated list)"},"required":false,"description":"Filter by id (excluding a comma-separated list)","name":"filter[id.nin]","in":"query"},{"schema":{"type":"string","description":"Filter by email (exact match)."},"required":false,"description":"Filter by email (exact match).","name":"filter[email]","in":"query"},{"schema":{"type":"string","description":"Filter by email (contains)"},"required":false,"description":"Filter by email (contains)","name":"filter[email.contains]","in":"query"},{"schema":{"type":"string","description":"Filter by name_first (exact match)."},"required":false,"description":"Filter by name_first (exact match).","name":"filter[name_first]","in":"query"},{"schema":{"type":"string","description":"Filter by name_first (contains)"},"required":false,"description":"Filter by name_first (contains)","name":"filter[name_first.contains]","in":"query"},{"schema":{"type":"string","description":"Filter by name_last (exact match)."},"required":false,"description":"Filter by name_last (exact match).","name":"filter[name_last]","in":"query"},{"schema":{"type":"string","description":"Filter by name_last (contains)"},"required":false,"description":"Filter by name_last (contains)","name":"filter[name_last.contains]","in":"query"},{"schema":{"type":"string","description":"Filter by slug (exact match)."},"required":false,"description":"Filter by slug (exact match).","name":"filter[slug]","in":"query"},{"schema":{"type":"string","description":"Filter by slug (contains)"},"required":false,"description":"Filter by slug (contains)","name":"filter[slug.contains]","in":"query"},{"schema":{"type":"string","description":"Filter by paypal_email (exact match)."},"required":false,"description":"Filter by paypal_email (exact match).","name":"filter[paypal_email]","in":"query"},{"schema":{"type":"string","description":"Filter by paypal_email (contains)"},"required":false,"description":"Filter by paypal_email (contains)","name":"filter[paypal_email.contains]","in":"query"},{"schema":{"type":"string","description":"Filter by is_ready_for_payout (exact match)."},"required":false,"description":"Filter by is_ready_for_payout (exact match).","name":"filter[is_ready_for_payout]","in":"query"},{"schema":{"type":"string","description":"Filter by performance_digest_frequency_days (exact match). Valid values: 0, 1, 7, 30."},"required":false,"description":"Filter by performance_digest_frequency_days (exact match). Valid values: 0, 1, 7, 30.","name":"filter[performance_digest_frequency_days]","in":"query"},{"schema":{"type":"string","description":"Filter by performance_digest_frequency_days (greater than or equal)"},"required":false,"description":"Filter by performance_digest_frequency_days (greater than or equal)","name":"filter[performance_digest_frequency_days.gte]","in":"query"},{"schema":{"type":"string","description":"Filter by performance_digest_frequency_days (less than or equal)"},"required":false,"description":"Filter by performance_digest_frequency_days (less than or equal)","name":"filter[performance_digest_frequency_days.lte]","in":"query"},{"schema":{"type":"string","description":"Filter by performance_digest_frequency_days (comma-separated list). Fetches many records in one request instead of one request per id."},"required":false,"description":"Filter by performance_digest_frequency_days (comma-separated list). Fetches many records in one request instead of one request per id.","name":"filter[performance_digest_frequency_days.in]","in":"query"},{"schema":{"type":"string","description":"Filter by performance_digest_frequency_days (excluding a comma-separated list)"},"required":false,"description":"Filter by performance_digest_frequency_days (excluding a comma-separated list)","name":"filter[performance_digest_frequency_days.nin]","in":"query"},{"schema":{"type":"string","description":"Filter by created_at (exact match)."},"required":false,"description":"Filter by created_at (exact match).","name":"filter[created_at]","in":"query"},{"schema":{"type":"string","description":"Filter by created_at (greater than or equal)"},"required":false,"description":"Filter by created_at (greater than or equal)","name":"filter[created_at.gte]","in":"query"},{"schema":{"type":"string","description":"Filter by created_at (less than or equal)"},"required":false,"description":"Filter by created_at (less than or equal)","name":"filter[created_at.lte]","in":"query"},{"schema":{"type":"string","description":"Filter by updated_at (exact match)."},"required":false,"description":"Filter by updated_at (exact match).","name":"filter[updated_at]","in":"query"},{"schema":{"type":"string","description":"Filter by updated_at (greater than or equal)"},"required":false,"description":"Filter by updated_at (greater than or equal)","name":"filter[updated_at.gte]","in":"query"},{"schema":{"type":"string","description":"Filter by updated_at (less than or equal)"},"required":false,"description":"Filter by updated_at (less than or equal)","name":"filter[updated_at.lte]","in":"query"},{"schema":{"type":"string","description":"Sort field (prefix with - for descending)"},"required":false,"description":"Sort field (prefix with - for descending)","name":"sort","in":"query"}],"responses":{"200":{"description":"Successful response with paginated list","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"nullable":true}},"pagination":{"type":"object","properties":{"page":{"type":"integer","minimum":0,"exclusiveMinimum":true,"description":"Current page number"},"limit":{"type":"integer","minimum":0,"exclusiveMinimum":true,"description":"Items per page"},"total":{"type":"integer","description":"Total number of items"},"pages":{"type":"integer","description":"Total number of pages"}},"required":["page","limit","total","pages"]}},"required":["data","pagination"]}}}},"401":{"description":"Unauthorized - Authentication is required or has failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error401"}}}},"403":{"description":"Forbidden - You do not have permission to access this resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error403"}}}},"500":{"description":"Internal Server Error - An unexpected error occurred","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error500"}}}}}}}}}
```

## Create affiliates

> Create one or more affiliates (batch). Optionally assign them to programs via program\_ids.

```json
{"openapi":"3.0.3","info":{"title":"Spiffy API","version":"2.0.0"},"tags":[{"name":"affiliate-records","description":"Manage affiliates and check slug availability."}],"servers":[{"url":"https://api.spiffy.co","description":"Production"}],"security":[{"ApiKeyAuth":[]},{"OAuth2":["affiliates"]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"http","scheme":"bearer","bearerFormat":"API Key","description":"Account API key authentication. Pass an API key as a Bearer token in the `Authorization` header. An account may have multiple named keys; any of them grants full access to all endpoints — equivalent to all OAuth scopes."},"OAuth2":{"type":"oauth2","description":"OAuth 2.0 authentication for third-party integrations. Access is limited to the scopes granted by the merchant during authorization.","flows":{"authorizationCode":{"authorizationUrl":"https://app.spiffy.co/oauth/authorize","tokenUrl":"https://api.spiffy.co/oauth/token","refreshUrl":"https://api.spiffy.co/oauth/token","scopes":{"account":"Access account details and settings","users":"Manage users","customers":"Read and manage customers","checkouts":"Read and manage checkouts","subscriptions":"Read and manage subscriptions","subscription_metered_billing":"Manage metered billing for subscriptions","integrations":"Manage integrations","orders":"Read and manage orders","payments":"Read and manage payments","paymentplans":"Read and manage payment plans","webhooks":"Manage webhook endpoints and view event logs","promos":"Read and manage promotions and their codes","affiliates":"Read and manage affiliates and programs","products":"Read and manage products","analytics":"Read analytics data (revenue, orders, subscriptions, MRR)","reports":"Create, run, and read saved reports and their results"}}}}},"schemas":{"Error400":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["bad_request"]},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]},"Error401":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["unauthorized"]},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]},"Error403":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["forbidden"]},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]},"Error409":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["conflict"]},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]},"Error500":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["internal_error"]},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}},"paths":{"/v2/affiliates":{"post":{"tags":["affiliate-records"],"summary":"Create affiliates","description":"Create one or more affiliates (batch). Optionally assign them to programs via program_ids.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"affiliates":{"type":"array","items":{"type":"object","properties":{"name_first":{"type":"string"},"name_last":{"type":"string"},"email":{"type":"string"},"paypal_email":{"type":"string"},"slug":{"type":"string"}},"required":["name_first","name_last","email"]}},"program_ids":{"type":"array","items":{"type":"number"}}},"required":["affiliates"]}}}},"responses":{"201":{"description":"Created successfully","content":{"application/json":{"schema":{"nullable":true}}}},"400":{"description":"Bad Request - The request was invalid or malformed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error400"}}}},"401":{"description":"Unauthorized - Authentication is required or has failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error401"}}}},"403":{"description":"Forbidden - You do not have permission to access this resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error403"}}}},"409":{"description":"Conflict - The request conflicts with the current state of the resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error409"}}}},"500":{"description":"Internal Server Error - An unexpected error occurred","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error500"}}}}}}}}}
```

## Check slug availability for a new affiliate

> Check whether one or more affiliate slugs are available.

```json
{"openapi":"3.0.3","info":{"title":"Spiffy API","version":"2.0.0"},"tags":[{"name":"affiliate-records","description":"Manage affiliates and check slug availability."}],"servers":[{"url":"https://api.spiffy.co","description":"Production"}],"security":[{"ApiKeyAuth":[]},{"OAuth2":["affiliates"]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"http","scheme":"bearer","bearerFormat":"API Key","description":"Account API key authentication. Pass an API key as a Bearer token in the `Authorization` header. An account may have multiple named keys; any of them grants full access to all endpoints — equivalent to all OAuth scopes."},"OAuth2":{"type":"oauth2","description":"OAuth 2.0 authentication for third-party integrations. Access is limited to the scopes granted by the merchant during authorization.","flows":{"authorizationCode":{"authorizationUrl":"https://app.spiffy.co/oauth/authorize","tokenUrl":"https://api.spiffy.co/oauth/token","refreshUrl":"https://api.spiffy.co/oauth/token","scopes":{"account":"Access account details and settings","users":"Manage users","customers":"Read and manage customers","checkouts":"Read and manage checkouts","subscriptions":"Read and manage subscriptions","subscription_metered_billing":"Manage metered billing for subscriptions","integrations":"Manage integrations","orders":"Read and manage orders","payments":"Read and manage payments","paymentplans":"Read and manage payment plans","webhooks":"Manage webhook endpoints and view event logs","promos":"Read and manage promotions and their codes","affiliates":"Read and manage affiliates and programs","products":"Read and manage products","analytics":"Read analytics data (revenue, orders, subscriptions, MRR)","reports":"Create, run, and read saved reports and their results"}}}}},"schemas":{"Error400":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["bad_request"]},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]},"Error401":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["unauthorized"]},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]},"Error403":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["forbidden"]},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]},"Error500":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["internal_error"]},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}},"paths":{"/v2/affiliates/checkslugs":{"put":{"tags":["affiliate-records"],"summary":"Check slug availability for a new affiliate","description":"Check whether one or more affiliate slugs are available.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"slugs":{"type":"array","items":{"type":"string"}}},"required":["slugs"]}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"nullable":true}}}},"400":{"description":"Bad Request - The request was invalid or malformed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error400"}}}},"401":{"description":"Unauthorized - Authentication is required or has failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error401"}}}},"403":{"description":"Forbidden - You do not have permission to access this resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error403"}}}},"500":{"description":"Internal Server Error - An unexpected error occurred","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error500"}}}}}}}}}
```

## Add affiliates to a program

> Create one or more affiliates (batch) and add them to the program in the path. Existing affiliates matched by email are added to the program. program\_ids may list additional programs to add them to.

```json
{"openapi":"3.0.3","info":{"title":"Spiffy API","version":"2.0.0"},"tags":[{"name":"affiliate-records","description":"Manage affiliates and check slug availability."}],"servers":[{"url":"https://api.spiffy.co","description":"Production"}],"security":[{"ApiKeyAuth":[]},{"OAuth2":["affiliates"]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"http","scheme":"bearer","bearerFormat":"API Key","description":"Account API key authentication. Pass an API key as a Bearer token in the `Authorization` header. An account may have multiple named keys; any of them grants full access to all endpoints — equivalent to all OAuth scopes."},"OAuth2":{"type":"oauth2","description":"OAuth 2.0 authentication for third-party integrations. Access is limited to the scopes granted by the merchant during authorization.","flows":{"authorizationCode":{"authorizationUrl":"https://app.spiffy.co/oauth/authorize","tokenUrl":"https://api.spiffy.co/oauth/token","refreshUrl":"https://api.spiffy.co/oauth/token","scopes":{"account":"Access account details and settings","users":"Manage users","customers":"Read and manage customers","checkouts":"Read and manage checkouts","subscriptions":"Read and manage subscriptions","subscription_metered_billing":"Manage metered billing for subscriptions","integrations":"Manage integrations","orders":"Read and manage orders","payments":"Read and manage payments","paymentplans":"Read and manage payment plans","webhooks":"Manage webhook endpoints and view event logs","promos":"Read and manage promotions and their codes","affiliates":"Read and manage affiliates and programs","products":"Read and manage products","analytics":"Read analytics data (revenue, orders, subscriptions, MRR)","reports":"Create, run, and read saved reports and their results"}}}}},"schemas":{"Error400":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["bad_request"]},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]},"Error401":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["unauthorized"]},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]},"Error403":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["forbidden"]},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]},"Error404":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["not_found"]},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]},"Error409":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["conflict"]},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]},"Error500":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["internal_error"]},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}},"paths":{"/v2/affiliates/programs/{program_id}/affiliates":{"post":{"tags":["affiliate-records"],"summary":"Add affiliates to a program","description":"Create one or more affiliates (batch) and add them to the program in the path. Existing affiliates matched by email are added to the program. program_ids may list additional programs to add them to.","parameters":[{"schema":{"type":"string","description":"ID of the affiliate program to add the affiliates to"},"required":true,"description":"ID of the affiliate program to add the affiliates to","name":"program_id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"affiliates":{"type":"array","items":{"type":"object","properties":{"name_first":{"type":"string"},"name_last":{"type":"string"},"email":{"type":"string"},"paypal_email":{"type":"string"},"slug":{"type":"string"}},"required":["name_first","name_last","email"]}},"program_ids":{"type":"array","items":{"type":"number"}}},"required":["affiliates"]}}}},"responses":{"201":{"description":"Created successfully","content":{"application/json":{"schema":{"nullable":true}}}},"400":{"description":"Bad Request - The request was invalid or malformed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error400"}}}},"401":{"description":"Unauthorized - Authentication is required or has failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error401"}}}},"403":{"description":"Forbidden - You do not have permission to access this resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error403"}}}},"404":{"description":"Not Found - The requested resource does not exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error404"}}}},"409":{"description":"Conflict - The request conflicts with the current state of the resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error409"}}}},"500":{"description":"Internal Server Error - An unexpected error occurred","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error500"}}}}}}}}}
```

## Retrieve an affiliate

> Retrieve a single affiliates by ID

```json
{"openapi":"3.0.3","info":{"title":"Spiffy API","version":"2.0.0"},"tags":[{"name":"affiliate-records","description":"Manage affiliates and check slug availability."}],"servers":[{"url":"https://api.spiffy.co","description":"Production"}],"security":[{"ApiKeyAuth":[]},{"OAuth2":["affiliates"]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"http","scheme":"bearer","bearerFormat":"API Key","description":"Account API key authentication. Pass an API key as a Bearer token in the `Authorization` header. An account may have multiple named keys; any of them grants full access to all endpoints — equivalent to all OAuth scopes."},"OAuth2":{"type":"oauth2","description":"OAuth 2.0 authentication for third-party integrations. Access is limited to the scopes granted by the merchant during authorization.","flows":{"authorizationCode":{"authorizationUrl":"https://app.spiffy.co/oauth/authorize","tokenUrl":"https://api.spiffy.co/oauth/token","refreshUrl":"https://api.spiffy.co/oauth/token","scopes":{"account":"Access account details and settings","users":"Manage users","customers":"Read and manage customers","checkouts":"Read and manage checkouts","subscriptions":"Read and manage subscriptions","subscription_metered_billing":"Manage metered billing for subscriptions","integrations":"Manage integrations","orders":"Read and manage orders","payments":"Read and manage payments","paymentplans":"Read and manage payment plans","webhooks":"Manage webhook endpoints and view event logs","promos":"Read and manage promotions and their codes","affiliates":"Read and manage affiliates and programs","products":"Read and manage products","analytics":"Read analytics data (revenue, orders, subscriptions, MRR)","reports":"Create, run, and read saved reports and their results"}}}}},"schemas":{"Error401":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["unauthorized"]},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]},"Error403":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["forbidden"]},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]},"Error404":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["not_found"]},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]},"Error500":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["internal_error"]},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}},"paths":{"/v2/affiliates/{id}":{"get":{"tags":["affiliate-records"],"summary":"Retrieve an affiliate","description":"Retrieve a single affiliates by ID","parameters":[{"schema":{"type":"integer","minimum":0,"exclusiveMinimum":true,"description":"affiliates ID"},"required":true,"description":"affiliates ID","name":"id","in":"path"},{"schema":{"type":"string","description":"Comma-separated list of expansions: stats, gravatar, customer, cards"},"required":false,"description":"Comma-separated list of expansions: stats, gravatar, customer, cards","name":"include","in":"query"}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"integer"},"customer_id":{"type":"integer"},"paypal_email":{"type":"string","nullable":true,"maxLength":255},"slug":{"type":"string","nullable":true,"maxLength":255},"performance_digest_frequency_days":{"type":"integer","nullable":true},"last_performance_digest_sent_at":{"type":"string","nullable":true,"format":"date-time"},"is_ready_for_payout":{"type":"boolean"},"created_at":{"type":"string","nullable":true,"format":"date-time"},"updated_at":{"type":"string","nullable":true,"format":"date-time"},"customer":{"type":"object","nullable":true,"additionalProperties":{"nullable":true}},"stats":{"type":"object","nullable":true,"additionalProperties":{"nullable":true}},"gravatar":{"type":"string","nullable":true},"cards":{"type":"array","nullable":true,"items":{"type":"object","additionalProperties":{"nullable":true}}}},"required":["id","customer_id","is_ready_for_payout"]}}}},"401":{"description":"Unauthorized - Authentication is required or has failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error401"}}}},"403":{"description":"Forbidden - You do not have permission to access this resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error403"}}}},"404":{"description":"Not Found - The requested resource does not exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error404"}}}},"500":{"description":"Internal Server Error - An unexpected error occurred","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error500"}}}}}}}}}
```

## Update an affiliate

> Update affiliate fields such as email, name, paypal\_email, slug, payout readiness, and performance digest cadence.

```json
{"openapi":"3.0.3","info":{"title":"Spiffy API","version":"2.0.0"},"tags":[{"name":"affiliate-records","description":"Manage affiliates and check slug availability."}],"servers":[{"url":"https://api.spiffy.co","description":"Production"}],"security":[{"ApiKeyAuth":[]},{"OAuth2":["affiliates"]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"http","scheme":"bearer","bearerFormat":"API Key","description":"Account API key authentication. Pass an API key as a Bearer token in the `Authorization` header. An account may have multiple named keys; any of them grants full access to all endpoints — equivalent to all OAuth scopes."},"OAuth2":{"type":"oauth2","description":"OAuth 2.0 authentication for third-party integrations. Access is limited to the scopes granted by the merchant during authorization.","flows":{"authorizationCode":{"authorizationUrl":"https://app.spiffy.co/oauth/authorize","tokenUrl":"https://api.spiffy.co/oauth/token","refreshUrl":"https://api.spiffy.co/oauth/token","scopes":{"account":"Access account details and settings","users":"Manage users","customers":"Read and manage customers","checkouts":"Read and manage checkouts","subscriptions":"Read and manage subscriptions","subscription_metered_billing":"Manage metered billing for subscriptions","integrations":"Manage integrations","orders":"Read and manage orders","payments":"Read and manage payments","paymentplans":"Read and manage payment plans","webhooks":"Manage webhook endpoints and view event logs","promos":"Read and manage promotions and their codes","affiliates":"Read and manage affiliates and programs","products":"Read and manage products","analytics":"Read analytics data (revenue, orders, subscriptions, MRR)","reports":"Create, run, and read saved reports and their results"}}}}},"schemas":{"Error400":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["bad_request"]},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]},"Error401":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["unauthorized"]},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]},"Error403":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["forbidden"]},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]},"Error404":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["not_found"]},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]},"Error409":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["conflict"]},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]},"Error500":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["internal_error"]},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}},"paths":{"/v2/affiliates/{id}":{"put":{"tags":["affiliate-records"],"summary":"Update an affiliate","description":"Update affiliate fields such as email, name, paypal_email, slug, payout readiness, and performance digest cadence.","parameters":[{"schema":{"type":"string","description":"Affiliate ID"},"required":true,"description":"Affiliate ID","name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string"},"paypal_email":{"type":"string"},"name_first":{"type":"string"},"name_last":{"type":"string"},"slug":{"type":"string"},"is_ready_for_payout":{"type":"boolean"},"performance_digest_frequency_days":{"type":"integer","description":"How often this affiliate is emailed their performance digest, in days. One of 0, 1, 7, 30, where 0 means never. The affiliate can also change this themselves from their portal, so this is their current preference rather than a merchant-only setting."}}}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"integer"},"customer_id":{"type":"integer"},"paypal_email":{"type":"string","nullable":true,"maxLength":255},"slug":{"type":"string","nullable":true,"maxLength":255},"performance_digest_frequency_days":{"type":"integer","nullable":true},"last_performance_digest_sent_at":{"type":"string","nullable":true,"format":"date-time"},"is_ready_for_payout":{"type":"boolean"},"created_at":{"type":"string","nullable":true,"format":"date-time"},"updated_at":{"type":"string","nullable":true,"format":"date-time"},"customer":{"type":"object","nullable":true,"additionalProperties":{"nullable":true}},"stats":{"type":"object","nullable":true,"additionalProperties":{"nullable":true}},"gravatar":{"type":"string","nullable":true},"cards":{"type":"array","nullable":true,"items":{"type":"object","additionalProperties":{"nullable":true}}}},"required":["id","customer_id","is_ready_for_payout"]}}}},"400":{"description":"Bad Request - The request was invalid or malformed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error400"}}}},"401":{"description":"Unauthorized - Authentication is required or has failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error401"}}}},"403":{"description":"Forbidden - You do not have permission to access this resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error403"}}}},"404":{"description":"Not Found - The requested resource does not exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error404"}}}},"409":{"description":"Conflict - The request conflicts with the current state of the resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error409"}}}},"500":{"description":"Internal Server Error - An unexpected error occurred","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error500"}}}}}}}}}
```

## Check slug availability for an existing affiliate

> Check whether one or more affiliate slugs are available.

```json
{"openapi":"3.0.3","info":{"title":"Spiffy API","version":"2.0.0"},"tags":[{"name":"affiliate-records","description":"Manage affiliates and check slug availability."}],"servers":[{"url":"https://api.spiffy.co","description":"Production"}],"security":[{"ApiKeyAuth":[]},{"OAuth2":["affiliates"]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"http","scheme":"bearer","bearerFormat":"API Key","description":"Account API key authentication. Pass an API key as a Bearer token in the `Authorization` header. An account may have multiple named keys; any of them grants full access to all endpoints — equivalent to all OAuth scopes."},"OAuth2":{"type":"oauth2","description":"OAuth 2.0 authentication for third-party integrations. Access is limited to the scopes granted by the merchant during authorization.","flows":{"authorizationCode":{"authorizationUrl":"https://app.spiffy.co/oauth/authorize","tokenUrl":"https://api.spiffy.co/oauth/token","refreshUrl":"https://api.spiffy.co/oauth/token","scopes":{"account":"Access account details and settings","users":"Manage users","customers":"Read and manage customers","checkouts":"Read and manage checkouts","subscriptions":"Read and manage subscriptions","subscription_metered_billing":"Manage metered billing for subscriptions","integrations":"Manage integrations","orders":"Read and manage orders","payments":"Read and manage payments","paymentplans":"Read and manage payment plans","webhooks":"Manage webhook endpoints and view event logs","promos":"Read and manage promotions and their codes","affiliates":"Read and manage affiliates and programs","products":"Read and manage products","analytics":"Read analytics data (revenue, orders, subscriptions, MRR)","reports":"Create, run, and read saved reports and their results"}}}}},"schemas":{"Error400":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["bad_request"]},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]},"Error401":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["unauthorized"]},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]},"Error403":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["forbidden"]},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]},"Error500":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["internal_error"]},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}},"paths":{"/v2/affiliates/{id}/checkslugs":{"put":{"tags":["affiliate-records"],"summary":"Check slug availability for an existing affiliate","description":"Check whether one or more affiliate slugs are available.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"slugs":{"type":"array","items":{"type":"string"}}},"required":["slugs"]}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"nullable":true}}}},"400":{"description":"Bad Request - The request was invalid or malformed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error400"}}}},"401":{"description":"Unauthorized - Authentication is required or has failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error401"}}}},"403":{"description":"Forbidden - You do not have permission to access this resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error403"}}}},"500":{"description":"Internal Server Error - An unexpected error occurred","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error500"}}}}}}}}}
```
