Logging and Request IDs
Last reviewed: 2026-05-13
Maintained by: Engineering
The API attaches a request ID to inbound traffic and carries that ID through logs and JSON responses.
Current behavior
x-request-idis accepted from the client when present- otherwise the API generates a UUID
- the response echoes
x-request-id - JSON payloads include
requestIdwhen the payload is an object - request completion logs include method, path, status code, duration, and request ID
Key implementation areas
- request context middleware:
apps/api/src/middlewares/request-context.ts - request logging middleware:
apps/api/src/middlewares/request-logger.ts - logger implementation:
apps/api/src/lib/logger.ts - response envelope helpers:
apps/api/src/lib/response-envelope.ts