Developer docs

API and embeds

Three small building blocks. Most programs only ever need the first one.

1. Tracking snippet

Add this once to your site. It stores the referral, then tells us who signed up.

<script async src="https://sweetlinks.co/api/public/tracker?w=YOUR_PROGRAM_SLUG"></script>

// after a user signs up or logs in
sweetlinks.identify("user_123", { email: "user@example.com" });

2. Report a sale from any platform

Not on Stripe? Send the sale yourself with your program key (Settings → Program key).

curl -X POST https://sweetlinks.co/api/public/conversions \
  -H "Authorization: Bearer YOUR_PROGRAM_KEY" \
  -H "Content-Type: application/json" \
  -d '{"userId":"user_123","amount":4900,"currency":"usd","kind":"purchase"}'

// kind: "purchase" | "refund" | "chargeback"
// amount is in cents

3. Embed live creator stats

Show a creator their own numbers anywhere — a members area, a Notion page, your own dashboard. Scoped to one link token, read-only, no customer data.

<div id="sweetlinks-stats"></div>
<script async src="https://sweetlinks.co/api/public/widget.js?token=CREATOR_LINK_TOKEN"></script>

// or read the JSON yourself
GET https://sweetlinks.co/api/public/creator-stats?token=CREATOR_LINK_TOKEN
// → { clicks, signups, revenueCents, commissionOwedCents, commissionPaidCents, ... }
Start a programBrowse programs