Are You Clear About When to Use Sync vs Async APIs?¶
Type: Structure
Category: API
Audience: Engineers defining API contracts, frontend/backend flows, or task orchestration
đ What This Perspective Covers¶
The problem isn't just how to implement async.
It's where to draw the lineâand why.
â ď¸ Common Confusions¶
- Sync endpoints that take 5+ seconds â client timeouts
- Async endpoints with no status feedback â user uncertainty
- APIs trigger long workflows but respond instantly without confirming outcome
- Event queues treated as invisible black boxes
â Clearer Boundaries¶
- Sync APIs: when immediate feedback or result is required
- Async APIs: for delegated, long-running, or retry-prone actions
- Always offer a follow-up API to check async job status
- Make contract-level expectations clear (e.g. SLAs, response time, finality)
- Document side effects and propagation timelines for async calls
đ§ Core Insight¶
The difference isnât latency.
Itâs contract shape and system responsibility.
â FAQ¶
-
Q: Can we just make everything async?
A: Only if you design for it: status, feedback, and monitoring included. -
Q: Should we let clients poll for results?
A: Yes, but offer smart strategies: callbacks, webhooks, push if needed.