API Design Best Practices for 2026: REST, GraphQL, and Event Contracts
APIs are product surfaces. Bad contracts create shadow clients, brittle integrations, and political fights between teams. Good API design is architecture work that shows up as faster partner onboarding and fewer 2 a.m. breakages.
Whether you expose public APIs, B2B integrations, or internal platform endpoints, the principles below hold. See also Clean Architecture for where adapters sit.
Start with consumers, not database tables
Map the jobs-to-be-done: “create subscription,” “list invoices for finance export,” “stream order updates.” Table-shaped REST (/users/1/orders/2/items/3 trees) often mirrors storage accidents, not product workflows.
REST that stays maintainable
- Resources + verbs via HTTP methods — avoid RPC soup unless the action is truly non-CRUD
- Consistent error model — machine-readable
code, humanmessage, optionaldetails(RFC 7807 Problem Details is a strong default) - Pagination — cursor-based for large sets; document limits
- Idempotency keys — for payments and mutations that can be retried
- Partial responses carefully — sparse fieldsets only if clients need them
Document with OpenAPI and generate SDKs only after the human contract is stable.
Versioning without perpetual v1 forever
- Prefer additive, backwards-compatible changes
- Use explicit versioning (URL or header) when breaking
- Sunset policies with dates and telemetry of client usage
- Never break silent mobile clients without a migration window
GraphQL: power with guardrails
GraphQL shines for multi-client products and BFF patterns. Guardrails:
- Query cost analysis and depth limits
- Persisted queries in production for public APIs
- Clear ownership of schema modules (federation or modular schemas)
- Do not expose internal joins as a free-for-all against your OLTP DB
GraphQL is not “no backend design”—it concentrates design into the schema and resolvers.
Async APIs: webhooks and events
For SaaS platforms, webhooks and domain events are first-class products:
- Signed payloads (HMAC), retry with backoff, dead-letter visibility
- Versioned event types:
invoice.paid.v1 - Schema registry (JSON Schema/Avro/Protobuf) for internal buses
- Outbox pattern so DB commits and publishes stay consistent
Document delivery guarantees honestly (at-least-once is normal; design consumers idempotent).
Security and multi-tenant hygiene
- OAuth2/OIDC for third parties; scoped tokens, not god keys
- Tenant isolation checks on every query path—not only in the UI
- Rate limits per client and per tenant
- Audit logs for admin and data-export APIs
API design checklist for pull requests
- Does the name match ubiquitous language?
- Is the change additive or versioned?
- Are errors actionable?
- Is authZ tested for cross-tenant access?
- Are examples and OpenAPI updated in the same PR?
Frequently asked questions
REST or GraphQL for a new SaaS?
Default to well-designed REST + webhooks for external APIs. Add GraphQL when multiple clients need flexible reads and you can staff schema ownership.
Should internal and external APIs share the same design?
Share principles and error models; do not expose internal endpoints publicly without a productized facade.
How can Auroviq help?
We design public and partner APIs, event-driven integrations, and developer portals as part of platform builds for UK, EU, and Asia product companies.
Work with Auroviq
Auroviq (AuroviQ) is a custom software and AI engineering agency based in Ahmedabad and Bhubaneswar, India, serving product companies in the UK, Netherlands, Singapore, and the US. We design architectures, ship production systems, and embed dedicated engineering teams.
Work with Auroviq — custom software & AI for product teams.