PUREPOLIS API

Backend for the PUREPOLIS app — API only, no UI of its own. The frontend is served by its own nginx, which proxies /api here (Vite does the same in dev).

Status details are hidden outside development.

Routes

POST /api/auth/signup
curl -i -b cookies.txt -c cookies.txt -X POST -H "Content-Type: application/json" -d '{"email":"you@example.com","password":"correcthorse123"}' https://backend.nowaycity.purepolis.grisenergia.pt/api/auth/signup
POST /api/auth/login
curl -i -b cookies.txt -c cookies.txt -X POST -H "Content-Type: application/json" -d '{"email":"you@example.com","password":"correcthorse123"}' https://backend.nowaycity.purepolis.grisenergia.pt/api/auth/login
POST /api/auth/logout
curl -i -b cookies.txt -c cookies.txt -X POST https://backend.nowaycity.purepolis.grisenergia.pt/api/auth/logout
GET /api/me
curl -i -b cookies.txt -c cookies.txt -X GET https://backend.nowaycity.purepolis.grisenergia.pt/api/me
PATCH /api/me
curl -i -b cookies.txt -c cookies.txt -X PATCH -H "Content-Type: application/json" -d '{"name":"Alice","homeArea":"Centre-ville","ageGroup":"25-34","gender":"female","mobilityMode":"Cycling","onboarded":true}' https://backend.nowaycity.purepolis.grisenergia.pt/api/me
DELETE /api/me — Deletes the account — cascades reports/surveys.
curl -i -b cookies.txt -c cookies.txt -X DELETE https://backend.nowaycity.purepolis.grisenergia.pt/api/me
PATCH /api/me/consents
curl -i -b cookies.txt -c cookies.txt -X PATCH -H "Content-Type: application/json" -d '{"gps":true,"research":true,"activeContributor":true}' https://backend.nowaycity.purepolis.grisenergia.pt/api/me/consents
GET /api/reports
curl -i -b cookies.txt -c cookies.txt -X GET https://backend.nowaycity.purepolis.grisenergia.pt/api/reports
POST /api/reports
curl -i -b cookies.txt -c cookies.txt -X POST -H "Content-Type: application/json" -d '{"type":"air","typeLabel":"Air Pollution","comment":"Smells bad here","lat":47.2138,"lng":-1.5561}' https://backend.nowaycity.purepolis.grisenergia.pt/api/reports
DELETE /api/reports/1 — Only deletes if it belongs to the caller.
curl -i -b cookies.txt -c cookies.txt -X DELETE https://backend.nowaycity.purepolis.grisenergia.pt/api/reports/1
GET /api/surveys
curl -i -b cookies.txt -c cookies.txt -X GET https://backend.nowaycity.purepolis.grisenergia.pt/api/surveys
POST /api/surveys
curl -i -b cookies.txt -c cookies.txt -X POST -H "Content-Type: application/json" -d '{"answers":{"air-quality-rating":"good"}}' https://backend.nowaycity.purepolis.grisenergia.pt/api/surveys
DELETE /api/surveys/1
curl -i -b cookies.txt -c cookies.txt -X DELETE https://backend.nowaycity.purepolis.grisenergia.pt/api/surveys/1
GET /api/leaderboard — Anonymized — anon_handle only, never email/name.
curl -i -b cookies.txt -c cookies.txt -X GET https://backend.nowaycity.purepolis.grisenergia.pt/api/leaderboard