Scan Barcode
Method
GET
Auth
JWT (user)
Effect
Lookup barcode via whitelist
Response
{ id, isBoycott }
| Component | v3 |
|---|---|
| Entry endpoint | n/a |
| Primary store | Directus |
| Exact barcode lookup | n/a |
| External enrichment | n/a |
| Auth | API key for admin tools |
System Context
Sequence
Scan Flow
The API validates the barcode, checks the whitelist tables for a match, and asynchronously enriches via external providers (Go-UPC, Open Food Facts). Returns { id, isBoycott } or 404.
See also
- Deep dive: Barcode Matching
- Data model: Turso Entities
- API reference: OpenAPI
Quickstart (v3)
- cURL
- JavaScript
curl -H "Authorization: Bearer <JWT>" \
https://nothanks-api.bashsquare.com/v3/users/<device_id>/scan/4800361005500
const res = await fetch(
`https://nothanks-api.bashsquare.com/v3/users/${deviceId}/scan/${barcode}`,
{ headers: { Authorization: `Bearer ${token}` } },
);
const data = await res.json();
Response:
{ "id": 42, "isBoycott": true }