# API-Referenz

> Jede Operation des veröffentlichten Vertrags, mit Playground und Codebeispielen.

Die Referenz wird beim Bau dieser Seiten aus dem veröffentlichten Vertrag der Integrations-API erzeugt
(OpenAPI 3.0). Sie zeigt genau die Operationen, die ein API-Schlüssel oder ein öffentlicher Aufruf nutzen
kann; die Operationen des Portals sind nicht Teil davon (siehe [Stabilität und Versionen](https://passport.kabin.sh/docs/de/versioning)).

## Grundlagen

|                   |                                                                                                                                                         |
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Basis-URL         | `https://<Ihre BatteryPass-Adresse>/api/v1` (siehe [Umgebungen](https://passport.kabin.sh/docs/de/environments))                                      |
| Authentifizierung | `Authorization: Bearer bp_live_…` mit Scope `read`, `condition` oder `import` ([Authentifizierung](https://passport.kabin.sh/docs/de/authentication)) |
| Format            | JSON, Zeitpunkte in UTC, IDs als UUID                                                                                                                   |
| Fehler            | Problem Details nach RFC 9457 mit stabilem `code` ([Fehler](https://passport.kabin.sh/docs/de/errors))                                                |
| Listen            | Keyset-Paginierung mit `limit` und `cursor` ([Paginierung](https://passport.kabin.sh/docs/de/pagination))                                             |
| Grenzen           | `429 rate_limited` mit `Retry-After` ([Ratenlimits](https://passport.kabin.sh/docs/de/rate-limits))                                                   |

> [!TIP]
> **Playground**
>
> Jede Operationsseite hat einen Playground („Try in Playground“). Er sendet die Anfrage aus Ihrem Browser an
> die BatteryPass-Instanz, auf der diese Dokumentation läuft. Ihr Schlüssel bleibt nur in diesem Tab
> (sessionStorage) und wird ohne Cookies gesendet; nutzen Sie dafür einen Schlüssel mit Scope `read`.

## Vertrag herunterladen

- [`openapi.json`](https://passport.kabin.sh/docs/openapi.json) und [`openapi.yaml`](https://passport.kabin.sh/docs/openapi.yaml): der Stand, aus dem diese
  Dokumentation gebaut wurde.
- `/api/v1/openapi.json` und `/api/v1/openapi.yaml` auf Ihrer BatteryPass-Adresse: der Stand, den Ihre
  Instanz gerade ausliefert.

## Alle Operationen

### Katalog

[Units (individual batteries) of the active organisation](https://passport.kabin.sh/docs/de/api-reference/catalog/list-batteries.md): `GET /batteries` (read)

[The units as a spreadsheet with the import's columns](https://passport.kabin.sh/docs/de/api-reference/catalog/export-units.md): `GET /batteries/export` (read)

[A unit](https://passport.kabin.sh/docs/de/api-reference/catalog/get-battery.md): `GET /batteries/{batteryId}` (read)

[List the battery models of the active organisation](https://passport.kabin.sh/docs/de/api-reference/catalog/list-battery-models.md): `GET /battery-models` (read)

[A battery model](https://passport.kabin.sh/docs/de/api-reference/catalog/get-battery-model.md): `GET /battery-models/{modelId}` (read)

[Versions of a battery model, newest effective date first](https://passport.kabin.sh/docs/de/api-reference/catalog/list-model-versions.md): `GET /battery-models/{modelId}/versions` (read)

[A model version](https://passport.kabin.sh/docs/de/api-reference/catalog/get-model-version.md): `GET /model-versions/{versionId}` (read)

### Werte

[Registry evaluation of the unit-level fields](https://passport.kabin.sh/docs/de/api-reference/values/get-battery-completeness.md): `GET /batteries/{batteryId}/completeness` (read)

[Current unit-level values of a unit](https://passport.kabin.sh/docs/de/api-reference/values/list-battery-values.md): `GET /batteries/{batteryId}/values` (read)

[All revisions of one unit-level value, newest first](https://passport.kabin.sh/docs/de/api-reference/values/list-battery-value-history.md): `GET /batteries/{batteryId}/values/{fieldKey}/history` (read)

[Registry evaluation of the model-level fields](https://passport.kabin.sh/docs/de/api-reference/values/get-model-version-completeness.md): `GET /model-versions/{versionId}/completeness` (read)

[Current model-level values of a version](https://passport.kabin.sh/docs/de/api-reference/values/list-model-version-values.md): `GET /model-versions/{versionId}/values` (read)

[All revisions of one model-level value, newest first](https://passport.kabin.sh/docs/de/api-reference/values/list-model-version-value-history.md): `GET /model-versions/{versionId}/values/{fieldKey}/history` (read)

### Nachweise

[The evidence library, newest first](https://passport.kabin.sh/docs/de/api-reference/evidence/list-evidence.md): `GET /evidence` (read)

[One document with its revisions and where it is used](https://passport.kabin.sh/docs/de/api-reference/evidence/get-evidence.md): `GET /evidence/{evidenceId}` (read)

[Download the file](https://passport.kabin.sh/docs/de/api-reference/evidence/download-evidence.md): `GET /evidence/{evidenceId}/download` (read)

### Pässe

[The passport of a unit](https://passport.kabin.sh/docs/de/api-reference/passports/get-passport.md): `GET /batteries/{batteryId}/passport` (read)

[The QR code of the unit's GS1 Digital Link](https://passport.kabin.sh/docs/de/api-reference/passports/get-passport-qr.md): `GET /batteries/{batteryId}/passport/qr` (read)

[The passport's registration with the EU registry](https://passport.kabin.sh/docs/de/api-reference/passports/get-registry-submission-status.md): `GET /batteries/{batteryId}/passport/registration` (read)

[The published versions of a unit's passport, newest first](https://passport.kabin.sh/docs/de/api-reference/passports/list-passport-versions.md): `GET /batteries/{batteryId}/passport/versions` (read)

[One published version with its signed snapshot and validation report](https://passport.kabin.sh/docs/de/api-reference/passports/get-passport-version.md): `GET /batteries/{batteryId}/passport/versions/{versionNo}` (read)

[The BatteryPass v2.0 export of a version (all tiers)](https://passport.kabin.sh/docs/de/api-reference/passports/export-passport-json.md): `GET /batteries/{batteryId}/passport/versions/{versionNo}/batterypass-v2` (read)

[What changed from an earlier version to this one](https://passport.kabin.sh/docs/de/api-reference/passports/get-passport-version-diff.md): `GET /batteries/{batteryId}/passport/versions/{versionNo}/diff` (read)

[A PDF of a version with every tier, restricted rows tagged, the signature and the QR code](https://passport.kabin.sh/docs/de/api-reference/passports/export-passport-pdf.md): `GET /batteries/{batteryId}/passport/versions/{versionNo}/pdf` (read)

### Lebenszyklus

[The condition data of a unit (the registry's dynamic fields)](https://passport.kabin.sh/docs/de/api-reference/lifecycle/get-condition.md): `GET /batteries/{batteryId}/condition` (read)

[Report measured condition data (merge)](https://passport.kabin.sh/docs/de/api-reference/lifecycle/update-condition.md): `PATCH /batteries/{batteryId}/condition` (condition)

[The lifecycle of a unit, newest first](https://passport.kabin.sh/docs/de/api-reference/lifecycle/list-lifecycle-events.md): `GET /batteries/{batteryId}/lifecycle-events` (read)

[Record an event in the life of a unit](https://passport.kabin.sh/docs/de/api-reference/lifecycle/create-lifecycle-event.md): `POST /batteries/{batteryId}/lifecycle-events` (condition)

### Feldregister

[Version, content hash and status of the field registry in use](https://passport.kabin.sh/docs/de/api-reference/registry/get-registry-info.md): `GET /registry` (read)

[The editor schema of a battery category](https://passport.kabin.sh/docs/de/api-reference/registry/get-registry-schema.md): `GET /registry/schema` (read)

[The registry in use and how many of the organisation's passports need an update](https://passport.kabin.sh/docs/de/api-reference/registry/get-registry-status.md): `GET /registry/status` (read)

### Standorte

[Manufacturing facilities of the active organisation](https://passport.kabin.sh/docs/de/api-reference/facilities/list-facilities.md): `GET /facilities` (read)

### Öffentlich

[The public passport of a unit, looked up by GTIN and serial number](https://passport.kabin.sh/docs/de/api-reference/public/get-public-passport-by-product-id.md): `GET /public/dpps/by-product-id/{productId}` (public)

[The public passport (current version)](https://passport.kabin.sh/docs/de/api-reference/public/get-public-passport.md): `GET /public/passports/{passportId}` (public)

[A public document of a public passport](https://passport.kabin.sh/docs/de/api-reference/public/download-public-passport-document.md): `GET /public/passports/{passportId}/documents/{documentId}` (public)

[Check the signatures of a version on the server](https://passport.kabin.sh/docs/de/api-reference/public/verify-passport.md): `GET /public/passports/{passportId}/verify` (public)

[The public passport as it was at a point in time](https://passport.kabin.sh/docs/de/api-reference/public/get-public-passport-version.md): `GET /public/passports/{passportId}/version` (public)

### Änderungen

[The organisation's changes, oldest first, for polling](https://passport.kabin.sh/docs/de/api-reference/changes/list-changes.md): `GET /changes` (read)

### Importe

[Imports of the active organisation, newest first](https://passport.kabin.sh/docs/de/api-reference/imports/list-imports.md): `GET /imports` (import)

[Upload a spreadsheet of units](https://passport.kabin.sh/docs/de/api-reference/imports/create-import.md): `POST /imports` (import)

[One import with its mapping and summary](https://passport.kabin.sh/docs/de/api-reference/imports/get-import.md): `GET /imports/{importId}` (import)

[Map the columns of an import](https://passport.kabin.sh/docs/de/api-reference/imports/update-import-mapping.md): `PUT /imports/{importId}/mapping` (import)

[Start validating every row of an import](https://passport.kabin.sh/docs/de/api-reference/imports/validate-import.md): `POST /imports/{importId}/validate` (import)
