HeldSway

HeldSway REST API — Overview

Manage affiliates, referral links, commission rules, tracked orders, reports, payouts, and business settings programmatically with the HeldSway REST API.


Base URL

All REST API endpoints are prefixed with the API base URL:

https://api.heldsway.com/api/v1

All requests must use HTTPS. In this documentation, paths are specified relative to this base URL (for example, GET /affiliates resolves to https://api.heldsway.com/api/v1/affiliates).


Authentication & Scopes

All endpoints (except Token Issuance POST /v1/auth/token) require a valid Bearer access token in the HTTP Authorization header:

Authorization: Bearer <access_token>

Bearer tokens are obtained via the Token Issuance endpoint using your business’s api_key and api_secret.

Available Scopes

Scope Description
affiliates:read List and view affiliates, referral links, affiliate stats, link stats, and commission overrides
affiliates:write Create, update, delete, approve, suspend, reactivate affiliates, and create single or bulk referral links
orders:read List, search, retrieve conversion details, view conversion statistics, and export orders
orders:write Approve, reject, and bulk-moderate conversion commissions
reports:read Query aggregate statistics, commission charts, top affiliates, clicks by campaign, multidimensional analytics, and coupon reports
settings:read View business settings, portal branding, commission tiers, and payout configuration
settings:write Update business settings, branding, commission tiers, and payout configuration
payouts:read List payouts, payout requests, aggregate statistics, CSV exports, and download PDF payout statements
payouts:write Transition payout status (processing, complete, fail), run bulk payouts, and approve/reject affiliate payout requests
connections:read Retrieve business integration connection status
connections:write Disconnect business platform integrations

Standard Response Envelope

All API responses follow a consistent JSON envelope format.

Success Response Format

{
  "success": true,
  "message": "Resource retrieved successfully.",
  "data": { ... },
  "meta": {
    "current_page": 1,
    "last_page": 5,
    "per_page": 20,
    "total": 92
  }
}

Error Response Format

{
  "success": false,
  "error": {
    "code": "VALIDATION_FAILED",
    "message": "The given data was invalid.",
    "details": {
      "email": ["The email has already been taken."]
    }
  }
}

Rate Limits

To guarantee service reliability, requests are throttled per API key or client IP:

Category Default Throttle Typical Endpoints
Standard Reads 120 req / min List & detail endpoints (GET /affiliates, GET /orders, etc.)
Mutations / Writes 60 req / min Create, update, delete, approve, reject actions
Batch / Exports 30 req / min CSV reports and statement downloads (GET /orders/export, etc.)
Partner Endpoints 10 req / min Partner registration and credential management

When a throttle limit is reached, the API returns 429 Too Many Requests with a Retry-After: <seconds> response header.


Error Codes

HTTP Status Error Code Description
400 BAD_REQUEST Malformed request syntax or unparseable JSON payload
401 UNAUTHORIZED Missing or invalid Bearer access token
402 SUBSCRIPTION_REQUIRED An active subscription is required to access this endpoint
403 FORBIDDEN Missing required scope or access to resource is restricted
404 NOT_FOUND The requested resource does not exist
409 CONFLICT Resource conflict (e.g. invalid status transition)
422 VALIDATION_FAILED Payload validation failed; check the details field
429 TOO_MANY_REQUESTS Rate limit exceeded
500 INTERNAL_SERVER_ERROR An unexpected server error occurred
503 SERVICE_UNAVAILABLE System maintenance or upstream provider temporarily unreachable

Quick Reference Index

The HeldSway REST API exposes 60 dedicated endpoints across 10 functional modules:

1. Authentication

Method Path Scope Throttle Description Docs
POST /v1/auth/token None 120/min Exchange API key & secret for Bearer token View Guide

2. Affiliates

Method Path Scope Throttle Description Docs
GET /v1/affiliates affiliates:read 120/min List affiliates with filtering and pagination View Guide
GET /v1/affiliates/stats affiliates:read 120/min Aggregate affiliate counts by status View Guide
GET /v1/affiliates/export affiliates:read 30/min Export affiliates directory as CSV View Guide
GET /v1/affiliates/{id} affiliates:read 120/min Retrieve a single affiliate by ID View Guide
GET /v1/affiliates/{id}/stats affiliates:read 120/min Performance metrics for an individual affiliate View Guide
POST /v1/affiliates affiliates:write 60/min Create a new affiliate View Guide
PUT /v1/affiliates/{id} affiliates:write 60/min Update affiliate profile or payout settings View Guide
DELETE /v1/affiliates/{id} affiliates:write 60/min Delete an affiliate record View Guide
POST /v1/affiliates/{id}/approve affiliates:write 60/min Approve a pending affiliate application View Guide
POST /v1/affiliates/{id}/suspend affiliates:write 60/min Temporarily suspend an affiliate View Guide
POST /v1/affiliates/{id}/reactivate affiliates:write 60/min Reactivate a suspended affiliate View Guide
POST /v1/affiliates/{id}/terminate affiliates:write 60/min Permanently terminate an affiliate View Guide
Method Path Scope Throttle Description Docs
GET /v1/links affiliates:read 120/min List all referral links View Guide
GET /v1/links/stats affiliates:read 120/min Aggregate referral link statistics View Guide
GET /v1/affiliates/{id}/links affiliates:read 120/min List links for a specific affiliate View Guide
POST /v1/affiliates/{id}/links affiliates:write 60/min Create a referral link for an affiliate View Guide
POST /v1/affiliates/{id}/links?bulk_create=true affiliates:write 60/min Bulk create links for single affiliate View Guide
POST /v1/links/bulk-all-affiliates affiliates:write 60/min Bulk create links across all active affiliates View Guide
GET /v1/affiliates/{id}/link-batches/{batchId} affiliates:read 120/min Poll single-affiliate link batch status View Guide
GET /v1/link-batches/{batchId} affiliates:read 120/min Poll unified link batch generation status View Guide
DELETE /v1/links/{id} affiliates:write 60/min Delete a referral link View Guide
POST /v1/links/{id}/status affiliates:write 60/min Activate or deactivate a referral link View Guide
POST /v1/links/{id}/coupon affiliates:write 60/min Attach coupon discount to a link View Guide
POST /v1/links/bulk-delete affiliates:write 60/min Bulk delete referral links View Guide

4. Commission Configuration

Method Path Scope Throttle Description Docs
GET /v1/affiliates/{id}/commission affiliates:read 120/min Get affiliate commission configuration View Guide
PUT /v1/affiliates/{id}/commission affiliates:write 60/min Set or clear custom affiliate commission override View Guide
GET /v1/links/{id}/commission-rules affiliates:read 120/min List custom commission rules for a link View Guide
POST /v1/links/{id}/commission-rules affiliates:write 60/min Create a custom link commission rule View Guide
PATCH /v1/links/{linkId}/commission-rules/{ruleId} affiliates:write 60/min Update a custom commission rule View Guide
DELETE /v1/links/{linkId}/commission-rules/{ruleId} affiliates:write 60/min Delete a link commission rule View Guide

5. Orders & Conversions

Method Path Scope Throttle Description Docs
GET /v1/orders orders:read 120/min List conversions with filtering, search & store locations View Guide
GET /v1/orders/stats orders:read 120/min Aggregate conversion statistics (revenue, commission, counts) View Guide
GET /v1/orders/{id} orders:read 120/min Get conversion details with line items and attribution View Guide
POST /v1/orders/{id}/approve orders:write 60/min Approve a pending order commission View Guide
POST /v1/orders/{id}/reject orders:write 60/min Reject a pending order commission View Guide
POST /v1/orders/bulk-approve orders:write 60/min Bulk approve pending commissions View Guide
POST /v1/orders/bulk-reject orders:write 60/min Bulk reject pending commissions View Guide
GET /v1/orders/export orders:read 30/min Export conversions table as CSV View Guide

6. Reports & Analytics

Method Path Scope Throttle Description Docs
GET /v1/reports/stats reports:read 120/min Summary stat cards with percentage trends View Guide
GET /v1/reports/commission-chart reports:read 120/min Commission chart series over time View Guide
GET /v1/reports/top-affiliates reports:read 120/min Top performing affiliates ranked by earnings View Guide
GET /v1/reports/clicks-by-campaign reports:read 120/min Click distribution grouped by campaign tag View Guide
GET /v1/affiliate/analytics reports:read 120/min Multi-dimensional analytics query engine View Guide
GET /v1/reports/payouts reports:read 120/min Payout report history View Guide
GET /v1/reports/export reports:read 30/min Export performance metrics as CSV View Guide

7. Coupon Reports

Method Path Scope Throttle Description Docs
GET /v1/reports/coupons/stats reports:read 120/min Coupon summary metrics with period trends View Guide
GET /v1/reports/coupons/redemptions-chart reports:read 120/min Daily coupon redemption time series View Guide
GET /v1/reports/coupons/top reports:read 120/min Top coupons ranked by generated revenue View Guide
GET /v1/reports/coupons/performance reports:read 120/min Paginated coupon performance breakdown View Guide
GET /v1/reports/coupons/{id}/conversions reports:read 120/min Conversions generated by a specific coupon View Guide
GET /v1/reports/coupons/links reports:read 120/min Referral links attached to coupons View Guide
GET /v1/reports/coupons/export reports:read 30/min Export coupon report as CSV View Guide

8. Payouts Management

Method Path Scope Throttle Description Docs
GET /v1/payouts payouts:read 120/min List payouts with filters and pagination View Guide
GET /v1/payouts/stats payouts:read 120/min Aggregate payout statistics View Guide
GET /v1/payouts/requests payouts:read 120/min List affiliate early payout requests View Guide
GET /v1/payouts/export payouts:read 30/min Export payouts table as CSV View Guide
GET /v1/payouts/{id} payouts:read 120/min Get payout details with conversion items View Guide
GET /v1/payouts/{id}/statement payouts:read 30/min Download branded PDF payout statement View Guide
POST /v1/payouts/{id}/processing payouts:write 60/min Move payout to processing state View Guide
POST /v1/payouts/{id}/complete payouts:write 60/min Finalize payout as completed View Guide
POST /v1/payouts/{id}/fail payouts:write 60/min Mark payout as failed View Guide
POST /v1/payouts/bulk-processing payouts:write 60/min Bulk move payouts to processing View Guide
POST /v1/payouts/bulk-complete payouts:write 60/min Bulk complete payouts View Guide
POST /v1/payouts/requests/{id}/approve payouts:write 60/min Approve affiliate payout request View Guide
POST /v1/payouts/requests/{id}/reject payouts:write 60/min Reject affiliate payout request View Guide

9. Business Settings

Method Path Scope Throttle Description Docs
GET /v1/settings settings:read 120/min Get all program settings View Guide
PUT /v1/settings settings:write 60/min Bulk update program settings View Guide
GET /v1/settings/{key} settings:read 120/min Get single program setting View Guide
PUT /v1/settings/{key} settings:write 60/min Update single program setting View Guide
GET /v1/settings/branding settings:read 120/min Get portal branding and logo assets View Guide
PUT /v1/settings/branding settings:write 60/min Update portal branding View Guide
GET /v1/settings/commission-tiers settings:read 120/min Get tiered commission levels View Guide
POST /v1/settings/commission-tiers settings:write 60/min Create commission tier View Guide
PUT /v1/settings/commission-tiers/{id} settings:write 60/min Update commission tier View Guide
DELETE /v1/settings/commission-tiers/{id} settings:write 60/min Delete commission tier View Guide
POST /v1/settings/commission-tiers/reset settings:write 60/min Reset tiers to platform defaults View Guide
GET /v1/settings/payouts settings:read 120/min Get payout frequency and minimum threshold View Guide
PUT /v1/settings/payouts settings:write 60/min Update payout schedule and parameters View Guide

10. Business Connection

Method Path Scope Throttle Description Docs
GET /v1/connection/status connections:read 120/min Retrieve integration connection status View Guide
POST /v1/connection/disconnect connections:write 60/min Disconnect business platform integration View Guide

Data Models

Affiliate Object

{
  "id": "aff_01HXYZ123456",
  "business_id": "biz_01HABC987654",
  "user_id": "usr_01HJ789012",
  "name": "Jane Doe",
  "email": "jane@example.com",
  "status": "active",
  "commission_rate": null,
  "commission_type": null,
  "payment_method": "paypal",
  "payment_details": {
    "paypal_email": "jane@example.com"
  },
  "created_at": "2026-04-01T12:00:00Z",
  "updated_at": "2026-04-10T08:30:00Z"
}
{
  "id": "lnk_01HXYZ789012",
  "affiliate_id": "aff_01HXYZ123456",
  "business_id": "biz_01HABC987654",
  "slug": "jane-spring",
  "url": "https://store.example.com?ref=jane-spring",
  "destination_url": "https://store.example.com/spring-sale",
  "campaign": "Spring2026",
  "is_active": true,
  "coupon_code": "JANE10",
  "clicks_count": 1420,
  "conversions_count": 89,
  "created_at": "2026-04-01T12:00:00Z"
}

Order / Conversion Object

{
  "id": "ord_01HDEF345678",
  "business_id": "biz_01HABC987654",
  "affiliate_id": "aff_01HXYZ123456",
  "link_id": "lnk_01HXYZ789012",
  "order_number": "ORDER-99812",
  "amount": 120.00,
  "currency": "USD",
  "commission_amount": 12.00,
  "commission_rate": 10.0,
  "commission_status": "pending",
  "location_id": "loc_nyc_01",
  "location_name": "Manhattan Flagship",
  "product_id": "prod_camera_x1",
  "product_name": "Professional 4K Camera",
  "customer_id": "cust_88219",
  "created_at": "2026-04-15T14:22:10Z"
}