# Write findings

> An integration creates findings, comments on them, adds photos and closes findings, as a project inspector does.

An integration with the scope `findings:write` does to findings what a project inspector does in the app: it creates a finding, changes its fields and status, comments, adds photos and viewpoints, relates findings to each other, and publishes or rejects [finding drafts](/en/integrations/finding-drafts/). Each write shows in the app with the author *Integration · {name}* and stays in the history.

## What you need

- The scope `findings:write`. It gives the integration the inspector role on its projects. An organisation administrator chooses the permissions; see [Create an integration](/en/integrations/create-an-integration/).
- An [access token](/en/integrations/get-an-access-token/) whose scopes include `findings:write`. Reading needs only `findings:read`.

## Create a finding

```sh
curl -X POST "https://api.whatsbuilt.fi/v1/projects/$PROJECT/findings" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: QC-2026-1184" \
  -d '{"title":"Crack in the column","priority":"Major","element_global_ids":["2qL7xVb0P1hO3kQm9aZ002"],"due_date":"2026-12-01"}'
```

| Field | What it is |
|:------|:-----------|
| `title` | Required, 1–500 characters |
| `description` | Up to 20 000 characters |
| `topic_type`, `topic_status`, `priority`, `stage` | One of the project's own values; [`GET …/finding-values`](/en/integrations/findings/#the-projects-values-and-storeys) lists them. The status defaults to `Open` |
| `assigned_to` | The person responsible |
| `labels` | Up to 100 labels |
| `due_date` | A date or a time |
| `element_global_ids` | Up to 100 elements of the project. The finding gets a viewpoint that selects them |
| `storey_global_id`, `point` | A storey and an optional point on it in metres, in the model's coordinates, as on a [finding draft](/en/integrations/finding-drafts/). [`GET …/storeys`](/en/integrations/findings/#the-projects-values-and-storeys) lists the storeys |

A new finding answers `201` with the same item as the list `GET /v1/findings`. Read one finding with `GET /v1/projects/{projectId}/findings/{guid}`.

## The project's values and storeys

Each project has its own values for a finding's fields, and its own storeys. Read them before you write:

- `GET /v1/projects/{projectId}/finding-values` returns `topic_statuses`, `priorities`, `topic_types` and `stages`, the values the project offers for `topic_status`, `priority`, `topic_type` and `stage`, and `topic_labels`, the labels the app offers. It needs `findings:read`.
- `GET /v1/projects/{projectId}/storeys` lists the project's live storeys (`IfcBuildingStorey`): `global_id`, `name`, `long_name`, `building_name`, `elevation_m` and `elements`, the number of live elements on it. It needs `elements:read`. Send the `global_id` as `storey_global_id`. For a point near an element, take the storey whose `building_name` and `name` match the element's `building_name` and `storey_name` in [`GET /v1/elements`](/en/integrations/collect-changes/). When several models each have a storey of that name, any of them anchors the point; the app uses the one with the most `elements`.

## Retry safely

Findings, comments and viewpoints take an `Idempotency-Key` header. A repeat with the same key and body returns the first write with `200` and writes nothing. The same key with another body answers `422 IDEMPOTENCY_KEY_REUSED`, and a repeat after the first write was deleted `410 RESOURCE_DELETED`. Keys are per integration and project, and a key names one write: a key used for a finding cannot be used again for a comment or a viewpoint of the same project.

## Change and close a finding

`PATCH /v1/projects/{projectId}/findings/{guid}` changes only the fields sent. Close a finding by sending `{"topic_status":"Closed"}`.

## Comment

`POST …/findings/{guid}/comments` adds a comment (`comment`, and optionally a viewpoint of the same finding, `viewpoint_guid`). `PATCH …/findings/{guid}/comments/{commentGuid}` changes it.

## Add a photo

1. `POST /v1/projects/{projectId}/photos` with the image type (`image/png` or `image/jpeg`) and its size in bytes, at most 20 MB. The answer holds `photo_key`, `upload_url` and headers.
2. `PUT` the image to `upload_url` within 15 minutes, with exactly the headers of the answer.
3. `POST …/findings/{guid}/viewpoints` with the `photo_key`, and optionally elements or a point on a storey. The photo joins the finding as a viewpoint.

Download a viewpoint's photo from `GET …/findings/{guid}/viewpoints/{viewpointGuid}/photo`; it redirects (`302`) to a download address valid for an hour.

## Model files and related findings

- `PUT …/findings/{guid}/files` replaces the IFC files the finding refers to (`filename`, `ifc_project`, `reference`).
- `POST …/findings/{guid}/related` relates another finding of the same project (`related_guid`) both ways. `DELETE …/findings/{guid}/related/{relatedGuid}` removes the relation.

## Publish or reject a draft

`POST /v1/projects/{projectId}/finding-drafts/{draftId}/publish` publishes a draft as a finding authored by the integration. The draft's photos become the finding's photos. `…/reject` rejects the draft. A draft already decided answers `409 DRAFT_DECIDED`.

## Delete a finding

`DELETE /v1/projects/{projectId}/findings/{guid}` deletes the finding with its comments, viewpoints, files and relations. It needs the permission `findings:delete`, which gives the integration the administrator role on its projects, as deleting is an administrator action in the app. A deletion cannot be undone. The finding comes as a deletion in `GET /v1/findings`, and the organisation's call log keeps its guid.

## BCF archives

- `GET /v1/projects/{projectId}/bcf` (`findings:read`, project admin as in the app) gives the project's findings as a BCF 3.0 zip with comments, viewpoints and photos. The archive must stay below about 4.5 MiB; see [the size of a download](/en/integrations/exports/#size-of-a-download). For keeping a copy in step, the lists below are lighter.
- `POST /v1/projects/{projectId}/bcf` (`findings:delete`) imports a BCF 2.1 or 3.0 zip, sent as the form field `file` of a `multipart/form-data` body. A topic with a new guid becomes a finding; a topic whose guid is in the project updates that finding, and its comments and viewpoints are added or updated by guid. Nothing is deleted. A guid of another project is skipped and named in `errors`. The answer counts `imported`, `updated` and `skipped`. The upload must stay below about 4.5 MiB, and the archive may hold at most 2,000 topics, 5,000 files and 40 MiB unpacked.

```sh
curl -X POST "https://api.whatsbuilt.fi/v1/projects/$PROJECT/bcf" -H "Authorization: Bearer $TOKEN" -F "file=@findings.bcfzip"
```

Each project takes at most 20 exports and 5 imports an hour, counted together with the app.

## Follow the changes

The parts of findings have lists of their own, in a window like the other lists; see [Collect changes in a window](/en/integrations/collect-changes/): `GET /v1/comments`, `GET /v1/viewpoints`, `GET /v1/finding-files` and `GET /v1/related-findings`. A comment, viewpoint, file or relation deleted on its own comes as a deletion. A deleted finding implies the deletion of its comments, viewpoints and files, and of its relations in both directions.

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