API Response Naming Conventions: A Comprehensive Guide

4 min read

Consistent field naming in API responses reduces confusion and makes your API intuitive for consumers.

Common Patterns

Field TypePatternExamples
IDresource + Id/iduserId, orderId
Timestampverb + At/atcreatedAt, updatedAt
Booleanis/has + adjectiveisActive, hasVerified
Countnoun + CountitemCount, pageCount
URLnoun + UrlavatarUrl, websiteUrl

Pagination

{ "data": [...], "pagination": { "page": 1, "pageSize": 20, "totalCount": 100, "totalPages": 5 } }

Convert

camelCase or snake_case JSON key converter.