Mobile API Best Practices · Versioning, Upgrades & Remote Control
Minimum Versions & Forced Upgrades
Soft and hard upgrade prompts driven from the server.
You need an escape hatch for critical bugs and unsustainable old versions. Expose an app config endpoint (or remote config) returning min_supported_version (hard block) and recommended_version (soft nag) per platform. Clients check it at launch and on 426 Upgrade Required-style errors. Use the platform features too: Android in-app updates (immediate/flexible) and App Store links on iOS. Hard upgrades are disruptive — reserve them for security issues or protocol breaks, and communicate.
Upgrade levers
| Mechanism | User impact | When |
|---|---|---|
| Soft prompt (recommended_version) | Dismissible banner | New features, gradual migration |
| Hard block (min_supported_version) | App unusable until update | Security bugs, broken protocol |
| Server-side compat shim | None | Keep old versions working cheaply |
| Kill switch per feature | Feature disabled | Bug in one feature |
| Android in-app update (immediate) | Full-screen update flow | Critical updates on Android |
{
"ios": {"min_supported_version": "5.4.0", "recommended_version": "5.12.0", "store_url": "https://apps.apple.com/app/id000000000"},
"android": {"min_supported_version": "5.4.0", "recommended_version": "5.12.0"},
"messages": {"upgrade_title": "Update required", "upgrade_body": "This version is no longer supported."},
"ttl_seconds": 3600
}
MIN = {"ios": Version("5.4.0"), "android": Version("5.4.0")}
@app.middleware("http")
async def min_version_gate(request: Request, call_next):
platform, version = parse_app_ua(request.headers.get("user-agent", ""))
if platform in MIN and version and version < MIN[platform]:
return problem(426, "upgrade-required", detail="Please update the app.")
return await call_next(request)
Common pitfalls
- No upgrade mechanism in version 1.0 (you can never add it to old binaries).
- Hard-blocking for cosmetic changes.
- Blocking the config endpoint itself behind auth.
Key points
- Ship the upgrade check in v1
- Soft vs hard thresholds
- Prefer compat shims; hard block rarely
Further reading: Android: In-app updates
Practice questions
Why must the forced-upgrade mechanism ship in the very first app version?
Answer
Because old binaries can't learn new behavior; only versions that already contain the check can be told to upgrade.
What's the difference between min_supported and recommended versions?
Answer
Below min_supported the app is blocked until updated; below recommended it just shows a dismissible prompt.
Open in the app to mark lessons complete, take notes and track your progress.