# Affixo - [Introduction](https://docs.affixo.dev/introduction.md): The Affixo API for affiliate program management and conversion tracking. - [Authentication](https://docs.affixo.dev/authentication.md): Bearer tokens, scopes, and how requests are authorized. - [Errors and limits](https://docs.affixo.dev/errors-and-limits.md): Every error the API returns, what its body looks like, and the limits that can return 429. - [Integrate Affixo tracking](https://docs.affixo.dev/integrate.md): Three code snippets, three different pages. This guide tells you exactly what to add, where, and why, including copy-paste examples for the most common platforms. - [Connect any payment processor](https://docs.affixo.dev/connect-any-processor.md): A step-by-step guide for merchants who take payments outside Stripe: report sales, refunds and disputes from your server, with recipes for PayPal, Square, Paddle, Lemon Squeezy and WooCommerce. - [sa.js reference](https://docs.affixo.dev/sa-js.md): What the tracking snippet reads from the page, and the window.Affixo functions you can call. - [Server-side tracking](https://docs.affixo.dev/tracking-overview.md): Record clicks and conversions directly from your backend. - [How attribution works](https://docs.affixo.dev/attribution.md): The precedence-ordered methods Affixo uses to credit a conversion to the right affiliate. - [Attribution Recovery](https://docs.affixo.dev/attribution-recovery.md): Sales that were never tracked can still be credited to the affiliate who earned them, after the fact. - [Vibe coding](https://docs.affixo.dev/vibe-coding.md): Built your app with an AI builder like Lovable, Bolt, v0, or Cursor? Add Affixo affiliate tracking by pasting one prompt, no manual code needed. - [Lovable](https://docs.affixo.dev/vibe/lovable.md): Add Affixo affiliate tracking to a Lovable app by pasting one prompt. - [Bolt](https://docs.affixo.dev/vibe/bolt.md): Add Affixo affiliate tracking to a Bolt app by pasting one prompt. - [v0](https://docs.affixo.dev/vibe/v0.md): Add Affixo affiliate tracking to a v0 (Next.js) app by pasting one prompt. - [Replit](https://docs.affixo.dev/vibe/replit.md): Add Affixo affiliate tracking to a Replit app by pasting one prompt into Replit Agent. - [Base44](https://docs.affixo.dev/vibe/base44.md): Add Affixo affiliate tracking to a Base44 app by pasting one prompt. - [Cursor](https://docs.affixo.dev/vibe/cursor.md): Add Affixo affiliate tracking with a Cursor prompt, or connect the Affixo MCP server. - [Windsurf](https://docs.affixo.dev/vibe/windsurf.md): Add Affixo affiliate tracking with a Windsurf prompt, or connect the Affixo MCP server. - [Claude Code](https://docs.affixo.dev/vibe/claude-code.md): Add Affixo affiliate tracking with a Claude Code prompt, or connect the Affixo MCP server. - [Claude.ai](https://docs.affixo.dev/vibe/claude-web.md): Add Affixo affiliate tracking with a Claude prompt. Claude writes the code, you paste it into your site. - [Codex](https://docs.affixo.dev/vibe/codex.md): Add Affixo affiliate tracking with an OpenAI Codex prompt, or connect the Affixo MCP server. - [Gemini CLI](https://docs.affixo.dev/vibe/gemini-cli.md): Add Affixo affiliate tracking with a Gemini CLI prompt, or connect the Affixo MCP server. - [VS Code Copilot](https://docs.affixo.dev/vibe/copilot.md): Add Affixo affiliate tracking with a GitHub Copilot prompt in VS Code, or add the Affixo MCP server in one click. - [Campaigns](https://docs.affixo.dev/campaigns.md): Who can join a campaign, how the default campaign works, adding affiliates, and what pausing does. - [Moving referrals and correcting sales](https://docs.affixo.dev/moving-referrals.md): Give a customer to another affiliate, fix one sale that went to the wrong person, and what your webhooks see when commissions change hands. - [Sub-affiliates (two-tier programs)](https://docs.affixo.dev/sub-affiliates.md): Let your affiliates recruit other affiliates and earn an override on their sales. - [Webhooks](https://docs.affixo.dev/webhooks.md): Receive real-time events, verify signatures, and understand delivery retries - [MCP Server](https://docs.affixo.dev/mcp-server.md): Manage your Affixo program from Claude, Cursor, or any MCP client, one-click, no install. - [Example queries](https://docs.affixo.dev/mcp/examples.md): What to actually ask once the Affixo MCP connector is loaded. - [Cursor](https://docs.affixo.dev/mcp/setup/cursor.md): Add the Affixo MCP connector to Cursor in one click, no API key, no config file. - [VS Code](https://docs.affixo.dev/mcp/setup/vscode.md): Add the Affixo MCP connector to VS Code in one click, no API key, no config file. - [Claude Code](https://docs.affixo.dev/mcp/setup/claude-code.md): Add the Affixo MCP connector to Claude Code with one command. - [Codex](https://docs.affixo.dev/mcp/setup/codex.md): Add the Affixo MCP connector to Codex with two commands: register, then sign in. - [Gemini CLI](https://docs.affixo.dev/mcp/setup/gemini.md): Add the Affixo MCP connector to Gemini CLI with one command. - [Claude](https://docs.affixo.dev/mcp/setup/claude.md): Add the Affixo MCP connector to Claude on web, desktop and mobile. - [ChatGPT](https://docs.affixo.dev/mcp/setup/chatgpt.md): Add the Affixo MCP connector to ChatGPT as a custom connector. - [List affiliates](https://docs.affixo.dev/api-reference/affiliates/list-affiliates.md) - [Create an affiliate](https://docs.affixo.dev/api-reference/affiliates/create-an-affiliate.md): Requires `write` (or `*`) scope. One of `email` or `name` is required. - [Invite an affiliate by email](https://docs.affixo.dev/api-reference/affiliates/invite-an-affiliate-by-email.md): Idempotent on email: re-inviting an existing affiliate returns the same record. Mints a unique ref_code variant on collision. New affiliates land in `pending` for admin approval, unless the program auto-approves signups, in which case they land in `active` immediately (check the returned `status`).… - [Get an affiliate](https://docs.affixo.dev/api-reference/affiliates/get-an-affiliate.md) - [Update an affiliate](https://docs.affixo.dev/api-reference/affiliates/update-an-affiliate.md): Update status, name, or email. Requires `write` scope. - [List referral links](https://docs.affixo.dev/api-reference/links/list-referral-links.md) - [Create a referral link](https://docs.affixo.dev/api-reference/links/create-a-referral-link.md): Requires `write` (or `*`) scope. The affiliate must belong to the key's workspace. - [List campaigns](https://docs.affixo.dev/api-reference/resources/list-campaigns.md): A page of campaigns. To keep the list light, each row leaves out `destination_url` and `additional_referral_links`. Fetch one campaign with GET /v1/campaigns/{id} to read them. The setup tester's own campaign is left out unless `include_test=true`. Requires `read` scope. - [List conversions](https://docs.affixo.dev/api-reference/resources/list-conversions.md) - [List payouts](https://docs.affixo.dev/api-reference/resources/list-payouts.md) - [Create a campaign](https://docs.affixo.dev/api-reference/campaigns/create-a-campaign.md): Requires `write` (or `*`) scope. - [Get a campaign](https://docs.affixo.dev/api-reference/campaigns/get-a-campaign.md) - [Update a campaign](https://docs.affixo.dev/api-reference/campaigns/update-a-campaign.md): Requires `write` (or `*`) scope. - [List a campaign's memberships](https://docs.affixo.dev/api-reference/campaigns/list-a-campaigns-memberships.md): Who is in a campaign, by membership status. A `pending` membership comes from `auto_enrol` on a campaign where you approve each affiliate: until you approve it, that affiliate's sales through this campaign earn their main campaign's rate. Test affiliates are left out unless `include_test=true`. Requ… - [Approve or decline a pending membership](https://docs.affixo.dev/api-reference/campaigns/approve-or-decline-a-pending-membership.md): The campaign's review queue. Only a `pending` membership can be decided. `approve` makes it active: new sales through this campaign earn its rate, and earlier sales keep theirs. `decline` removes the pending membership. Requires `write` scope. - [Get a campaign's commission rule](https://docs.affixo.dev/api-reference/campaigns/get-a-campaigns-commission-rule.md): The promoter-side reward (the rate affiliates earn); `data` is null when none is set. - [Set a campaign's commission rule](https://docs.affixo.dev/api-reference/campaigns/set-a-campaigns-commission-rule.md): A campaign carries multiple rules. With no scope this creates/updates the campaign's **catch-all** rule; `product_ids` scopes the rule to those Stripe products; `billing_interval` scopes it to a billing cadence (one scope type per rule). Conversion-time precedence: product → interval → catch-all → n… - [Remove a campaign's commission rule](https://docs.affixo.dev/api-reference/campaigns/remove-a-campaigns-commission-rule.md): Deletes the catch-all rule, or a scoped rule when `product_ids` / `billing_interval` identify one. Requires `write` (or `*`) scope. - [Get a campaign's sub-affiliate override](https://docs.affixo.dev/api-reference/campaigns/get-a-campaigns-sub-affiliate-override.md): The two-tier override paid to a recruiting affiliate when one of their recruits makes a sale. `data` is null when none is set. - [Set a campaign's sub-affiliate override](https://docs.affixo.dev/api-reference/campaigns/set-a-campaigns-sub-affiliate-override.md): Creates or updates the campaign's single sub-affiliate override: the commission a recruiting affiliate earns on top of their recruit's own commission. It does not change the rate affiliates earn on their own sales (use the commission-rule endpoint for that). - [Remove a campaign's sub-affiliate override](https://docs.affixo.dev/api-reference/campaigns/remove-a-campaigns-sub-affiliate-override.md): Recruiters stop earning on their recruits' future sales in this campaign. Commission history is untouched. Requires `write` scope. - [List the reward library](https://docs.affixo.dev/api-reference/campaigns/list-the-reward-library.md): Reusable reward templates (cash and non-cash) authored once and applied to campaign rates via PUT /v1/campaigns/{id}/commission-rule with `library_reward_id`. Each entry carries its terms and `used_by_campaigns`. Query: `limit` (default 100, cap 200), `offset`, `include_archived`. Read scope. - [List the product catalog](https://docs.affixo.dev/api-reference/products/list-the-product-catalog.md): The workspace's products (Stripe-synced + manual) with prices and the per-product commission mapping (`commissionable`, `campaign_id`), plus the workspace catch-all policy for uncataloged products (`commission_unmapped_products`). Query: `q` (name / Stripe id substring), `include_archived`, `limit`,… - [Register a product by your own id](https://docs.affixo.dev/api-reference/products/register-a-product-by-your-own-id.md): For workspaces that don't use Stripe. Registers a product under the id your own system uses, so you can give it its own commission rate or switch commissions off for it. Requires `write` scope. A workspace whose plan is restricted gets `402 plan_restricted`. Registering a product doesn't change what… - [Get a product](https://docs.affixo.dev/api-reference/products/get-a-product.md): `id` accepts the Affixo product uuid, the Stripe product id (prod_…), or your own product id if you don't use Stripe. - [Set a product's commission mapping](https://docs.affixo.dev/api-reference/products/set-a-products-commission-mapping.md): `commissionable: false` means sales of this product never earn a commission; a non-null `campaign_id` makes its sales earn THAT campaign's rate regardless of which link drove the sale. Requires `write` (or `*`) scope. Configuration only. It never moves money. A `prod_…` id not yet in the catalog is… - [Get the uncataloged-products commission policy](https://docs.affixo.dev/api-reference/products/get-the-uncataloged-products-commission-policy.md): Whether sales of products NOT in the catalog still earn the campaign default rate (`commission_unmapped_products`). Requires `read` scope. - [Set the uncataloged-products commission policy](https://docs.affixo.dev/api-reference/products/set-the-uncataloged-products-commission-policy.md): Whether sales of products NOT in the catalog still earn the campaign default rate (`commission_unmapped_products`). Requires `write` scope. - [Re-sync the product catalog from Stripe](https://docs.affixo.dev/api-reference/products/re-sync-the-product-catalog-from-stripe.md): Runs the same full catalog sync as the Re-sync button on the Products page, against the workspace's connected Stripe account. Products with at least one active price are added or refreshed with their prices; Stripe-synced products that were archived in Stripe or lost their last price are deactivated… - [List commissions](https://docs.affixo.dev/api-reference/commissions/list-commissions.md) - [Get a commission](https://docs.affixo.dev/api-reference/commissions/get-a-commission.md) - [Approve, deny, or adjust a commission](https://docs.affixo.dev/api-reference/commissions/approve-deny-or-adjust-a-commission.md): Approve or deny a commission, or override its amount, with the same rules as the dashboard. Approving a commission whose sale is in the current month keeps it `pending` until that month closes, then it becomes `confirmed` (payable). Imported history and sales from a closed month become `confirmed` a… - [Quote a commission](https://docs.affixo.dev/api-reference/commissions/quote-a-commission.md): What an affiliate would earn on a sale, without recording it. The quote runs the real commission engine on a simulated sale and then discards it, so it follows the affiliate's rate override, product and billing interval rules, the campaign default and holds. Nothing is written, emailed or paid. Requ… - [Preview moving a referral](https://docs.affixo.dev/api-reference/referrals/preview-moving-a-referral.md): What moving a referral (a referred customer) to another affiliate would do, exactly as the dashboard's Move dialog shows it. Nothing changes. Name the customer by `referral_id`, or by any of their sales with `conversion_id` (for example an id from GET /v1/conversions). A new affiliate who can't take… - [Move a referral to another affiliate](https://docs.affixo.dev/api-reference/referrals/move-a-referral-to-another-affiliate.md): Move a referred customer to another affiliate, with the same rules as the move in the dashboard. Requires `write` scope. Preview it first with POST /v1/referrals/move/preview. - [Send a test referral](https://docs.affixo.dev/api-reference/referrals/send-a-test-referral.md): Records one test signup or test sale, like "Send a test referral" in the dashboard, so you can check your setup without real traffic. It always goes to your workspace's test affiliate and is marked as test data, so it never reaches payouts, risk checks, alerts, emails or reports. A test sale earns a… - [Get a conversion](https://docs.affixo.dev/api-reference/conversions/get-a-conversion.md) - [Re-attribute or update a conversion](https://docs.affixo.dev/api-reference/conversions/re-attribute-or-update-a-conversion.md): Move this one sale to a different affiliate, or update the conversion status. Requires `write` scope. - [List webhook endpoints](https://docs.affixo.dev/api-reference/webhooks/list-webhook-endpoints.md) - [Create a webhook endpoint](https://docs.affixo.dev/api-reference/webhooks/create-a-webhook-endpoint.md): Creates a new webhook subscription. The signing `secret` is returned **only in this response**. Store it immediately. Requires `write` scope. - [Get a webhook endpoint](https://docs.affixo.dev/api-reference/webhooks/get-a-webhook-endpoint.md) - [Delete a webhook endpoint](https://docs.affixo.dev/api-reference/webhooks/delete-a-webhook-endpoint.md): Permanently removes the endpoint and stops all future deliveries. Requires `write` scope. - [Update a webhook endpoint](https://docs.affixo.dev/api-reference/webhooks/update-a-webhook-endpoint.md): Requires `write` scope. - [Get a report](https://docs.affixo.dev/api-reference/reports/get-a-report.md): Returns aggregated data for the specified report type: - `overview`: workspace-level KPIs - `affiliates`: per-affiliate breakdown - `campaigns`: per-campaign breakdown (conversions, revenue, and non-reversed commission totals with the pending share broken out). The setup tester's own campaign is… - [List AI risk assessments](https://docs.affixo.dev/api-reference/risk/list-ai-risk-assessments.md): The workspace's most recent AI risk assessments, newest first, with the affiliate embedded. Requires `read` (or `*`) scope. Buyer-side signals read as a single `buyer_risk` flag, and test affiliates are left out unless `include_test=true`. - [Track a click](https://docs.affixo.dev/api-reference/tracking/track-a-click.md): Server-to-server click. Requires `track` (or `*`) scope. `ref` is required and matches whatever its case. A click on a paused or archived campaign, or on the link of an archived affiliate, still returns `ok: true` (so the visitor's journey never breaks) but logs no click and credits no one. MCP conn… - [Track a lead](https://docs.affixo.dev/api-reference/tracking/track-a-lead.md): Server-to-server lead/signup conversion. Requires `track` (or `*`) scope. MCP connector tokens get `403 insufficient_scope`. A lead ignores money fields and product fields. It may carry `subscription_id` and `customer_id`, which later sales with the same ids follow back to the affiliate. When it doe… - [Track a sale](https://docs.affixo.dev/api-reference/tracking/track-a-sale.md): Server-to-server sale conversion, for merchants who take payment outside Stripe. Requires `track` (or `*`) scope. MCP connector tokens get `403 insufficient_scope`. - [Refund a sale](https://docs.affixo.dev/api-reference/tracking/refund-a-sale.md): Refunds the sale recorded under `external_id`, which is required, and shrinks or claws back its commission. Send `refunded_amount` (major units) or `refunded_amount_cents` (minor units, converted in the sale's currency) as the TOTAL refunded so far on that order, not the amount of this one refund. I… - [Record a chargeback](https://docs.affixo.dev/api-reference/tracking/record-a-chargeback.md): Reverses the commission on the sale recorded under `external_id` as soon as the dispute opens, with status `chargeback`. Safe to retry. If you win the dispute, call `dispute_won`. A chargeback reported this way never goes to any shared buyer risk list. MCP connector tokens get `403 insufficient_scop… - [Record a won dispute](https://docs.affixo.dev/api-reference/tracking/record-a-won-dispute.md): Restores the commission to what it was before the chargeback, so an earlier partial refund still counts and a fully refunded order stays refunded. Calling it when there was no chargeback is harmless and returns `restored: false`. MCP connector tokens get `403 insufficient_scope`. ## OpenAPI Specs - [openapi](/openapi.yaml) This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.