Requirements
- A custom domain configured on your FirstPromoter account
- Business plan or higher
- Server-side access to make authenticated API requests — the access token must always be generated on your backend. Never call this endpoint or expose your API key from the browser.
How it works
1
Your promoter logs into your app
They’re already authenticated in your product, and you know their FirstPromoter promoter ID (or the
cust_id you assigned them).2
Your backend requests an access token
Your server calls the
iframe_login endpoint with that promoter’s ID. FirstPromoter returns a bearer token scoped to that promoter and your account.3
You render the iframe with the token
Pass the token as the
tk query parameter on the iframe src. FirstPromoter validates it and loads the dashboard already signed in.Step 1 — Get your API credentials
Go to Settings → Integrations → Manage API Keys and note two values:- Account ID — identifies your FirstPromoter account
- API Key — used to authenticate the server-side request (use a v2 key)
Step 2 — Generate an access token
From your backend, make aPOST request to the iframe login endpoint:
integer
The FirstPromoter promoter ID. Provide this or
cust_id.string
The external customer ID you assigned this promoter when they signed up. Provide this or
promoter_id.string
required
Bearer {your_api_key}string
required
{your_account_id}string
Short-lived bearer token for this promoter, scoped to your account.
integer
Token lifetime in seconds. Defaults to
86400 (24 hours).Step 3 — Find the promoter’s ID
You need the FirstPromoterpromoter_id (not your own internal user ID) — or the cust_id you gave them. Get it from:
- The API response when the promoter was originally created
- The Promoters API filtered by
cust_id - The
promoter_acceptedwebhook payload
Step 4 — Embed the iframe
Use the access token as thetk query parameter on the iframe src:
allow="clipboard-write" is required for the copy-to-clipboard buttons inside the dashboard (referral links, promo codes, etc.).Targeting a specific campaign
If a promoter belongs to more than one campaign and you want the dashboard to open directly on a particular one, appendcampaign_id:
Code examples
/api/fp-token above is your own protected backend route that performs the Step 2 request and returns { token: access_token } — the same pattern as the Node.js example.
Security considerations
- Never call
iframe_loginfrom the browser. Your API key must stay server-side behind a route that requires the visitor to already be authenticated in your app. - Only embed the iframe on authenticated, non-public pages. The token grants full dashboard access for that promoter.
- Generate a fresh token on every page load. Tokens expire after
expires_inseconds (24 hours by default) — don’t cache or share them between users.