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 /users not POST /create-user

HTTP Methods

MethodPurposeExample
GETReadGET /users/123
POSTCreatePOST /users
PUTFull updatePUT /users/123
PATCHPartial updatePATCH /users/123
DELETEDeleteDELETE /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.