HappierleadsDocs
Embed Happierleads screens

Create a website when a client signs up

In your sign-up code: one website per client, its id saved on your customer.

Every client gets one website. Create it in your sign-up code, right after you create the client's company in your own database, with your master key (HL_MASTER_KEY, sent as ?privateKey=).

1. Create the website

POST /admin/websites with the client's name and domain. The domain may be empty: the install screen asks the client for it. The answer is the new website's id.

POST/admin/websites
Try:
Request body
NameWebsite/workspace name for organization and identification. - Optional: Defaults to "New Website" if not provided - Can be updated later via website update endpoint - Used for display purposes only (not in tracking script) - Recommended: Use descriptive names like "Main Website", "Landing Pages", "Blog"
DomainThe website's domain (optional; may be empty, the pixel install screen asks for it).
curl -X POST "https://rest-admin.happierleads.com/admin/websites?privateKey=YOUR_KEY" \  -H "Content-Type: application/json" \  -d '{  "name": "Acme Ltd",  "domain": "acme.example"}'
Response
Press Send request to try it with sample data.

2. Save the websiteId on your client

Do this before any other call

Store the websiteId on your own customer record (for example company.happierleadsWebsiteId). It is the only link between your client and their website: credits, trial, paid, cancel and every screen you open later need it. Lose it and that client cannot open their screens.

// after POST /admin/websites, before anything else
await db.companies.update(company.id, { happierleadsWebsiteId: websiteId });

3. Then give it credits

In the same sign-up request, right after saving the id: start a trial, or switch it to paid if the client paid at sign-up.

If our API is down at sign-up

Let the sign-up succeed anyway: flag the company (for example happierleadsPending) and retry from a background job. Never create a second website for a company that already has a websiteId.

Next: open a screen: the one-time link.

On this page