Cerebro. разработчикам

Текст раздела — на английском, как и описания в самом API. Адрес и секрет задаёт администратор в рабочем месте: «Подключение» → «Уведомление о готовности».

Notifications to the insurer’s system

When an inspection gets its result, Survey(e)r sends a short message to the address set in the desk under «Обмен → Настройки подключения». The message says which inspection is ready and nothing about the client. The system then collects the result with its API key.

Setting an address is optional. Without it the system learns about results by asking for the list of inspections.

The message

POST <address>
content-type: application/json
surveyorai-event: inspection.result_ready
surveyorai-delivery: 95198784-c799-4949-98c5-e3c5c2655d13
surveyorai-signature: t=1790677776,v1=5f2b…

{
  "id": "95198784-c799-4949-98c5-e3c5c2655d13",
  "event": "inspection.result_ready",
  "createdAt": "2026-09-29T10:29:36.483Z",
  "inspection": {
    "id": "920f471a-f76d-40da-857a-3cc709b27a1f",
    "number": "OSM-2026-000010",
    "outcome": "rejected"
  },
  "result": "/v1/inspections/920f471a-f76d-40da-857a-3cc709b27a1f/result"
}

outcome is signed, rejected or unresolved.

A test of the connection sends the event ping, without an inspection.

Every step, when asked for

By default one message is sent per inspection or loss: when its result is ready. The administrator may ask, under «Подключение», to be told of every change of status as well. Then each change sends a message of its own:

surveyorai-event: claim.status_changed

{
  "id": "…",
  "event": "claim.status_changed",
  "createdAt": "2026-11-11T05:40:00.000Z",
  "claim": { "id": "…", "number": "UB-2026-000041", "status": "visit_assigned" },
  "href": "/v1/claims/…"
}

For an inspection the event is inspection.status_changed, with inspection in the place of claim. The message names the status come to and where the whole is read; it carries nothing of the client. A loss opened by a person at the desk is told the same way, with the status opened. The messages are signed, answered and repeated as the one of the result is; the result still has its own message, …result_ready.

Answering

Any answer with a status from 200 to 299 means the message was received. The body of the answer is not read. Answer within 10 seconds; collect the result afterwards, not while answering.

Anything else is repeated: in a minute, five minutes, half an hour, two hours and a day. After that the notification is marked as failed in the desk, where the administrator can send it again.

The same message may arrive more than once. id stays the same; a message that was already handled is answered with 200 and skipped.

Redirects are not followed.

Checking the signature

The secret is shown once, when the address is set. Every message is signed with it.

  1. Take t and v1 from surveyorai-signature.
  2. Compute HMAC-SHA256 of <t>.<body> with the secret, where <body> is the body exactly as received, before parsing.
  3. Compare the result, in hex, with v1 using a comparison that takes constant time.
  4. Refuse the message when t is more than five minutes away from the current time.
import hashlib, hmac, time

def is_genuine(secret: str, header: str, body: bytes) -> bool:
    parts = dict(part.split("=", 1) for part in header.split(","))
    expected = hmac.new(
        secret.encode(), f"{parts['t']}.".encode() + body, hashlib.sha256
    ).hexdigest()
    fresh = abs(time.time() - int(parts["t"])) <= 300
    return fresh and hmac.compare_digest(expected, parts["v1"])

The address