API authentication
SellTraces has two user authentication modes for public API routes.Bearer tokens
CLI and machine clients authenticate with:- CLI device login through
POST /api/cli/device/startandGET /api/cli/device/poll
Browser session cookies
Browser flows authenticate with the Better Auth session cookie:Auth modes by endpoint
| Auth mode | Meaning |
|---|---|
none | Public route or pre-auth flow |
cookie | Signed-in browser session required |
bearer | Machine bearer token required |
cookie-or-bearer | Either a signed-in browser session or bearer token |
Device login endpoints
Start a device login:202; approved polls return 200 with a bearer token.
Check the current authenticated CLI session:
200 with the authenticated userId; missing or expired credentials return 401.
Better Auth delegation
/api/auth/{path} is delegated to Better Auth. SellTraces owns the mount and route coverage, while Better Auth owns the internal auth sub-route contracts. Generated reference pages cover the GET delegate and POST delegate.