Webhooks
Register an HTTPS endpoint and lockapi will POST every matching event to it as it happens, instead of you having to poll. Deliveries are signed, retried with backoff on failure, and fully independent per endpoint — you can register as many as you like.
Register an endpoint
POST /v1/webhook_endpoints
{
"url": "https://yourapp.com/hooks/lockapi",
"subscribedEvents": ["access_code.unlocked", "access_code.verification_failed"],
"description": "production"
}
→ {
"id": "we_123",
"url": "https://yourapp.com/hooks/lockapi",
"subscribedEvents": [...],
"enabled": true,
"secret": "whsec_...",
"createdAt": "..."
}secret is returned exactly once, at creation time — store it now. Every later GET/PATCH on that endpoint omits it entirely; there is no way to retrieve it again, only to delete the endpoint and create a new one. Use subscribedEvents: ["*"] to receive every event type.
GET, PATCH (toggle enabled, change url/subscribedEvents), and DELETE /v1/webhook_endpoints/:id round out the CRUD surface.
Verifying the signature
Every delivery carries a Lockapi-Signature: t=<unix timestamp>,v1=<hmac hex> header, Stripe-style. The signed payload is the literal string ${t}.${rawBody}, HMAC-SHA256'd with your endpoint's secret — verify against the raw request body, not a re-serialized copy of the parsed JSON.
import crypto from 'crypto';
function isValid(secret, rawBody, header) {
const [tPart, v1Part] = header.split(',');
const t = tPart.split('=')[1];
const v1 = v1Part.split('=')[1];
const expected = crypto.createHmac('sha256', secret).update(`${t}.${rawBody}`).digest('hex');
return crypto.timingSafeEqual(Buffer.from(v1), Buffer.from(expected));
}Delivery body
{
"id": "evt_123",
"type": "access_code.unlocked",
"occurredAt": "2026-07-07T13:42:44.629Z",
"data": { ... }
}Event types today
Currently emitted from the remote unlock flow:
access_code.unlocked— a REMOTE code was submitted, matched, and the lock confirmed unlocked.access_code.unlock_uncertain— the vendor accepted the unlock command but lockapi couldn't confirm the physical state change.access_code.verification_failed— a wrong code was submitted against a REMOTE code (payload includes the runningfailedAttemptscount and whether this attempt triggered auto-revoke).access_code.unlock_infra_error— the vendor/bridge was unreachable; not counted against the guest's attempt budget.access_code.locked— a remote lock command was submitted and the lock confirmed locked.access_code.lock_uncertain— the vendor accepted the lock command but lockapi couldn't confirm the physical state change.access_code.lock_infra_error— the vendor/bridge was unreachable during a remote lock attempt.
Keypad codes on vendors that create them asynchronously (Nuki) can be returned with status: "PENDING"when the lock hasn't confirmed them yet. You'll then get one of:
access_code.activated— the lock confirmed the code; it is nowACTIVE.access_code.failed— the lock didn't confirm the code within 15 minutes (bridge or lock offline?). Issue a new code; if the old one reaches the lock later, lockapi removes it automatically.
Events reported by the hardware itself (currently Nuki):
access_code.used— a guest entered a keypad code on the lock.device.low_battery— the lock, keypad or door sensor battery is critical (at most once per device per day).
Retries
A non-2xx response or a request that times out (10s) is retried up to 6 times with exponential backoff (1m, 5m, 30m, 2h, 12h). After the final attempt the delivery is marked EXHAUSTED and not retried again. Disabling or deleting an endpoint stops any deliveries still queued for it.