Skip to main content

7. Terminal Reports

Terminals report tamper events, suspicious card states, and operational errors to the backend in real time when connectivity is available. If offline, reports must be queued and sent when connectivity resumes — before the next session grant request.


POST /api/terminal-report

Report a tamper event, suspicious card state, or terminal error to the backend.

Request headers: Authorization: Bearer <terminal-token>

Request body:

{
"terminalId": 42,
"cardId": "<6-byte hex or null>",
"eventType": "tamper",
"details": "HMAC mismatch on read",
"counter": 17,
"timestamp": 1746692000
}
FieldTypeDescription
terminalIduint16Reporting terminal identifier
cardIdhex string | nullCard involved; null for terminal-level errors
eventTypestringSee event type vocabulary below
detailsstringHuman-readable description of the event (max 256 chars)
counteruint64 | nullCard write counter at the time of the event; null if unavailable
timestampuint32UTC seconds when the event occurred

Event type vocabulary:

ValueMeaning
tamperCryptographic or chain integrity check failed
replayCounter rollback or clone detected
invalid_transitionCard state transition not permitted by the state machine
session_expiredSession grant was expired at time of operation
write_failureCard write could not be verified after commit
terminal_errorInternal terminal fault (not card-related)

Response (204 No Content).

Error responses:

CodeErrorCause
400 Bad Requestmalformed_payloadMissing required fields
401 Unauthorizedinvalid_tokenBearer token missing or invalid

Backend actions on receipt

Event typeBackend action
tamperSet card status to BLOCKED_TAMPER in backend record; alert reconciliation operator
replaySet card status to BLOCKED_FRAUD; flag all recent events from this card for review
invalid_transitionLog for review; no automatic status change
session_expiredLog only
write_failureLog; flag card for next-tap validation
terminal_errorLog only

Queuing behaviour

If the terminal is offline when a report event occurs:

  1. The event is queued locally (in memory or ephemeral storage).
  2. The queue is flushed to /api/terminal-report before the next GET /api/session-grant call.
  3. If the queue cannot be flushed after 3 attempts, the terminal must require operator acknowledgement before resuming card operations.