Semver Compare API - Free Version Comparison
Compare two semver strings (e.g., "1.2.3" vs "1.3.0") and get the result: -1 (a < b), 0 (equal), or 1 (a > b). Handles pre-release identifiers per the semver 2.0.0 specification.
Code examples
curl -X POST https://api.botoi.com/v1/semver/compare \
-H "Content-Type: application/json" \
-d '{"version_a":"2.1.0","version_b":"2.3.1"}'When to use this API
Dependency update checks
Compare the installed package version against the latest available version to determine if an update is needed.
Feature flag gating
Compare the user app version against a minimum version to decide whether to enable a new feature or show an upgrade prompt.
Frequently asked questions
Are pre-release versions handled correctly?
Yes. Pre-release identifiers like 1.0.0-alpha.1 are compared following the semver 2.0.0 specification, where pre-release versions have lower precedence than the release.
Is build metadata considered in comparison?
No. Build metadata (e.g., +build.123) is ignored during comparison per the semver spec.
What does the result value mean?
-1 means a is less than b, 0 means they are equal, and 1 means a is greater than b.
Can I compare version ranges like "^1.2.0"?
No. This endpoint compares two exact version strings. Range matching is not supported.
Get your API key
Free tier includes 5 requests per minute with no credit card required. Upgrade for higher limits.