Documentation

Relay routes

Mount one router and get every route the browser SDK (@touchque/web) calls: two-phase POST /login, enrollment, offline codes and passkey ceremonies. Available in every server SDK: Node (touchqueRouter), Python (Flask / FastAPI / Django), PHP (Laravel, or RelayHandler on its own), Go (net/http), .NET (MapTouchqueRelay), Java (the Spring Boot starter) and Ruby (Touchque::Rack::Relay for Rails and Rack).

Always set the login user option (the user who passed your password step). Without it the username comes from the request body, and the offline routes stay off (403).
RouteNotes
POST /login202 + step + token until approved
/enroll/start, /enroll/statusSigned-in user; never replaces a linked phone (409)
/offline/*Only with the login user option
/passkey/*Passwordless sign-in, approve with passkey, manage passkeys

Pre-auth routes are rate limited per IP (20/min) and per username (5/min) out of the box.

Mount the relay
const { Touchque, touchqueRouter } = require('@touchque/node');
const tq = new Touchque(); // TQ_API_KEY / TQ_API_SECRET

app.use('/touchque', touchqueRouter(tq, {
  getUserId: (req) => req.session.user,                    // signed-in user
  getLoginUser: (req) => req.session.passwordVerifiedUser, // user who passed your password step
  onAuthenticated: (req, res, info) => { req.session.user = info.externalUsername; },
}));