Version Formats for APIs — Date-Based, CalVer, and Custom Schemes
DodaTech
Updated 2026-06-28
1 min read
In this tutorial, you'll learn about Version Formats. We cover key concepts, practical examples, and best practices to help you understand and apply this topic effectively.
API version formats range from numeric SemVer to date-based CalVer, with each format communicating different information about release cadence and compatibility.
| Format | Example | Best For |
|---|---|---|
| SemVer | 2.5.1 | Public APIs with strict compatibility guarantees |
| CalVer | 2026.06 | Rapid-release APIs with time-based releases |
| Numeric | v1, v2 | Simple version tracking |
| Codename | Berlin, Cairo | Internal or marketing-driven versioning |
parse_version detects the format and extracts the version number.
from datetime import datetime
class VersionFormatter:
@staticmethod
def to_header(version: str) -> str:
return f"v{version}" if not version.startswith("v") else version
@staticmethod
def to_url(version: str) -> str:
clean = version.lower().replace("v", "")
return f"v{clean}"
format_guide = VersionFormatGuide()
format_guide.add_format("numeric", "Simple numeric versions", ["v1", "v2", "v3"])
format_guide.add_format("semver", "Semantic Versioning", ["1.0.0", "2.5.1"])
format_guide.add_format("calver", "Calendar Versioning", ["2026.06", "2026.12"])
format_guide.add_format("codename", "Code names", ["berlin", "cairo"])
for fmt, info in format_guide.get_recommendation("external").items():
print(f"{fmt}: {info}")
def build_path(self, version, path): return f"/api/{version}{path}"
← Previous
Custom Header Versioning for APIs — X-API-Version and Beyond
Next →
Calendar Versioning (CalVer) for APIs — Date-Based Release Strategy
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro