# Projects and people

> An integration creates, renames and deletes projects, moves their phase, adds and removes members, handles access requests and accepts handovers.

An integration, such as a company's ERP or project register, can keep WhatsBuilt's projects and their members in step with its own: create a project when a contract is signed, rename it, add the site team, approve access requests, mark the project completed and accept a project handed over by another organisation.

**An integration is never a person.** It never appears in a member list, it cannot be added as a member or named as the receiving admin of a handover, and its own membership is set by its admin on *Integrations*, not through the member operations. Adding its address or id as a member answers `404`.

## What it needs

| Operation | Scope | Project role |
|:----------|:------|:-------------|
| Read a project, its lifecycle, its members and integrations | `projects:read` | viewer |
| List access requests | `projects:read` | admin (the list is empty elsewhere) |
| Rename a project, change its settings, move its phase | `projects:write` | admin |
| Add, change and remove members; approve and deny access requests; cancel a handover | `members:write` | admin |
| Create and delete projects; list, accept and reject handovers to the organisation | `organisation:admin` | the organisation's admin |

`projects:write` and `members:write` give the integration the admin role on its own organisation's projects. `organisation:admin` makes the integration an admin of its organisation, which reaches every project the organisation owns. The scope picker warns on `members:write` and `organisation:admin`, and accepting a handover is attesting. The organisation's admin picks the scopes; see [Create an integration](/en/integrations/create-an-integration/). Then get an [access token](/en/integrations/get-an-access-token/) that carries them.

## Create a project

```sh
curl -X POST "https://api.whatsbuilt.fi/v1/projects" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: contract-2026-118" \
  -d '{"name":"Asunto Oy Rantapuisto","description":"Contract 2026-118"}'
```

The answer is `201` and the project, in the integration's organisation. A repeat with the same `Idempotency-Key` and body returns the same project with `200`; the same key with another body answers `422 IDEMPOTENCY_KEY_REUSED`. Once the project is deleted, the key answers `410 RESOURCE_DELETED` and creates nothing; use a new key for a new project. The integration does not own the project: it reaches it as the organisation's admin, and `member_count` counts people only.

`DELETE /v1/projects/{projectId}` deletes a project of the integration's own organisation and everything in it. It cannot be undone. The project then comes as a deletion in `GET /v1/projects`.

## Change a project

```sh
curl -X PATCH "https://api.whatsbuilt.fi/v1/projects/$PROJECT" \
  -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
  -d '{"name":"As Oy Rantapuisto, phase 2","allow_inspector_label_linking":true}'
```

`GET /v1/projects/{projectId}` reads the project with its settings. Where the organisation uses the maintenance phase, `GET /v1/projects/{projectId}/lifecycle` reads its phase and history, and this moves it:

```sh
curl -X POST "https://api.whatsbuilt.fi/v1/projects/$PROJECT/phase" \
  -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
  -d '{"phase":"completed","occurred_at":"2026-11-18T15:00:00+02:00"}'
```

The history shows the change as *Integration · {name}*, and an app acting for a person as *{person} · via {app}*. A move the project cannot make answers `409 PROJECT_PHASE_TRANSITION_INVALID`.

## Add and remove members

```sh
curl -X POST "https://api.whatsbuilt.fi/v1/projects/$PROJECT/members" \
  -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
  -d '{"email":"matti.virtanen@example.com","project_role":"inspector"}'
```

Send `email` or `user_id`, not both. By `email` the integration adds any person who has a WhatsBuilt account to a project of its own organisation, and the person gets an e-mail; an address with no account answers `404 MEMBER_EMAIL_NOT_FOUND`. By `user_id` it adds a person of the project's organisation, or of another organisation whose access request was approved. A member who is already on the project answers `200` with `"status": "already_member"`, so a repeat is safe.

`PATCH /v1/projects/{projectId}/members/{userId}` with `{"project_role": "admin"}` changes a role, and `DELETE` removes the person. The role is `viewer`, `inspector` or `admin`, never above the integration's own on the project. The owner's role cannot be changed (`409 PROJECT_OWNER_ROLE_LOCKED`), and the last person stays (`409 LAST_PROJECT_MEMBER`).

`GET /v1/members` lists the people of the projects in a window, removals included; see [Collect changes in a window](/en/integrations/collect-changes/). `GET /v1/projects/{projectId}/integrations` lists the project's integrations. Another organisation's integration is added to a project by a person on the project's member page; an integration's token gets `403` for that.

## Access requests

A person of another organisation asks for access to a project in the app. `GET /v1/access-requests?status=pending` lists the requests of the projects where the integration is an admin. Approve one, and the person becomes a viewer:

```sh
curl -X POST "https://api.whatsbuilt.fi/v1/projects/$PROJECT/access-requests/$REQUEST/approve" \
  -H "Authorization: Bearer $TOKEN"
```

`…/deny` denies it. A request that is no longer pending answers `404`.

## Handovers

A completed project moves to the organisation that maintains it. Only the project's owner who is also an admin of its organisation asks for that, in the app, so an integration's request answers `403 INSUFFICIENT_PROJECT_ROLE`. A project that an integration created has no owner, so it cannot be handed over yet. With `members:write` an integration can cancel a pending request: `DELETE /v1/projects/{projectId}/handover`.

The receiving organisation's integration with `organisation:admin` lists the requests sent to its organisation with `GET /v1/handover-requests/incoming`, and accepts or rejects one:

```sh
curl -X POST "https://api.whatsbuilt.fi/v1/handover-requests/$REQUEST/accept" \
  -H "Authorization: Bearer $TOKEN"
```

Accepting moves the project, its members and records to the integration's organisation and copies its templates, check lists, fail-reason lists and documents. The request records the integration as the one who decided. `…/reject` rejects it. Handovers need the maintenance phase in both organisations; otherwise the answer is `403 FEATURE_OFF`.

The error codes are on [Errors and limits](/en/integrations/errors-and-limits/) and the fields in the [API reference](/en/api-reference/operations/addmember/).
