# Create an integration

> An organisation administrator creates an integration for a system, chooses its projects and permissions, and gives it a key.

An **integration** is a system of your organisation, such as an ERP, a data platform or production planning, that uses the WhatsBuilt API. It is not a person: it does not sign in to the app, it does not count as a user, and nobody can sign in with it. It signs its requests with its own key.

You need to be an administrator of your organisation. The API must be on: *Settings* › *Connections* › *API*. It is on unless an administrator has turned it off.

## Create it

1. Open *Integrations* in the organisation menu.
2. Select *New integration*.
3. Give it a **name**, for example *Production planning*, and optionally a description.
4. Choose its **projects**: *All organisation projects*, which also includes projects created later, or the projects you pick. Only projects your organisation owns can be chosen.
5. Choose its **permissions**. The picker groups them by area: *General*, *Projects*, *Access*, *Models*, *Elements and labels*, *Schedule*, *Inspections*, *Findings*, *Maintenance log* and *Exports and reports*.
   - *Reads data* under *General* starts ticked. It gives every read permission, so the read permissions of the other groups show *Included in Reads data*. It is enough to collect changes; see [Collect changes in a window](/en/integrations/collect-changes/).
   - To let the integration read only part, such as the elements (`elements:read`), untick *Reads data* first and then tick the read permissions you want. Otherwise it reads everything.
   - The guide of each write names the permission it needs: *Records element deliveries and installations* to [record element events](/en/integrations/element-events/), *Creates finding drafts* to [create finding drafts](/en/integrations/finding-drafts/), *Records and edits findings and publishes finding drafts* and *Deletes findings and imports BCF files* to [write findings](/en/integrations/findings/), and *Edits element properties and labels* and *Deletes QR codes* to [create and link QR labels](/en/integrations/labels/).
   - Under the picker, *Project role* shows the role the chosen permissions give the integration on its projects: viewer, inspector or administrator. Read permissions do not raise it. The role decides what the integration may do on each project, as it does for a person; the guides above say which role each call needs.
   - A permission with a warning sign can delete data for good, grant access, record verdicts or act as the organisation's admin.
6. Choose the **key**:
   - *Generate a key pair in the browser* makes an ES256 key pair. The private key downloads once as a file `whatsbuilt-<name>-<id>.pem`. WhatsBuilt never sees or stores it, so keep the file safe and give it only to the system.
   - *Paste a public key* takes a public key that your system made, as a PEM (`-----BEGIN PUBLIC KEY-----`) or a JWK, ES256 (P-256) or RS256 (RSA, at least 2048 bits). A private key is refused.
7. Select *Create integration and key*.
8. If you chose a permission with a warning, *Confirm permissions* opens and lists those permissions. Tick each one, then select *Give permissions*. Only then is the integration created and, with a generated key, the private key downloaded.

The dialog that follows shows the *Setup* details, the key id (`kid`) among them, and *Open the integration*.

## What the system needs

Open the integration. The system needs these, from two cards:

| Field | Card | What it is |
|:------|:-----|:-----------|
| `client_id` | *Setup* | The integration's id. It goes into the `iss` and `sub` of every client assertion |
| Token endpoint | *Setup* | Where the system gets its access token, e.g. `https://api.whatsbuilt.fi/oauth/token` |
| API address | *Setup* | The base of every call, e.g. `https://api.whatsbuilt.fi/v1` |
| Key id (`kid`) | *Keys* | The id of the key, on each key's row. It goes into the assertion's header |

Give these and the private key to whoever sets up the system. The next step is [Get an access token](/en/integrations/get-an-access-token/).

## Look after it

- **Keys.** An integration can hold two valid keys at a time, so you can add a new key, move the system to it and then remove the old one without a break. A key is valid for one year. *Remove key* stops the key at once, and every access token fetched with it.
- **Call log.** *Call log* shows each call of the last 90 days: time, call, window, status and rows. Use *Failed* to see only the calls that failed.
- **Changes.** *Changes* shows who created the integration and who changed its projects, permissions or keys, and when. A change made through an app shows as *{person} · via {app}*.
- **Disable** stops every call at once; *Enable* restores it.
- **Revoke integration** stops it for good. Its history stays, but it reaches no project and cannot be restored.

When a project is removed from the integration, the system sees it once as `access_removed` in [`GET /v1/projects`](/en/integrations/collect-changes/#projects-gained-and-lost).
