Skip to main content
FirstPromoter lets you embed the complete promoter dashboard inside your own app and automatically log the visiting promoter in, so they never have to leave your app or enter credentials manually. Your backend requests a short-lived access token for the promoter, and you pass that token to the iframe.
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)
Keep both server-side only.

Step 2 — Generate an access token

From your backend, make a POST 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}
The request body is empty. On success you get back a bearer token:
string
Short-lived bearer token for this promoter, scoped to your account.
integer
Token lifetime in seconds. Defaults to 86400 (24 hours).
Generate a fresh token on every page load — don’t cache or reuse tokens across sessions or share one token between promoters.

Step 3 — Find the promoter’s ID

You need the FirstPromoter promoter_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_accepted webhook payload

Step 4 — Embed the iframe

Use the access token as the tk 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, append campaign_id:
You can also pass a comma-separated list — the dashboard opens on the first matching campaign the promoter belongs to:

Code examples

Then render the iframe once you have the token:
/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_login from 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_in seconds (24 hours by default) — don’t cache or share them between users.