Skip to main content

Semantic Versioning API

REAL DATA

Bounded SemVer 2.0.0 parsing, precedence comparison and major/minor/patch bumps, with explicit size limits instead of precision loss.

Authoritative reference data or standards computation

Base URL
/api/semver
Capabilities
3 routes
Last updated
July 29, 2026
Data source

GET /api/semver/parse

Live requestRuns against the public API
No key required
GET/api/semver/parse?version=1.4.0-beta.2%2Bbuild.7

Request parameters

Bounded SemVer 2.0.0 string (maximum 256 characters) with no leading 'v'. Core and numeric prerelease identifiers must fit JavaScript's exact safe-integer range.

Advanced response options4 options

Return only these fields (comma-separated). Mutually exclusive with 'exclude'.

Return all fields except these (comma-separated).

Pretty-print the JSON response.

Drop the envelope: return the raw array/object without data/meta wrapper.

Response

Example parameters are ready. Send the request to inspect the live response.

Route reference

Code samples Ready-to-copy requests in 4 languages
Choose a code sample language
curl "https://randomapi.dev/api/semver/parse?version=1.4.0-beta.2%2Bbuild.7"
const res = await fetch("https://randomapi.dev/api/semver/parse?version=1.4.0-beta.2%2Bbuild.7");
const { data, meta } = await res.json();
import requests

data = requests.get("https://randomapi.dev/api/semver/parse?version=1.4.0-beta.2%2Bbuild.7").json()["data"]
$json = json_decode(file_get_contents(
  "https://randomapi.dev/api/semver/parse?version=1.4.0-beta.2%2Bbuild.7"
), true);
$data = $json["data"];
Parameters Route-specific request inputs 1
version string required

Bounded SemVer 2.0.0 string (maximum 256 characters) with no leading 'v'. Core and numeric prerelease identifiers must fit JavaScript's exact safe-integer range.

allowed: 5 – 256
example: version=1.4.0-beta.2+build.7
Universal parameters Shared response and formatting options 4
fields list

Return only these fields (comma-separated). Mutually exclusive with 'exclude'.

example: fields=version,major
exclude list

Return all fields except these (comma-separated).

example: exclude=isPrerelease
pretty boolean

Pretty-print the JSON response.

default: false
example: pretty=true
unwrap boolean

Drop the envelope: return the raw array/object without data/meta wrapper.

default: false
example: unwrap=true
Response schema Fields returned in each record 7
version string

Validated SemVer string, unchanged because the accepted grammar is already canonical.

example: 1.4.0-beta.2+build.7

major integer

Major version component.

example: 1

minor integer

Minor version component.

example: 4

patch integer

Patch version component.

example: 0

prerelease string[]

Ordered prerelease identifiers; empty for a stable release.

example: ["beta","2"]

build string[]

Ordered build-metadata identifiers, which do not affect precedence.

example: ["build","7"]

isPrerelease boolean

True when the version has one or more prerelease identifiers.

example: true

Documented examples

Build-generated requests and complete responses
2
Parse prerelease and build metadata
GET /api/semver/parse?version=1.4.0-beta.2%2Bbuild.7
{
  "data": {
    "version": "1.4.0-beta.2+build.7",
    "major": 1,
    "minor": 4,
    "patch": 0,
    "prerelease": [
      "beta",
      "2"
    ],
    "build": [
      "build",
      "7"
    ],
    "isPrerelease": true
  },
  "meta": {
    "endpoint": "semver",
    "route": "/parse",
    "params": {
      "version": "1.4.0-beta.2+build.7"
    },
    "generatedAt": "2026-07-29T08:13:22.000Z"
  }
}
Parse a stable release
GET /api/semver/parse?version=3.12.0
{
  "data": {
    "version": "3.12.0",
    "major": 3,
    "minor": 12,
    "patch": 0,
    "prerelease": [],
    "build": [],
    "isPrerelease": false
  },
  "meta": {
    "endpoint": "semver",
    "route": "/parse",
    "params": {
      "version": "3.12.0"
    },
    "generatedAt": "2026-07-29T08:13:22.000Z"
  }
}

GET /api/semver/compare

Live requestRuns against the public API
No key required
GET/api/semver/compare?left=1.9.0&right=1.10.0

Request parameters

Bounded SemVer 2.0.0 string (maximum 256 characters) with no leading 'v'. Core and numeric prerelease identifiers must fit JavaScript's exact safe-integer range.

Bounded SemVer 2.0.0 string (maximum 256 characters) with no leading 'v'. Core and numeric prerelease identifiers must fit JavaScript's exact safe-integer range.

Advanced response options4 options

Return only these fields (comma-separated). Mutually exclusive with 'exclude'.

Return all fields except these (comma-separated).

Pretty-print the JSON response.

Drop the envelope: return the raw array/object without data/meta wrapper.

Response

Example parameters are ready. Send the request to inspect the live response.

Route reference

Code samples Ready-to-copy requests in 4 languages
Choose a code sample language
curl "https://randomapi.dev/api/semver/compare?left=1.9.0&right=1.10.0"
const res = await fetch("https://randomapi.dev/api/semver/compare?left=1.9.0&right=1.10.0");
const { data, meta } = await res.json();
import requests

data = requests.get("https://randomapi.dev/api/semver/compare?left=1.9.0&right=1.10.0").json()["data"]
$json = json_decode(file_get_contents(
  "https://randomapi.dev/api/semver/compare?left=1.9.0&right=1.10.0"
), true);
$data = $json["data"];
Parameters Route-specific request inputs 2
left string required

Bounded SemVer 2.0.0 string (maximum 256 characters) with no leading 'v'. Core and numeric prerelease identifiers must fit JavaScript's exact safe-integer range.

allowed: 5 – 256
example: left=1.9.0
right string required

Bounded SemVer 2.0.0 string (maximum 256 characters) with no leading 'v'. Core and numeric prerelease identifiers must fit JavaScript's exact safe-integer range.

allowed: 5 – 256
example: right=1.10.0
Universal parameters Shared response and formatting options 4
fields list

Return only these fields (comma-separated). Mutually exclusive with 'exclude'.

example: fields=left,right
exclude list

Return all fields except these (comma-separated).

example: exclude=relation
pretty boolean

Pretty-print the JSON response.

default: false
example: pretty=true
unwrap boolean

Drop the envelope: return the raw array/object without data/meta wrapper.

default: false
example: unwrap=true
Response schema Fields returned in each record 4
left string

Validated left-hand version, including metadata.

example: 1.9.0

right string

Validated right-hand version, including metadata.

example: 1.10.0

comparison integer (-1 | 0 | 1)

-1 when left is lower, 0 when precedence is equal, 1 when left is higher.

example: -1

relation string

less-than | equal | greater-than.

example: less-than

Documented examples

Build-generated requests and complete responses
3
Compare numeric minor versions
GET /api/semver/compare?left=1.9.0&right=1.10.0
{
  "data": {
    "left": "1.9.0",
    "right": "1.10.0",
    "comparison": -1,
    "relation": "less-than"
  },
  "meta": {
    "endpoint": "semver",
    "route": "/compare",
    "params": {
      "left": "1.9.0",
      "right": "1.10.0"
    },
    "generatedAt": "2026-07-29T08:13:22.000Z"
  }
}
Stable release after its prerelease
GET /api/semver/compare?left=2.0.0&right=2.0.0-rc.1
{
  "data": {
    "left": "2.0.0",
    "right": "2.0.0-rc.1",
    "comparison": 1,
    "relation": "greater-than"
  },
  "meta": {
    "endpoint": "semver",
    "route": "/compare",
    "params": {
      "left": "2.0.0",
      "right": "2.0.0-rc.1"
    },
    "generatedAt": "2026-07-29T08:13:22.000Z"
  }
}
Build metadata has equal precedence
GET /api/semver/compare?left=1.0.0%2Blinux&right=1.0.0%2Bmacos
{
  "data": {
    "left": "1.0.0+linux",
    "right": "1.0.0+macos",
    "comparison": 0,
    "relation": "equal"
  },
  "meta": {
    "endpoint": "semver",
    "route": "/compare",
    "params": {
      "left": "1.0.0+linux",
      "right": "1.0.0+macos"
    },
    "generatedAt": "2026-07-29T08:13:22.000Z"
  }
}

GET /api/semver/bump

Drops prerelease and build metadata, increments the selected core component, and resets every lower component to zero.

Live requestRuns against the public API
No key required
GET/api/semver/bump?version=1.2.3&type=minor

Request parameters

Bounded SemVer 2.0.0 string (maximum 256 characters) with no leading 'v'. Core and numeric prerelease identifiers must fit JavaScript's exact safe-integer range.

Core component to increment; lower components are reset to zero.

Advanced response options4 options

Return only these fields (comma-separated). Mutually exclusive with 'exclude'.

Return all fields except these (comma-separated).

Pretty-print the JSON response.

Drop the envelope: return the raw array/object without data/meta wrapper.

Response

Example parameters are ready. Send the request to inspect the live response.

Route reference

Code samples Ready-to-copy requests in 4 languages
Choose a code sample language
curl "https://randomapi.dev/api/semver/bump?version=1.2.3&type=minor"
const res = await fetch("https://randomapi.dev/api/semver/bump?version=1.2.3&type=minor");
const { data, meta } = await res.json();
import requests

data = requests.get("https://randomapi.dev/api/semver/bump?version=1.2.3&type=minor").json()["data"]
$json = json_decode(file_get_contents(
  "https://randomapi.dev/api/semver/bump?version=1.2.3&type=minor"
), true);
$data = $json["data"];
Parameters Route-specific request inputs 2
version string required

Bounded SemVer 2.0.0 string (maximum 256 characters) with no leading 'v'. Core and numeric prerelease identifiers must fit JavaScript's exact safe-integer range.

allowed: 5 – 256
example: version=1.2.3-beta.1+build.5
type enum required

Core component to increment; lower components are reset to zero.

allowed: major | minor | patch
example: type=minor
Universal parameters Shared response and formatting options 4
fields list

Return only these fields (comma-separated). Mutually exclusive with 'exclude'.

example: fields=input,type
exclude list

Return all fields except these (comma-separated).

example: exclude=patch
pretty boolean

Pretty-print the JSON response.

default: false
example: pretty=true
unwrap boolean

Drop the envelope: return the raw array/object without data/meta wrapper.

default: false
example: unwrap=true
Response schema Fields returned in each record 6
input string

Validated input version before metadata removal.

example: 1.2.3-beta.1+build.5

type string

Requested bump type: major, minor or patch.

example: minor

version string

Stable bumped version with no prerelease or build metadata.

example: 1.3.0

major integer

Resulting major component.

example: 1

minor integer

Resulting minor component.

example: 3

patch integer

Resulting patch component.

example: 0

Documented examples

Build-generated requests and complete responses
3
Next minor release
GET /api/semver/bump?version=1.2.3&type=minor
{
  "data": {
    "input": "1.2.3",
    "type": "minor",
    "version": "1.3.0",
    "major": 1,
    "minor": 3,
    "patch": 0
  },
  "meta": {
    "endpoint": "semver",
    "route": "/bump",
    "params": {
      "version": "1.2.3",
      "type": "minor"
    },
    "generatedAt": "2026-07-29T08:13:22.000Z"
  }
}
Metadata is removed before a patch bump
GET /api/semver/bump?version=1.2.3-beta.1%2Bbuild.5&type=patch
{
  "data": {
    "input": "1.2.3-beta.1+build.5",
    "type": "patch",
    "version": "1.2.4",
    "major": 1,
    "minor": 2,
    "patch": 4
  },
  "meta": {
    "endpoint": "semver",
    "route": "/bump",
    "params": {
      "version": "1.2.3-beta.1+build.5",
      "type": "patch"
    },
    "generatedAt": "2026-07-29T08:13:22.000Z"
  }
}
Next breaking major
GET /api/semver/bump?version=4.8.2&type=major
{
  "data": {
    "input": "4.8.2",
    "type": "major",
    "version": "5.0.0",
    "major": 5,
    "minor": 0,
    "patch": 0
  },
  "meta": {
    "endpoint": "semver",
    "route": "/bump",
    "params": {
      "version": "4.8.2",
      "type": "major"
    },
    "generatedAt": "2026-07-29T08:13:22.000Z"
  }
}

About this API

Coverage & behavior

Implements a deliberately bounded SemVer 2.0.0 parser and comparator as pure computations. Inputs may be at most 256 characters, and core plus numeric prerelease identifiers must fit JavaScript's exact safe-integer range. Within those limits, versions must use the exact major.minor.patch form; whitespace, a leading v, omitted components and leading zeroes are rejected rather than coerced.

/compare follows the official precedence chain: core numbers first, a stable release after its prereleases, numeric prerelease identifiers below non-numeric identifiers, then ASCII lexical ordering. Build metadata is parsed and returned but ignored for precedence, exactly as the specification requires.

/bump deliberately has a small contract: major, minor or patch. It always removes prerelease and build metadata, increments the requested core component, and zeroes lower components. It does not implement package-manager range syntax. Numeric identifiers beyond JavaScript's safe integer limit return 400 instead of being rounded.

Use it for

  • Validate release tags before publishing a package or artifact
  • Sort two versions with the official prerelease precedence rules
  • Compute a deterministic next major, minor or patch version in CI

Frequently asked questions

Does comparison ignore build metadata?

Yes. 1.0.0+build.1 and 1.0.0+build.2 have equal precedence under SemVer 2.0.0, although each complete input string is preserved in the response.

Can I pass versions beginning with v?

No. This endpoint uses its bounded strict SemVer form, so v1.2.3 returns 400 rather than being silently coerced to 1.2.3.

What happens to prerelease and build metadata when bumping?

Both are removed first, then the selected core component is incremented and lower components are reset; 1.2.3-beta+7 with type=patch becomes 1.2.4.

Does the API support version ranges?

No. Range syntax differs between package managers; this endpoint intentionally provides only a bounded SemVer 2.0.0 version parser and precedence comparison.

Standards & references