Good API design is crucial for developer experience. This document outlines the core principles we follow when designing REST APIs.
URLs should represent resources, not actions. Use HTTP methods to indicate the action.
Good:
Bad:
Always use plural nouns for consistency.
Express relationships through URL hierarchy.
Use query parameters for filtering, sorting, and pagination.
Always version your APIs. We prefer URL versioning.
Return consistent error responses with appropriate HTTP status codes.
{
"error": {
"code": "VALIDATION_ERROR",
"message": "Email format is invalid",
"field": "email"
}
}
Implement rate limiting and communicate limits via headers:
Following these principles leads to APIs that are intuitive, consistent, and easy to maintain. Remember: the best API is one that developers can use without reading documentation.