REST API Naming Conventions: URLs, Methods, and JSON Keys
6 min read
A well-named REST API is intuitive, consistent, and self-documenting. These conventions are followed by most production APIs.
URL Path Conventions
- Use kebab-case or lowercase for URL paths:
/user-profiles - Use plural nouns for collections:
/users,/orders - Use resource IDs for individual items:
/users/123 - Nest sub-resources:
/users/123/orders - Avoid verbs in URLs:
POST /usersnotPOST /create-user
HTTP Methods
| Method | Purpose | Example |
|---|---|---|
| GET | Read | GET /users/123 |
| POST | Create | POST /users |
| PUT | Full update | PUT /users/123 |
| PATCH | Partial update | PATCH /users/123 |
| DELETE | Delete | DELETE /users/123 |
JSON Response Keys
Use camelCase (Google style) or snake_case (GitHub/Stripe style). Pick one and be consistent across all endpoints.
Query Parameters
Use snake_case or camelCase consistently: ?page_size=20&sort_by=created_at
Convert Formats
kebab-case converter for URLs, camelCase or snake_case for JSON keys. Try the hub.