Skip to content
FastOMR
Product How it works Pricing Help
English
  • English
  • Türkçe
  • Español
  • Português (Brasil)
  • Français
  • Deutsch
  • العربية
Sign in
Product How it works Pricing Help Sign in

Webhooks

FastOMR can tell another system when something happens, instead of that system asking. This is the document for whoever writes the receiving end.


What is sent

Five events. The list is short on purpose: every event nobody consumes is a payload shape that has to keep working forever.

Event When
batch.completed Every sheet in one upload has finished processing. The handover point: everything before it is the operator's work and everything after is yours.
sheet.needs-review One sheet came back needing a person. Sent per sheet, because the point of knowing is to put it in somebody's queue.
project.status-changed An exam moved between draft, ready, collecting and closed.
project.rescored Every score of an exam was recomputed without a batch finishing — an objection accepted a second option, a question was cancelled, the roster arrived late, a section was redrawn. Pull the results again; the ones you hold are stale.
sheet.reviewed A person finished with one sheet — the counterpart of sheet.needs-review, with the identity and score the sheet now has. Also sent for a sheet corrected without ever being flagged.

Every delivery is a POST with a JSON body of the same shape:

{
  "id": "3f0c9d4e-2b7a-4e61-9a55-0c1d2e3f4a5b",
  "event": "batch.completed",
  "organizationId": "01a0736c-5e52-7159-b4e3-f921b9a2ee2b",
  "occurredAt": "2026-09-09T12:02:53.209Z",
  "data": {
    "batchId": "01a0860c-…",
    "projectId": "01a0736c-…",
    "status": "COMPLETED",
    "sheets": { "total": 120, "processed": 118, "needsReview": 2, "failed": 0 }
  }
}

data differs per event; the fields around it do not. id is the event's own: the same on every attempt, forevery endpoint told about it, and when a delivery is sent again by hand — so store the ids you have processed and ignore one you have seen. A delivery is tried until you answer 2xx, and an answer lost on the way back means the same event arrives twice.

  • batch.completed — as above: { "batchId", "projectId", "status", "sheets": { "total", "processed", "needsReview", "failed" } }. A batch can be announced more than once: an upload is often several requests into one batch, and when the first requests' sheets are read before the next arrives — a slow connection — the batch is complete for a moment and says so; the sheets that follow reopen it, and it is announced again, with the counts for the whole batch, once they are read. Treat the event as "this batch now stands at these counts" and key it by batchId.
  • sheet.needs-review — { "sheetId", "batchId", "projectId", "confidence", "warnings", "studentId" }. warnings is the list of codes the reader raised — STUDENT_ID_UNREADABLE, DUPLICATE_SHEET, ROSTER_NAME_MISMATCH, SHEET_FROM_ANOTHER_EXAM and the rest of RECOGNITION_WARNING_CODES in @fastomr/contracts — so a queue can route by reason; studentId is the number as read, which may be null or carry a ? for an unread column.
  • project.status-changed — { "projectId", "from", "to" }, the states being DRAFT, READY, COLLECTING, CLOSED, ARCHIVED.
  • project.rescored — { "projectId", "reason", "scored", "blocked" }, where reason is one of ANSWER_KEY, SCORING_RULE, SECTIONS, ROSTER, MANUAL and blocked counts the sheets that could not be scored (no key for their booklet, no booklet read).
  • sheet.reviewed — { "sheetId", "projectId", "status", "studentId", "bookletCode", "score", "net", "percent", "passed" }; the score fields are null when the sheet still cannot be scored. percent is the score as a share of the exam's maximum; passed is the verdict against the exam's pass mark, and null when the exam has none.

One more body arrives, only when somebody presses Send a test on the endpoint: "event": "ping" with data: { "webhookId": "…" }, signed like the rest and not retried. Treat it as a delivery you may ignore — but answer it, because the person pressing the button is reading your status code and the time you took.


Verifying that it came from FastOMR

A webhook endpoint is a public address on your server. Anyone who learns it can post to it, and the forgery is the easy one to send — so check the signature before you trust the body.

Three headers come with every delivery:

Header Contents
X-FastOMR-Signature sha256= followed by the HMAC-SHA256 of the signed material, in hex
X-FastOMR-Timestamp Unix seconds at the moment of signing
X-FastOMR-Delivery The delivery's id, the same on each of its attempts (the test ping has none); the event's id is the body's id

The signed material is the timestamp, a period, then the raw body:

1788692000.{"event":"batch.completed",…}

The raw body — the bytes as they arrived. Parsing the JSON and re-serializing it produces different bytes and a signature that will not match.

import { createHmac, timingSafeEqual } from 'node:crypto';

const expected = `sha256=${createHmac('sha256', SECRET)
  .update(`${req.headers['x-fastomr-timestamp']}.${rawBody}`)
  .digest('hex')}`;

const given = req.headers['x-fastomr-signature'] ?? '';
const ok = expected.length === given.length && timingSafeEqual(Buffer.from(expected), Buffer.from(given));

timingSafeEqual, not ===. A string comparison returns as soon as two characters differ, and how long it took measures how many leading characters were right; repeated, that recovers a signature one character at a time.

Also check the age. The timestamp is inside the signed material so that a captured delivery cannot be replayed forever — but that only helps if you look at it. Reject anything more than a few minutes old:

if (Math.abs(Date.now() / 1000 - Number(timestamp)) > 300) return reject();

The secret

Shown once, when the endpoint is created and again when the secret is rotated. It is never shown a second time: a signing secret readable from a list is a signing secret every member of the organization has.

Rotating takes effect immediately. Until the receiving system has the new secret, every delivery to that endpoint fails verification — so put the new one in place first, or accept a gap.


What happens when your endpoint is down

The delivery is queued, never sent inside the request that caused it: your endpoint being slow must not slow down an exam.

  • A 2xx is success.
  • A timeout, a refused connection, a 5xx, a 408, a 425 or a 429 is tried again — ten attempts over about a day: a minute after the first failure, then 5, 15 and 30 minutes, 1, 2, 4, 6 and 10 hours, each pause varied by up to a fifth so that an outage's backlog does not return all at once. A Retry-After you send (seconds, or an HTTP date) is honored when it is longer than the pause, up to six hours.
  • Any other 4xx is not retried. You understood the request and rejected it; sending it again helps nobody and looks like an attack from our end.

Ten seconds per attempt. Redirects are not followed — a 30x to somewhere else would send a school's exam data to an address nobody registered.

Every attempt is recorded and shown on the webhooks screen: each delivery's state (waiting, retrying — with the time of the next attempt —, delivered or failed), the last status, the number of attempts and the error. The failure mode this exists to prevent is silence: the sender believes it sent, the receiver never knew, and nobody looks until a term's results are missing from the other side. The record is kept for ninety days — the screen shows the last fifty, and a row from last term answers nothing while still carrying the payload it was signed with. When a student's data is erased, their number and marks are taken out of the payloads kept here — the delivery stays, and says only which event was sent — since a stored payload is a copy of the result the erasure removes; what was already delivered is in the receiver's hands, which the school tells the receiver about, as it would for any other export.

A failed delivery can be sent again from that list (Send again), once the receiver is fixed. It goes as a new delivery of the same event: a new X-FastOMR-Delivery, the same body id.

An endpoint that keeps failing is followed up. Once it has been failing for an hour and a delivery has been given up, the organization's owners and administrators get a letter saying since when, once for the run of failures. After five days of failures the endpoint is paused — nothing more is sent to it — and they get a second letter. Every event of those five days was already given up after its own day of attempts; what the pause stops is ten attempts per event at an address nobody answers. Resume the endpoint on the webhooks screen once the receiver is fixed; the run of failures starts from zero.


Requirements on the address

In production the address must use https and must not be on a private network — loopback, link-local, or the RFC 1918 ranges. A webhook is an outbound request the server makes to wherever it is told, which is a request-forgery primitive when unconstrained: pointed at 169.254.169.254 it would read cloud credentials on the caller's behalf, and pointed at loopback it would ask this API itself, from inside.

Both rules are relaxed in development, where testing against a local receiver is the ordinary case rather than an attack.

The address is checked twice. At registration the host is read the way the URL parser reads it, so https://2130706433/ and https://0x7f.0.0.1/ are the loopback address they spell. At delivery the connection itself refuses to open towards a private address — whether the host was written as an address or is a name that resolves to one, including a record changed after the endpoint was registered. That is also why redirects are not followed.


Limits

The plan sets how many endpoints an organization may register — five on PRO, twenty-five on ENTERPRISE. FREE has none.

An organization whose plan falls to one without webhooks — a trial that ends, a period that ends unpaid or cancelled — keeps its endpoints, so that upgrading again brings them back as they were, but is sent no events while the plan lacks them; a test ping or a redelivery is refused with 402 PLAN_FEATURE_UNAVAILABLE. The same holds for API keys: kept, and refused with the same code until the plan includes API access again. A plan changed by hand to one with fewer is refused until the extra endpoints or keys are removed.

FastOMR

Answer sheets designed, printed, read and scored.

Product

  • Product
  • Pricing
  • Help
  • Developers
  • Sign in

Legal

  • Terms of Service
  • Privacy Policy
  • Cookie Policy
  • Data Processing Agreement
  • Subprocessors
  • Refund Policy
  • Company Information
  • Accessibility Statement
  • Security

Contact

  • support@fastomr.com

Language

  • English
  • Türkçe
  • Español
  • Português (Brasil)
  • Français
  • Deutsch
  • العربية

© 2026 FastOMR. All rights reserved.