All routes are Next.js App Router API routes under src/app/api/.
Implicit device login. Creates a user if the device ID is new.
Body: { deviceId: string }
Response: { token: string } (JWT session cookie set automatically)
Get current user profile.
Headers: Cookie: session=<jwt>
Update user settings (primary store, location).
Headers: Cookie: session=<jwt>
Main pipeline. Accepts a base64 image, returns matched items with prices and savings.
Body: { image: string (base64) }
Response:
{
"items": [
{
"name": "string",
"brand": "string",
"price": 0.00,
"bestPrice": 0.00,
"bestStore": "string",
"savings": 0.00,
"matched": true
}
],
"unmatched": ["string"],
"totalSavings": 0.00
}Manually resolve an unmatched item to a database product.
Body: { rawText: string, productId: string }
Batch operations on the shopping list.
Get product catalog.
Query: ?limit=50&offset=0
Fuzzy search products.
Query: ?q=bananas&limit=10
Get prices for a specific product.
Query: ?productId=<id>
Batch price comparison for multiple products.
Query: ?productIds=id1,id2,id3&homeStoreId=<id>
Get active flyer deals.
Query: ?storeId=<id>&limit=50
Get nearby stores.
Query: ?lat=43.65&lon=-79.38&radius=10
Health check. Returns { status: "ok" }.
Most /api routes (except /api/health, /api/auth/*, and /api/scan/*) require a valid session cookie containing a JWT signed with JWT_SECRET.
The middleware at src/middleware.ts validates the session using jose with HS256.