Credentials
Every request to the Affiliate API needs two values:- API key: a personal key that you create in your affiliate dashboard. It identifies you as the affiliate.
- Account ID: identifies the affiliate program (the FirstPromoter account) the request is for.
Get your API key
- Log in to the affiliate dashboard of the program.
- Open your Profile settings and go to API & AI tools.
- Click Enable to create your API key.
- Copy the API key and the Account ID shown on the page and store them somewhere safe.
- Copy the key again whenever you need it.
- Regenerate the key. A new key is created and the old one stops working immediately, so update any scripts or AI tools that use it.
- Disable API access. The key is deleted and every request made with it is rejected until you enable access again.
The key belongs to your account in one program. If you promote several programs on FirstPromoter, you have a separate affiliate account in each one, so you create a separate key in each program’s affiliate dashboard and use that program’s Account ID with it.
Making authenticated requests
The base URL ishttps://api.firstpromoter.com/api/v2/affiliate. Send both credentials as request headers:
Account-ID header is required on every request. Header names are case-insensitive, so ACCOUNT-ID works too.
Example request
Errors
Security best practices
- Treat the API key like a password: anyone who has it can read your data in the program and change it through the API. That includes adding or deleting referrals, referral links and promo codes, and editing your payout methods and email settings.
- Never put the key in client-side code, public repositories or shared documents.
- Use HTTPS for all requests.
- Regenerate the key if you think it has been exposed, and disable API access when you no longer need it.