Designing an API with keys, logging and error reporting?


I’m looking at building a fairly simple public API with the following features:

  • multiple endpoints
  • user API key required
  • logging of requests to power basic stats dashboard
  • error reporting for requests that fail
  • versioning (potentially)

Any pointers on how to best go about this?
Use workers KV store for the user API keys?
Log to an external service?