external_id, so you look partners up by your id and don’t store anything from Tolt in your database.
Your appyour referral page
Your backendAPI key
Toltplatform.tolt.com
1GET /api/referrals
2GET /v2/partners?external_id=…
3new? POST /v2/partners
4GET links, customers, commissions
5link, referrals, earnings
Build it
1
Install the SDK and set two variables
.env
2
Find the user's partner
Look the partner up by your own user id. No partner means the user hasn’t joined yet. Show them a field for their link and a Create link button.
external_id is unique within a program, so you get at most one.referrals.ts
3
Create their link
When they submit, create the partner with your user id and the slug they picked. The partner is active right away, and their link is
?ref=<slug> on your site.referrals.ts
null means the slug is taken, so ask for another one. Send first_name and last_name too if you have them. Leave out link and Tolt picks the slug from their name or email.4
Show their link, referrals and earnings
Load everything the page shows in one go:
referrals.ts
for await walks every page of commissions, so the totals cover all of them. earnings holds a total per currency, in cents, such as { usd: { upcoming: 4000, paid: 12000 } }; a commission without a currency counts in the program’s. customers.list returns the 10 newest referrals; pass limit for more, up to 100.5
Let them change their link
referrals.ts
6
Send them to the portal for payouts
Payout details, tax forms and identity checks stay in your partner portal. Link to it from the page:Use your portal’s custom domain instead if it has one.
Edge cases
Edge cases
- Already a partner. A user who joined your program before, with the same email, makes
partners.createreturn409onemail. Find them withpartners.list({ program_id, search: user.email }), check the email matches exactly, and save your id withpartners.update({ id, external_id: user.id }). From then on step 2 finds them. - Changed email. The lookup uses your user id, so a user who changes their email in your app keeps the same partner. Program emails still go to the email the partner was created with.
- Suspended or rejected. Step 2 returns these partners too. Check
statusand show a short message instead of the link. - Review first. Partners created here are active right away. To approve them before they earn, create them with
status: "pending"(see Partner signup).
Tips
- Show referrals with care. They’re your customers. A first name or a masked email is usually enough.
- Hear about new referrals. The
customer.createdandcommission.createdwebhooks carry thepartner_id, so you can notify the user in your app. - Prefer a ready-made page? The refer-a-friend guide embeds a dashboard with the same data in a few lines.
Referral links only earn once your site records the click and the signup. If you haven’t set that up, start with the Quickstart.

