Developers · API endpoints

Fleet operations

Apply a lifecycle event to many passports, or update many from matched rows, with per-row results.

Version
v1.0.0
Base URL
https://dppapi-production.up.railway.app/v1
Format
JSON · OpenAPI 3.1
FeedbackLast updated

Este artículo aún no está disponible en español; se muestra a continuación en inglés.

The same change across many passports — up to 1,000 per request — reported per row: 200 when every row succeeded, 207 when some did not. A recycled passport is skipped and named, never silently changed.

Personalise the samples. Paste a test key and every snippet uses it — and your own model and passport ids.

POST/v1/passports/bulk-lifecycle
write scope

Apply a lifecycle event to many passports

putInService sets the in-service date and records a PUT_INTO_SERVICE event (a date is required). waste sets status WASTE. recycle ends each passport, exactly like Mark as recycled.

Per-battery readings differ by definition, so they are not a bulk lifecycle event — send them with import updates or as events.

Request body3

  • passportIdsstring[], 1–1000required

    Passport ids.

  • event"putInService" | "waste" | "recycle"required

    What happened.

  • datedateoptional

    Required for putInService.

Headers2

  • Idempotency-Keystringheaderoptional

    Optional. A unique string per logical operation (a UUID is ideal). The first response is stored for 24 hours and replayed for retries; see Idempotency.

  • X-DPP-Dry-Run"true"headeroptional

    Optional, live keys. Validate the write in full and store nothing. Test keys always dry-run; see Test keys.

Responses

  • 200OK — Per-row results.

Errors4

POST /v1/passports/bulk-lifecycle
curl -X POST "https://dppapi-production.up.railway.app/v1/passports/bulk-lifecycle" \-H "Authorization: Bearer $DPP_API_KEY" \-H "Content-Type: application/json" \-H "Idempotency-Key: 7b3e0c52-1f7d-4b8a-9a52-2f0e6d1c9a44" \-d '{"passportIds": ["cm1q8y0bq0006l70fx9y8z7w6","cm1q8y0bq0008l70fa1b2c3d4"],"event": "putInService","date": "2027-03-01"}'
200 OK · Per-row results.
{"requested": 2,"applied": 2,"failed": 0,"results": [{ "id": "cm1q8y0bq0006l70fx9y8z7w6", "ok": true },{ "id": "cm1q8y0bq0008l70fa1b2c3d4", "ok": true }]}
POST/v1/passports/import-updates
write scope

Update many passports from matched rows

Each row is matched to an existing battery of the model by uniqueIdentifier or serialNumber and can set an in-service date, a status (waste or recycled) and readings. Readings are recorded as events of the type their field belongs to. A row that matches nothing changes nothing and is reported as not_found — this endpoint never creates batteries.

Send dryRun: true first to see how many rows match and how many of those are already published, without writing anything.

Request body3

  • modelIdstringrequired

    The model whose batteries are matched.

  • rowsarray, 1–1000required

    [{ uniqueIdentifier?, serialNumber?, putIntoServiceAt?, status?, readings? }]; readings maps field names to numbers or strings.

  • dryRunbooleanoptional

    Match and count only.

Headers2

  • Idempotency-Keystringheaderoptional

    Optional. A unique string per logical operation (a UUID is ideal). The first response is stored for 24 hours and replayed for retries; see Idempotency.

  • X-DPP-Dry-Run"true"headeroptional

    Optional, live keys. Validate the write in full and store nothing. Test keys always dry-run; see Test keys.

Responses

  • 200OK — Per-row results; changes names what was applied.

Errors4

POST /v1/passports/import-updates
curl -X POST "https://dppapi-production.up.railway.app/v1/passports/import-updates" \-H "Authorization: Bearer $DPP_API_KEY" \-H "Content-Type: application/json" \-d '{"modelId": "cm1q8x2k40003l70f9a8s7d6e","rows": [{"serialNumber": "C48-2027-0001","readings": {"cycleCount": 812,"remainingCapacity": 14.1}},{"serialNumber": "C48-2027-0002","status": "waste"}]}'
200 OK · Per-row results; changes names what was applied.
{"requested": 2,"updated": 2,"failed": 0,"results": [{ "key": "C48-2027-0001", "ok": true, "changes": ["cycleCount", "remainingCapacity"] },{ "key": "C48-2027-0002", "ok": true, "changes": ["status:waste"] }]}

Preferencias de cookies

Tú decides qué cookies se usan. Puedes cambiar tu elección en cualquier momento desde «Configuración de cookies» en el pie de página. Política de privacidad

Necesarias

Siempre activas

Imprescindibles para que el sitio funcione: tu tema claro/oscuro y esta elección de cookies se guardan en tu navegador. No sirven para rastrearte.

Analítica

Google Analytics 4 mide cómo se usan las páginas mediante estadísticas, lo que nos ayuda a mejorar el sitio. Si aceptas, instala cookies y mide tu visita por completo. Si rechazas, no instala cookies, pero Google aún puede recibir datos técnicos como la página vista, el tipo de navegador y la dirección IP.

_ga, _ga_* · hasta 2 años · Google