# Add a client (/docs/white-label/add-a-client)

When a client signs up on **your** marketing site, your server creates their website, saves its id, [starts their trial](/docs/white-label/start-trial) and invites them.

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 [#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.

<ApiPlayground method="post" path="/admin/websites" tool="" args={`{ "name": "Acme Ltd", "domain": "acme.example" }`} />

## 2. Save the websiteId on your client [#2-save-the-websiteid-on-your-client]

<Callout type="warn" title="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.
</Callout>

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

## 3. Then give it credits [#3-then-give-it-credits]

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

## If our API is down 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`.

## Invite the client [#invite-the-client]

Last, invite them with the **Client** role on their own website. They get an invite email from your sender address and sign in at `reveal.youragency.example`.

`POST /admin/invite` with `preset: "client"` and their website.

<ApiPlayground method="post" path="/admin/invite" tool="" args={`{ "invites": [{ "email": "jo@client.example", "firstName": "Jo", "preset": "client", "websites": ["64b7f0a1c2d3e4f5a6b7c8d9"] }] }`} />

The **Client** role sees their own website only: no buying, no team, no account or billing pages. Need a different role for someone (for example your own account managers)? See [Team](/docs/account/team).

```js title="The same in Node.js"
await hl('POST', '/admin/invite', {
  invites: [{ email: user.email, firstName: user.firstName, preset: 'client', websites: [websiteId] }],
});
```

**Next:** [start their trial](/docs/white-label/start-trial).
