Operations, Security & Audit
Guidelines for production administration, database backups, key rotation, and audit logs.
1. API Key Rotation
Nicolás De Lauretis can rotate ingestion credentials at any time:
- Issue a
POST /v1/finances/api-keyscall with a newnameandrawKey. - Update GrokBot or Mango with the new key.
- Deactivate or delete the previous key in Cloudflare D1:
UPDATE api_keys SET active = 0 WHERE id = 'key_old_id';
2. Audit Logging & PII Sanitization
All incoming requests are logged at the edge without sensitive personal data:
- Logged: Request UUID, HTTP method, path, response code, execution duration.
- Sanitized / Redacted:
X-API-KeyandAuthorizationheaders.- Raw JSON request payloads and transaction notes.
- Sensitive merchant details.
3. Database Maintenance & Backups
Cloudflare D1 automatically captures point-in-time snapshots.
- To inspect database status via Cloudflare CLI:
npx wrangler d1 info FINANZAS_DB
- To export a point-in-time snapshot of the database:
npx wrangler d1 export FINANZAS_DB --output=backup-$(date +%F).sql
4. Disaster Recovery
In case of a regional partition or corrupted sync:
- Re-run schema initialization:
await db.ensureSchema(). - Resync from Notion: Since Notion is the operational source of truth, GrokBot can replay the historical ledger with revision counters to rebuild D1 state without data loss.