Skip to main content

How to design better APIs

· 7 min read
Ronald Blüthl
  1. Be consistent
  2. Use ISO 8601 UTC dates
  3. Make an exception for public endpoints
  4. Provide a health check endpoint
  5. Version the API
  6. Accept API key authentication
  7. Use reasonable HTTP status codes
  8. Use reasonable HTTP methods
  9. Use self-explanatory, simple names
  10. Use standardized error responses
  11. Return created resources upon POST
  12. Prefer PATCH over PUT
  13. Be as specific as possible
  14. Use pagination
  15. Allow expanding resources

APIs are awesome, but they're also extremely hard to design. When creating an API from scratch, you need to get many details right. From basic security considerations to using the right HTTP methods, implementing authentication, deciding which requests and responses you should accept and return, ... the list goes on.

In this post, I'm trying my best to compress everything I know about what makes a good API. An API, that your consumers will enjoy using. All tips are language-agnostic, so they apply to any framework or technology.