# Create a customer (https://webmetic.de/docs/api/referenz/partner/create-customer)

## POST /partner/create-customer

Create a customer account owned by your partner account, with one user (role admin).

The answer carries the generated password of that user. It is returned only here and
never again, and Webmetic does not send it: pass email and password on to the customer
yourself. `website` is reduced to the main domain in lower case
(`https://www.Nordhafen-Anlagenbau.DE/preise` becomes `nordhafen-anlagenbau.de`).
Data arrives once the tracking code with the new `account_id` runs on the website.

Note: This endpoint is rate-limited to 10 requests per minute.

### Anfrage

`application/json`

| Feld | Typ | Pflicht | Beschreibung |
| --- | --- | --- | --- |
| `email` | string | ja | Login email of the customer's first user; no account may use it yet (any case) |
| `website` | string | ja | Domain or full URL of the customer's website; stored as the main domain in lower case |
| `whitelabel` | boolean | nein | true creates a whitelabel customer, who never sees Webmetic |

### Antworten

| Status | Beschreibung |
| --- | --- |
| 200 | The new customer with its credentials; the password appears only here |
| 400 | INVALID_WEBSITE: `website` has no domain with a valid suffix, e.g. localhost or an IP address |
| 403 | API_KEY_MISSING, API_KEY_INVALID, API_KEY_NOT_FOUND, or NOT_A_PARTNER: the key does not belong to a partner account |
| 409 | EMAIL_ALREADY_EXISTS: an account already uses this email address (any case), or WEBSITE_ALREADY_EXISTS: an account that is not onboarding, cancelled or failed already holds this domain |
| 422 | VALIDATION_ERROR: `email` or `website` is missing, or `email` is not a valid address; `errors` lists each problem |
| 429 | RATE_LIMITED: more than 10 requests per minute to this endpoint |
| 500 | INTERNAL_ERROR: unexpected server error |

Felder der Antwort 200:

| Feld | Typ | Pflicht | Beschreibung |
| --- | --- | --- | --- |
| `account_id` | string | ja | Account id of the new customer; its tracking code needs it |
| `email` | string | ja | Login email of the first user (role admin), trimmed and lower case |
| `password` | string | ja | Generated password of that user. Returned only here, never again |
| `api_key` | string | ja | The customer's own API key |
| `status` | string | ja | partner_trial for every customer created here |
| `account_type` | string | ja | partner_customer: you bill the customer |
| `website` | string | ja | The domain as stored: main domain, lower case |
| `whitelabel` | boolean | ja | As sent |

### Beispiel

```bash
curl -X POST 'https://hub.webmetic.de/partner/create-customer' \
  -H 'Authorization: wmtc_IHR_API_SCHLUESSEL'
```