Skip to content

v0.1.0 — API keys and read-only /api/v1

Latest

Choose a tag to compare

@timothydodd timothydodd released this 30 Oct 18:23
· 8 commits to main since this release

Per-user API keys and a read-only /api/v1

Each user can now generate personal API keys under User Settings → Account → API Keys and use them from scripts and test suites to read their mail and webhook captures.

What's new

  • API key management in the web app: generate a named key (shown once, copy button), see prefix / created / last used, delete.
  • GET /api/v1/mail — to, search, page, pageSize, sortBy, sortDirection query params; returns { items, totalCount }.
  • GET /api/v1/mail/{id}, GET /api/v1/mail/boxes
  • GET /api/v1/webhooks/buckets, /buckets/{name}, /buckets/{name}/webhooks, /webhooks/{id}
  • Send the key as X-Api-Key: <key>, Authorization: Bearer <key> or Authorization: ApiKey <key>.
  • A key sees exactly what its owner sees in the UI (same mail-group and bucket rules) and is read-only: nothing under /api/v1 can modify or delete data, and personal keys are rejected on the session routes.
  • Only a SHA-256 hash of each key is stored (UserApiKey table, created automatically on startup). Deleting a key revokes it immediately.

Testing

KEY=mv_...
curl -H "X-Api-Key: $KEY" "https://<host>/api/v1/mail?pageSize=10"
curl -H "X-Api-Key: $KEY"  https://<host>/api/v1/webhooks/buckets

Docker images: ghcr.io/timothydodd/mailvoid:54113e1 / :latest and ghcr.io/timothydodd/mailvoid-smtp:54113e1 / :latest (published by the Go workflow for this commit).