Devices & Gateways

Device provisioning, gateway claiming, and DER management endpoints.

Gateway Claiming

Gateways (Zaps) must be claimed into an organization before they can relay device data. Claiming binds a physical Zap to your org.

Claim Gateway

POST /gateways/claim

Request Body:

{
  "org_id": "org-abc123",
  "gateway_serial": "zap-04772a97",
  "public_key": "gateway-es256-public-key",
  "message": "claimer_id|nonce|timestamp|gateway_serial",
  "signature": "es256-signature-of-message"
}

The message must be signed by the gateway's ES256 private key (obtained via the Zap Local API at /api/crypto/sign).

Key rules:

  • A gateway can only belong to one organization at a time
  • Re-claiming a gateway to a different org transfers ownership
  • Devices on a reclaimed gateway become orphaned in the old org
  • Re-claiming to the same org is a no-op (idempotent)

See Gateway Claiming Guide for a step-by-step walkthrough.

List Gateways

GET /gateways?org_id=org-abc123

Release Gateway

DELETE /gateways/{serial}

Device Provisioning

After claiming a gateway, provision devices (physical hardware) and their DERs to a site.

Provision Device

POST /devices/provision

Request Body:

{
  "gateway_serial": "zap-04772a97",
  "hardware_id": "SN12345",
  "device_type": "inverter",
  "site_id": "sit-abc123",
  "name": "Sungrow Inverter",
  "manufacturer": "Sungrow",
  "model": "SH10RT",
  "ders": [
    { "name": "pv-array", "type": "solar" },
    { "name": "battery_1", "type": "battery" }
  ]
}

Device type → Allowed DER types:

Device TypeAllowed DER Types
invertersolar, battery, meter
batterybattery, meter
ev_chargerev_charger_port
v2x_chargerev_charger_port
energy_metermeter

Get Device

GET /devices/{device_id}

Update Device

PUT /devices/{device_id}

Request Body:

{
  "name": "Updated Device Name"
}

Delete Device

DELETE /devices/{device_id}

DER Endpoints

Get DER

GET /ders/{der_id}

Create DER

POST /devices/{device_id}/ders

Request Body:

{
  "name": "pv-mppt2",
  "type": "solar"
}

Knowledge gap for Johan: Verify all endpoint paths and request/response schemas. Is device provisioning automatic when the gateway discovers devices, or always manual?