Skip to main content

Command Palette

Search for a command to run...

15 API Design Mistakes Every Developer Should Avoid

Updated
•5 min read•View as Markdown
B
Senior Software Architect with 30+ years of experience building enterprise systems using Java, Spring Boot, and cloud-native technologies.

Great APIs are not just endpoints. They are contracts that define how systems communicate, evolve, and scale.

Many developers focus on making an API "work" — returning the right data, handling requests, and passing tests.

But in real-world enterprise systems, poorly designed APIs become technical debt.

They slow down development, break integrations, create security risks, and make future changes painful.

After years of building backend systems, microservices, and enterprise platforms, I have seen many API problems repeat again and again.

Here are 15 API design mistakes every developer should avoid.


1. Designing APIs Around Database Tables

One of the most common mistakes is exposing your database structure directly through APIs.

Example:

GET /users_table/123
GET /customer_address_mapping/456

Why is this a problem?

Because databases change frequently.

Your API should represent business concepts, not internal storage details.

Better:

GET /customers/123
GET /customers/123/addresses

A good API creates a stable abstraction layer between consumers and your data model.


2. Ignoring API Versioning

APIs evolve.

Business requirements change.

New fields appear.

Old behaviors become deprecated.

Without versioning, breaking changes can impact hundreds of consumers.

Bad:

GET /api/customer

Better:

GET /api/v1/customers
GET /api/v2/customers

A well-designed versioning strategy protects both API providers and consumers.


3. Using Inconsistent Naming Conventions

APIs should feel predictable.

Bad:

GET /getCustomerList
POST /create_new_customer
GET /customerDetails

Better:

GET /customers
POST /customers
GET /customers/{id}

Follow consistent REST conventions:

  • Use nouns, not verbs

  • Use plural resources

  • Keep naming predictable

Developers should understand your API without reading documentation.


4. Returning Inconsistent Response Formats

Imagine these responses from the same API:

Success:

{
  "id": 123,
  "name": "John"
}

Error:

{
  "errorMessage": "User not found"
}

Another endpoint:

{
  "status": "FAILED",
  "message": "Invalid request"
}

This creates unnecessary complexity.

Define a standard response structure:

{
  "success": false,
  "code": "CUSTOMER_NOT_FOUND",
  "message": "Customer does not exist",
  "timestamp": "2026-07-23T10:00:00Z"
}

Consistency improves developer experience.


5. Poor Error Handling

A bad API error message forces developers to guess.

Bad:

{
  "error": "Bad Request"
}

Better:

{
  "code": "INVALID_EMAIL_FORMAT",
  "message": "Email address is not valid",
  "field": "email"
}

Good errors should answer:

  • What happened?

  • Why did it happen?

  • How can it be fixed?


6. Not Designing for Pagination

Returning thousands of records is a scalability problem.

Bad:

GET /orders

Response:

[
  ...100000 records
]

Better:

GET /orders?page=1&size=50

Example:

{
  "content": [],
  "page": 1,
  "size": 50,
  "totalPages": 20
}

Pagination should be considered from day one.


7. Overusing Complex Nested Resources

Deep nesting makes APIs difficult to maintain.

Bad:

/companies/1/departments/2/employees/3/projects/4/tasks

Better:

/tasks/4

Use relationships carefully.

A resource should have its own identity.


8. Ignoring Security From the Beginning

Security should not be added later.

Common mistakes:

❌ Missing authentication ❌ Weak authorization rules ❌ Exposing sensitive fields ❌ No rate limiting ❌ Poor input validation

Modern APIs should consider:

  • OAuth2

  • JWT

  • API gateways

  • Rate limiting

  • Threat protection

  • Audit logging

Security is part of API design.


9. Returning Too Much Data

A common mistake:

GET /customers/123

returns:

{
  "name": "John",
  "email": "...",
  "passwordHash": "...",
  "internalNotes": "...",
  "createdBy": "admin"
}

APIs should expose only what consumers need.

Benefits:

  • Better security

  • Smaller payloads

  • Faster performance


10. Ignoring Idempotency

Distributed systems fail.

Networks retry.

Messages duplicate.

Your APIs must handle repeated requests safely.

Example:

Payment API:

POST /payments

A retry could charge customers twice.

Solution:

Use idempotency keys:

Idempotency-Key: abc123

The server guarantees the same request produces the same result.


11. Mixing Business Logic Into Controllers

Bad:

Controller
   |
   |-- Validate request
   |-- Calculate pricing
   |-- Update database
   |-- Send email

Controllers should handle HTTP concerns.

Business logic belongs in services/domain layers.

Example architecture:

API Layer
     |
Application Layer
     |
Domain Layer
     |
Infrastructure Layer

Clean separation improves maintainability.


12. Not Thinking About Backward Compatibility

A small API change can break production systems.

Dangerous changes:

❌ Removing fields ❌ Renaming fields ❌ Changing data types ❌ Changing validation rules

Safer approach:

  • Add new fields

  • Deprecate old fields

  • Provide migration paths

Evolution matters more than perfection.


13. Poor Documentation

An API without documentation creates friction.

Developers need:

  • Endpoint descriptions

  • Request examples

  • Response examples

  • Error scenarios

  • Authentication details

Tools like OpenAPI/Swagger help create living documentation.

A great API is self-explanatory.


14. Ignoring Performance Considerations

APIs are user-facing systems.

Common performance mistakes:

  • Too many database calls

  • Missing caching

  • Large payloads

  • No compression

  • Poor query design

Think about:

Latency
Throughput
Scalability
Reliability

A fast API creates a better user experience.


15. Treating APIs as Code Instead of Products

The biggest mistake?

Thinking APIs are only technical implementation details.

A successful API needs:

  • Clear ownership

  • Good documentation

  • Version strategy

  • Consumer feedback

  • Monitoring

  • Lifecycle management

APIs are products consumed by developers.

They deserve product-level thinking.


Final Thoughts

Good API design is not about creating more endpoints.

It is about creating stable, predictable, secure, and scalable communication contracts.

The best APIs:

✅ Are easy to understand ✅ Are difficult to misuse ✅ Evolve without breaking consumers ✅ Hide internal complexity ✅ Support long-term business growth

Whether you are building a monolith, microservices platform, or cloud-native architecture, API design decisions today will shape your system for years.

Design APIs like they will be used for the next decade — because they might be.

More from this blog

B

Bill LIao's Blog

137 posts

A technical blog on modern backend development, software architecture, and practical AI agent workflows