API authentication

SellTraces has two user authentication modes for public API routes.

Bearer tokens

CLI and machine clients authenticate with:
Bearer tokens can come from:

Browser session cookies

Browser flows authenticate with the Better Auth session cookie:
Dashboard pages, upload pages, and browser-driven API calls use this session path.

Auth modes by endpoint

Device login endpoints

Start a device login:
Poll until the browser approval completes:
Pending polls return 202; approved polls return 200 with a bearer token. Check the current authenticated CLI session:
Valid sessions return 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. Delegated auth internals are not included in the generated SellTraces/Rebates public API reference.