# BildProof API for property managers: quickstart

> Written for developers and for AI coding assistants (Claude, ChatGPT, Copilot, Cursor). Paste this
> page, or its URL https://bildproof.de/entwickler/quickstart.md, into your assistant together with
> the prompt in section 7, and it has everything it needs to build the integration.

BildProof documents an apartment handover (move-in, move-out or a routine check) on a phone and seals
the record: every photo and the protocol are hashed (SHA-256) and the record is signed by BildProof
(Ed25519). Your property management software starts the handover with **one API call** and gets a
link back, the way a shop starts a Stripe Checkout:

1. Your system calls `POST /v1/inspections` with the address. You get a `launch_url`.
2. You send that link to whoever does the handover (your caretaker, an employee, a service company)
   by SMS, email or in your own app.
3. They tap the link on their phone. It opens the app **BildProof für Hausverwaltungen** (iOS and
   Android) straight on this handover. No account, no sign-in, no SDK in your app.
4. They walk the apartment (rooms, defects, meter readings, keys, signatures) and tap
   "Abschließen und senden". The record is sealed on our server.
5. Your office reviews it in the BildProof workspace (https://bildproof.de/business) and approves it.
6. Your system receives webhooks (`inspection.submitted`, `inspection.approved`, `finding.*`) and
   fetches the report with `GET /v1/inspections/{id}/report`.

- Base URL: `https://api.bildproof.de`
- OpenAPI 3.1: https://bildproof.de/entwickler/openapi.yaml
- Human-readable docs: https://bildproof.de/entwickler

## 1. Keys

Create keys in the workspace: **https://bildproof.de/business/api** (company owner only). A key is
shown once.

| Prefix | Mode | What it does |
| --- | --- | --- |
| `bp_test_` | test | Test inspections. `POST /v1/inspections/{id}/simulate` finishes one in a second, no phone needed. Test webhooks go only to test endpoints. |
| `bp_live_` | live | Real handovers on a real phone. |

Send it as `Authorization: Bearer bp_test_…`. Never in a query string, never in a mobile app or a
browser: keys belong on your server.

A test key sees only test inspections, a live key only live ones.

## 2. Start a handover

```bash
curl https://api.bildproof.de/v1/inspections \
  -H "Authorization: Bearer $BILDPROOF_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: move-out-4711" \
  -d '{
    "kind": "move_out",
    "property": { "external_ref": "OBJ-17", "street": "Ringstraße 9", "postcode": "10115", "city": "Berlin" },
    "unit": { "external_ref": "WE-17-03", "label": "WE 3, 2. OG links" },
    "tenant": { "name": "Eva Muster", "email": "eva.muster@example.de" },
    "due_at": "2026-12-01",
    "notes": "Schlüssel beim Hausmeister.",
    "external_ref": "VG-2026-0815",
    "metadata": { "contract": "MV-4711" }
  }'
```

Answer (201, shortened):

```json
{
  "object": "inspection",
  "id": "5b0c…",
  "status": "assigned",
  "kind": "move_out",
  "mode": "test",
  "external_ref": "VG-2026-0815",
  "property": { "id": "…", "street": "Ringstraße 9", "postcode": "10115", "city": "Berlin", "external_ref": "OBJ-17" },
  "unit": { "id": "…", "label": "WE 3, 2. OG links", "external_ref": "WE-17-03" },
  "capture_link": { "id": "…", "status": "active", "claimed": false, "expires_at": "2027-01-…" },
  "seal": null,
  "report": null,
  "dashboard_url": "https://bildproof.de/business/pruefungen/5b0c…",
  "launch_url": "https://bildproof.de/i/9f1e…#4c7a…"
}
```

Fields:

- `kind` (required): `move_in`, `move_out` or `routine`.
- `property`: `street` (required for a new property), `postcode`, `city`, `name`, `external_ref`.
  With `external_ref` we find the property you created before; without it we match the exact
  address. Same for `unit` (`label`, `floor`, `external_ref`); without a label the unit is "Wohnung".
- `tenant`: `name`, `email`. The email is filled in on the protocol in the app, where the tenant can
  confirm or change it. After the office approves, that address receives the report link.
- `due_at`: a date (`2026-12-01`) or a date-time.
- `external_ref`: your own id for this handover. Every webhook carries it back.
- `metadata`: up to 20 string values, returned as you sent them.
- `Idempotency-Key` header: a retry with the same key and body returns the same answer (and the
  same `launch_url`) instead of a second handover.

## 3. The launch link

`launch_url` is `https://bildproof.de/i/<link id>#<token>`.

- **Keep it like a password** until it is used: anyone with the link can do this one handover. It is
  shown only in this answer. The token after `#` never reaches a server log.
- **Claimed once:** the first phone that opens it owns it. Another phone gets "already opened on
  another phone". Need a new one (lost link, other person)? `POST /v1/inspections/{id}/launch_link`
  returns a fresh `launch_url` and the old link stops working.
- Valid for 30 days (at least 14 days after `due_at`), until submitted or cancelled.
- Opened on a phone without the app, the link shows a page with the App Store and Google Play buttons;
  after installing, tap the link again (or paste it in the app).
- Opened on a computer, the page asks to open it on the phone.

## 4. Status

`GET /v1/inspections/{id}`

| status | meaning |
| --- | --- |
| `assigned` | created, link not opened yet |
| `in_progress` | the link was opened on a phone |
| `submitted` | sealed and sent; `seal.root_hash` is set. Waiting for the office. |
| `changes_requested` | the office sent it back; the same phone can open the link again and resend |
| `approved` | the office approved it; `report` is set |
| `cancelled` | you (or the office) cancelled it |

`GET /v1/inspections?external_ref=VG-2026-0815` finds it by your id. The list is newest first,
`limit` up to 100, next page with `created_before=<created_at of the last item>`, filter `status`.

`POST /v1/inspections/{id}/cancel` withdraws an inspection that is not submitted yet.

## 5. Webhooks

Create an endpoint once per mode (a test key creates a test endpoint):

```bash
curl https://api.bildproof.de/v1/webhook_endpoints \
  -H "Authorization: Bearer $BILDPROOF_KEY" -H "Content-Type: application/json" \
  -d '{ "url": "https://erp.example.de/hooks/bildproof", "events": ["inspection.*", "finding.*"] }'
```

The answer holds the endpoint's `secret` (`whsec_…`), shown once.

| event | when | `data.object` |
| --- | --- | --- |
| `inspection.submitted` | the phone sealed and sent it | inspection (with `seal`) |
| `inspection.approved` | the office approved it | inspection (with `report.url`) |
| `inspection.cancelled` | cancelled | inspection |
| `finding.created` | a defect was recorded (sent with the submission) | finding |
| `finding.resolved` | a contractor or the office reported the defect fixed | finding |
| `finding.accepted` | the office accepted the repair; sealed | finding (with `acceptance.code`) |

Envelope:

```json
{ "id": "…", "object": "event", "type": "inspection.approved", "created": 1765000000,
  "livemode": false, "data": { "object": { "object": "inspection", "id": "…", "external_ref": "VG-2026-0815", "…": "…" } } }
```

Every delivery is signed: header `BildProof-Signature: t=<unix seconds>,v1=<hex>`, where `v1` is
HMAC-SHA256 with your endpoint secret over `"<t>.<raw request body>"`. Verify it, reject anything
older than 5 minutes, answer 2xx quickly. Failed deliveries are retried for about a day. Use the
event `id` to ignore duplicates.

```js
import crypto from "node:crypto";
export function verify(rawBody, header, secret) {
  const parts = Object.fromEntries(header.split(",").map((p) => p.split("=")));
  const expected = crypto.createHmac("sha256", secret).update(`${parts.t}.${rawBody}`).digest("hex");
  const got = Buffer.from(parts.v1 ?? "");
  const fresh = Math.abs(Date.now() / 1000 - Number(parts.t)) < 300;
  return fresh && got.length === expected.length && crypto.timingSafeEqual(Buffer.from(expected), got);
}
```

## 6. The report

`GET /v1/inspections/{id}/report` (after `inspection.approved`; before that `409 report_not_ready`):

- `snapshot`: the frozen report the office approved: property, unit, rooms with their checklist,
  findings (defects), meter readings, keys, signatures, the seal (`root_hash`, signed, sealed_at).
  It never changes; a later approval is a new `version`.
- `photos[]`: every photo with `sha256`, `room_key`, `purpose`, `captured_at` (device clock),
  `received_at` (our server), and signed `url` / `thumb_url` valid 24 hours
  (`photo_urls_expire_at`). Download what you want to keep.
- `sha256`: the hash of the snapshot.

- `seal`: `root_hash`, the exact sealed `manifest` (canonical JSON text), `signature`, `key_id` and
  `public_key`. Anyone can check it without us: SHA-256 of `manifest` (UTF-8) must equal
  `root_hash`, and `signature` (Ed25519, base64) must verify against `public_key` over the UTF-8 bytes
  of the lowercase hex `root_hash`. The manifest lists every photo's SHA-256, so each downloaded photo
  can be checked against it too.

`GET /v1/inspections/{id}/findings` lists the defects with their state.

## 7. Test without a phone

With a test key:

```bash
curl -X POST https://api.bildproof.de/v1/inspections/$ID/simulate \
  -H "Authorization: Bearer $BILDPROOF_TEST_KEY" -H "Content-Type: application/json" \
  -d '{ "outcome": "approved", "findings": 2 }'
```

This submits a stand-in record through the real seal (no photos, marked "TESTMODUS") and approves it,
so `inspection.submitted`, `finding.created` and `inspection.approved` arrive at your test endpoint.
`"outcome": "submitted"` stops before the approval. A live key gets `403 live_mode_simulation`.
A test launch link also works in the real app, if you want to try the phone side.

## 8. Prompt for your AI assistant

Copy this into Claude, ChatGPT or your IDE assistant, after the details of your stack:

```text
Integrate the BildProof API for property managers into our system.
Docs: https://bildproof.de/entwickler/quickstart.md and the OpenAPI spec https://bildproof.de/entwickler/openapi.yaml (read both first).

Build:
1. A server-side client for https://api.bildproof.de with the key from the env var BILDPROOF_API_KEY (never in frontend or mobile code).
2. "Start handover": when a move-in, move-out or routine inspection is planned in our system, call POST /v1/inspections with kind, property (with our property id as external_ref), unit (our unit id as external_ref), tenant name/email, due_at, and our handover id as external_ref. Send an Idempotency-Key derived from our handover id. Store the returned id and launch_url.
3. Deliver the launch_url to the person doing the handover (our existing SMS/email/app notification). Treat it as a secret. Add a "new link" action that calls POST /v1/inspections/{id}/launch_link.
4. A webhook endpoint (POST) that verifies the BildProof-Signature header (HMAC-SHA256 of "<t>.<raw body>" with the endpoint secret, 5 minute tolerance, timing-safe compare), ignores duplicate event ids, and handles inspection.submitted, inspection.approved, inspection.cancelled, finding.created, finding.resolved, finding.accepted by updating our records via data.object.external_ref.
5. On inspection.approved: GET /v1/inspections/{id}/report, store the snapshot JSON and download the photos (the URLs expire after 24 hours), and link our record to data.object.dashboard_url.
6. A one-off setup script that registers the webhook endpoint (POST /v1/webhook_endpoints with events ["inspection.*","finding.*"]) and prints the secret to store as BILDPROOF_WEBHOOK_SECRET.
7. Tests against a bp_test_ key: create an inspection, call POST /v1/inspections/{id}/simulate with {"outcome":"approved"}, and assert our webhook handler stored the report.
Handle errors by their error.code (never the message), retry 5xx and 429 with backoff, and keep the same Idempotency-Key on retries.
```

## 9. Errors

```json
{ "error": { "type": "invalid_request_error", "code": "parameter_invalid", "message": "kind must be …", "param": "kind" } }
```

| code | status | meaning |
| --- | --- | --- |
| `parameter_missing`, `parameter_invalid`, `invalid_json` | 400 | fix the request |
| `authentication_error` types | 401 | missing or wrong key |
| `insufficient_scope` | 403 | the key may not do this |
| `live_mode_simulation` | 403 | simulate needs a test key |
| `resource_missing` | 404 | no such inspection for this key (other company or other mode) |
| `inspection_not_cancellable`, `inspection_not_open`, `report_not_ready` | 409 | not in that state |
| `idempotency_key_reused` | 422 | same key, different body |
| `rate_limit_exceeded` | 429 | 120 requests per minute per key; retry after the reset |
| `internal_error` | 500 | our side; safe to retry |

## 10. What the seal means

The seal shows that our server received exactly these photos and this protocol at the stated times
and that nothing changed since: anyone can recompute the hashes and check our signature. It is not a
signature by the tenant or the inspector (those are on the protocol), and it says nothing about who
is right in a dispute.
