ByRecordDocs
byrecord.com›

Connector requirements

What your service API must offer for ByRecord to read a customer's locations and devices, suspend and restore service, and read usage, and exactly how ByRecord calls it.

This page is for the engineers who own the vendor's service API. Vendor connector explains what the connector does for a programme. This page specifies the calls and fields, and how ByRecord behaves when an answer is slow, missing or unclear.

Reference shapes

The paths and field names below are the shapes ByRecord's client reads today without changes. If your API names things differently, the client is adapted to your paths and field names when the programme is set up. The behaviour on this page stays the same.

How ByRecord calls your API

  • HTTPS and JSON. Requests send Accept: application/json, and Content-Type: application/json when they have a body. Answer with JSON. A 2xx with an empty body is read as {}.
  • One credential, sent as Authorization: Bearer <key>, for an account in your system that reaches the programme's customers only. ByRecord keeps it as a secret. If your API also needs an account or partner id on each call, it is sent as a header too.
  • 20 seconds per call. A call with no answer by then is treated as unanswered: see Unclear answers.
  • What a refusal says is kept. On a non-2xx answer, ByRecord records the status and the start of your body with the attempt, so a clear error message helps whoever reads it.

Identifiers

IdentifierRequirement
Customer idStable. Entered on the customer's account in ByRecord when it is linked to your system. A customer without one is not synced and has nothing ByRecord can suspend
Location idStable, and unique across your whole system: suspend and restore name the location alone
Device idStable, and unique across all your customers: devices are matched on it alone

Ids are strings, used exactly as you return them and URL-encoded in paths. A device whose id changes is read as a new device, and the old one as offline.

The calls

CallReference requestWhen ByRecord makes it
List a customer's devicesGET /v1/customers/{customerId}/devicesEvery sync
List a customer's locationsGET /v1/customers/{customerId}/locationsEvery sync; before a suspension of a customer with no location on file; straight after an unclear answer to a suspension
Suspend a locationPOST /v1/locations/{locationId}/suspendWhen a person at ByRecord confirms a suspension
Restore a locationPOST /v1/locations/{locationId}/restoreWhen the bill no longer justifies a suspension, when an admin restores by hand, and when a restore is retried
Usage for a periodGET /v1/customers/{customerId}/usage?from=…&to=…Hourly, one day per call. Optional
Get one deviceGET /v1/customers/{customerId}/devices/{deviceId}Not called today. Optional
Status pushYour POST to an address ByRecord gives youWhen a device's status changes, if you push. Optional

List a customer's devices

HTTP
JSON

The list may be under devices or data.

Field
idRequired. A device without one is skipped
nameShown to the customer. Without one, "Unnamed device"
statusonline, offline, degraded, pending or unknown, in any case. Anything else is unknown
typenvr, camera, pos or other. Without one, nvr
serial, model, firmwareOptional strings
cameraCountOptional, a number
lastSeenAtOptional, ISO 8601
locationId, locationNameThe location the device is at. A locationId ByRecord has not seen creates the location, named locationName
Anything elseKept with the device, as you returned it

What each status means to ByRecord:

StatusFor uptime
onlineUp
degradedUp: the device is still working
offlineDown
pending, unknownNot measured

List a customer's locations

HTTP
JSON

The list may be under locations, sites or data.

Field
idRequired. A location without one is skipped
nameTaken when ByRecord first learns of the location. Later renames are not followed
statusWhether you are providing service there: active or suspended. Anything else is read as unknown, and an unknown state is never taken as a reversal of a suspension

Every location you list becomes one of the customer's locations in ByRecord, whether or not it has a device. This listing is also how ByRecord checks the result of a suspension and notices a change made on your side, so list every location the customer has, with its real state.

Suspend and restore a location

HTTP
JSON
HTTP
JSON
  • reason, on a suspension only, is the reason the person who confirmed it gave, passed on for your records.
  • status in your answer is the location's state after the call.
  • reference is your reference for the change, if you have one. It is kept with the attempt and quoted in the email report to your service team.

How your answer is read

Your answerByRecord takes it as
2xx whose status is the state asked for: suspended for a suspend, active for a restoreDone
2xx that names no state ByRecord can read, or has an empty bodyDone
2xx whose status is the other stateNot done
4xxRefused: you said no
5xx, no answer within 20 seconds, or a dropped connectionUnclear: you may have made the change

Every attempt is recorded with its answer, refusals included, and ByRecord's staff are alerted to every location that did not change.

Answer once the change has taken effect. A 2xx is taken as done there and then. If you answer a suspension before it applies and your next listing still shows the location in service, that reads as a change made on your side. If you answer a restore before it applies, ByRecord holds the location as back in service while it is not.

Unclear answers

A timeout, a dropped connection or a 5xx is not taken as a refusal, because the change may have been made before the answer was lost.

For a suspension:

  1. ByRecord lists the customer's locations straight away.
  2. Listed suspended: the suspension is done.
  3. Listed active: it is not done.
  4. No answer, or a state it cannot read: the location is held as unconfirmed. A restore will then ask you to restore it whatever happened, and the next sync settles it. Listed suspended, it is taken as ByRecord's suspension, so a payment restores it. Listed in service, it never happened.

For a restore, the location stays held as suspended until a restore is answered as done, and the restore is retried.

Make both calls idempotent

ByRecord sends no idempotency key to your API. Make both calls idempotent by outcome: suspending a location that is already suspended, or restoring one already in service, should answer 2xx with its current state. Both happen:

  • a person may confirm a suspension again after an answer that was refused or unclear;
  • a restore is sent for a location whose suspension was unclear, whether or not the suspension took effect.

ByRecord does not call suspend for a location it already holds suspended, and never calls restore for a location it did not suspend: a location you suspended for your own reasons is left alone.

Usage

Optional. Without it, usage on the customer's home page reads "not available yet".

HTTP
JSON
  • from and to are UTC midnights, one day apart: the period is [from, to).
  • recordedHours and events are both required. A report missing either is no report: half a figure shown as a total would be a guess.
  • eventsByType is optional: counts by kind of event.
  • Answer 404 when you have no figure for the period yet. The customer sees "not available yet", never zero.

Get one device

Optional. GET /v1/customers/{customerId}/devices/{deviceId}, answering one device in the shape above (bare, or under device), or 404 when the device no longer exists. It is part of the connector's interface, but the platform does not call it today.

Status push

Optional. The sync already finds every change by polling; a push only makes a status change arrive sooner. It is off until ByRecord sets up a shared secret for it, and the address answers 404 until then.

HTTP
  • The signature is the hex HMAC-SHA256 of the raw body, keyed with the shared secret. The sha256= prefix is optional. The header's name comes with the address.
  • at is when the status changed, in ISO 8601. An event without one is dropped: it cannot be ordered against what ByRecord already knows.
  • status is online, offline, degraded or pending. An event with any other status is dropped.
  • Up to 1 MB per request.
JavaScript

Only news is applied. An event is applied only if it is newer than anything ByRecord already knows about the device: its last status change, or its last status from a sync or an earlier push. One that arrives late, out of order or again changes nothing, so a retried or replayed push is harmless. An event dated more than an hour ahead of ByRecord's clock is ignored, and so is a device ByRecord does not have: it is never created from a push.

ByRecord answersMeaning
200 with { "received": 1, "applied": 1 }Read. received is how many events it could read, applied how many were news
400The body is not JSON
401The signature does not match. Check the secret, and that you sent exactly the bytes you signed
404Status push is not switched on
500ByRecord could not process it. Retry

Timeouts and retries

CallIf it fails
List devices or locationsThat customer's sync fails and is recorded. The next sync asks again. If only the locations fail, the devices are still synced
SuspendNever retried automatically. A suspension is a person's decision: after a failure, a person may confirm it again while the bill still justifies it
RestoreRetried until it is answered as done, no more often than every 30 minutes
UsageThe missing day is asked for again on the next hourly pass

Locking and concurrency

  • One customer at a time. A suspension or restore takes a lock on the customer's account and asks for each location in turn, in a fixed order. Two changes for one customer never interleave: a double click, or a person and a scheduled job acting at once, wait for each other.
  • Different customers can overlap. Calls for two customers can reach you at the same time.
  • Reads are ordered against changes. A location only counts as put back in service on your side if ByRecord suspended it before it asked for the listing, so a listing already in flight during a suspension is never read as a reversal.

Sync cadence

  • Devices and locations every 15 minutes by default, for every customer linked to your system, suspended ones included: a sync is how a change on your side is noticed. For each customer, devices are listed first, then locations.
  • On demand for one customer, when the customer or ByRecord's staff refresh its devices. Its locations alone are also listed before a suspension of a customer with no location on file.
  • Usage hourly, one call per customer per UTC day. Days missing from the last 60 (never before the customer's first device was seen) are asked for, and the two most recent days are asked for again on every pass, since they may be revised.
  • Every sync run is recorded with its errors, so a failing integration shows on ByRecord's health page instead of failing silently.

What ByRecord concludes from your answers

You answerByRecord concludes
A device from an earlier list is missing from this oneIt is offline. Devices are never deleted, so their history survives
An empty device listNothing. That time is left unmeasured: an empty answer is far more often a bad response than every device gone
A device id ByRecord holds under another customerThe device has moved to this customer
A location listed active that ByRecord holds suspendedA change made on your side. It is recorded, ByRecord's staff are told, the account is held so nobody suspends it again before talking to you, and service.reversed is sent
A location listed suspended that ByRecord did not suspendYours. ByRecord never restores it
A location state ByRecord cannot readUnknown. Never taken as a reversal
A customer's first device online on a signed deal waiting for installationThat day is proposed as the installation date, for a person to confirm. Billing never starts from it on its own

What you hear back

  • Your service team gets an email the same minute for every suspension and restore, and a Slack message if you want one: the customer, the locations with your ids, the reason, who decided, and when. The email also quotes your reference for each change. If neither gets through, ByRecord's staff are told to tell you by hand.
  • Your systems get service.suspended, service.restored and service.reversed as webhooks, with your location ids in data.locations.

Setting it up

You give ByRecord:

  • the base URL of your API, and a credential that reaches the programme's customers only;
  • your paths and field names, where they differ from the reference shapes on this page;
  • whether your API needs an account or partner id on each call;
  • your customer id for each customer, to link its account in ByRecord;
  • the email address for service reports, and a Slack webhook if you want them in Slack too.

ByRecord gives you, if you push device status, the address to push to, its signature header and the shared secret.

The sandbox never calls your API: a mock stands in for it there. See Sandbox and testing.

© 2026 ByRecord · byrecord.com · Status