# Oikos API A Node.js/Express API for tracking people, notes, and tags, with user authentication and audit history. ## Authentication - All `/api/` routes require an API key as the `auth` query parameter. The key must be a valid 32-character API key from the `users` table. ## Endpoints ### People - `GET /api/person?search=...&tag=...&limit=...` — List/search people - `GET /api/person/:id?notes_limit=...` — Get person by ID, with up to N notes - `POST /api/person` — Create person - `PUT /api/person/:id` — Update person - `DELETE /api/person/:id` — Delete person ### Notes - `GET /api/note?search=...&tag=...&person_id=...&limit=...` — List/search notes - `GET /api/note/:id` — Get note by ID - `POST /api/note` — Create note (with person_ids) - `PUT /api/note/:id` — Update note (and person_ids) - `DELETE /api/note/:id` — Delete note ### Tags - `GET /api/tag/:tag` — Get all people and notes with a tag ### Entries / Events - `GET /api/entry/since/:timestamp` — Get all events from the `entries` table that have occurred after the given timestamp. The `:timestamp` must be a string in SQLite-compatible date format (e.g., `YYYY-MM-DD HH:MM:SS` or ISO 8601). Optional query parameter: `entity=person` or `entity=note` to filter by type. The `data` column is not included in the response. ## Data Format - Tags are always returned as arrays of strings. - Notes list the person IDs they are assigned to. - Person records can return a specified number of associated notes. ## History - All changes/deletes to people and notes are archived in the `entries` table. ## Setup 1. Install dependencies: `npm install` 2. Set up your SQLite DB using the provided schema. 3. Set `DB_PATH` in `.env` if needed. 4. Start the server: `npm start` --- For more details, see the code and database schema.