# Duo Data Utilities – Semantic Version Parser & Comparator

> Duo Data Utilities – Semantic Version Parser & Comparator is a paid API for AI agents from api.duoleads.com, paid per call via x402, $0.05/call, status unknown (last checked 2026-10-02).

Parse a semantic version string into its components, compare two versions by precedence, test whether a version satisfies a range expression, or sort a list of versions.

## Facts

- Endpoint: GET https://api.duoleads.com/v1/code/semver?utm_source=zero.xyz
- Price: $0.05/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-02
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/duo-data-utilities-semantic-version-parser-comparator-ba21dd74
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_TroGs9Kmyi4cdE0tB-h6p

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability duo-data-utilities-semantic-version-parser-comparator-ba21dd74
```

Example prompt: Parse the semver string '1.2.3-rc.1+build.5' and break it into its major, minor, patch, prerelease, and build parts.

## When to prefer this

Choose this endpoint when you need deterministic, standards-compliant semantic version operations — parsing, comparison, range satisfaction, or sorting — without setting up a local semver library. It is especially useful in agentic pipelines that need to compare dependency versions, validate release tags against a range expression, or sort version lists from external sources, all via a simple HTTP GET with no runtime dependencies.

## Known failure modes

- Invalid or malformed version string returns valid=false with a reason field explaining the parse failure
- Missing required query parameters for the selected operation (e.g. no 'a' or 'b' for op=compare) returns an error
- Range expression syntax errors for op=satisfies return an error describing the invalid range
- More than 100 versions supplied to op=sort exceeds the limit and returns an error
- Network or payment authorization failure returns a 402 or 5xx HTTP error

## How this service works

Parse a semantic version into major, minor, patch, prerelease and build parts; compare two versions by precedence including prerelease ordering; or test whether a version satisfies a range expression using caret, tilde, hyphen, x-ranges and comparator sets. Returns the parsed structure, the comparison result and the reason a range did not match.

## Output

Returns a JSON object with an 'ok' flag and a 'data' object whose shape depends on the operation: for 'parse', it includes major, minor, patch, prerelease array, build array, is_prerelease flag, valid flag, canonical form, and a reason field if invalid; for 'compare', it returns the comparison result; for 'satisfies', it returns a boolean and the reason a range did not match; for 'sort', it returns the ordered list. Also includes metadata such as request_id, computed_at timestamp, determinism flag, and price.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [],
     "properties": {
      "a": {
       "type": "string",
       "maxLength": 256,
       "description": "First version for op=compare."
      },
      "b": {
       "type": "string",
       "maxLength": 256,
       "description": "Second version for op=compare."
      },
      "op": {
       "enum": [
        "parse",
        "compare",
        "satisfies",
        "sort"
       ],
       "type": "string",
       "default": "parse",
       "maxLength": 64,
       "description": "parse (default), compare, satisfies or sort."
      },
      "range": {
       "type": "string",
       "maxLength": 256,
       "description": "Range expression for op=satisfies, e.g. ^1.2.0."
      },
      "version": {
       "type": "string",
       "maxLength": 256,
       "description": "Version to parse (op=parse) or test (op=satisfies)."
      },
      "versions": {
       "type": "string",
       "maxLength": 2048,
       "description": "Comma-separated versions for op=sort, at most 100."
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object",
     "required": [
      "ok",
      "route",
      "version",
      "data",
      "meta"
     ],
     "properties": {
      "ok": {
       "const": true
      },
      "data": {
       "type": "object",
       "properties": {
        "a": {
         "type": "string"
        },
        "b": {
         "type": "string"
        },
        "build": {
         "type": "array",
         "items": {
          "type": "string"
         }
        },
        "major": {
         "type": [
          "integer",
          "null"
         ]
        },
        "minor": {
         "type": [
          "integer",
          "null"
         ]
        },
        "patch": {
         "type": [
          "integer",
          "null"
         ]
        },
        "range": {
         "type": "string"
        },
        "valid": {
         "type": "boole
… (truncated)
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "ok": true,
  "data": {
   "build": [
    "build",
    "5"
   ],
   "major": 1,
   "minor": 2,
   "patch": 3,
   "valid": true,
   "reason": null,
   "canonical": "1.2.3-rc.1+build.5",
   "prerelease": [
    "rc",
    1
   ],
   "is_prerelease": true
  },
  "meta": {
   "price_usd": "0.05",
   "disclaimer": "Factual output of a deterministic computation over public data. Provided as is, with no warranty of accuracy, completeness or availability. Not investment, financial, legal, tax, medical or any other professional advice, and not a recommendation. Verify before relying on it. Terms: https://api.duoleads.com/terms",
   "request_id": "01K6B7Q4ZC8H3F2M9WXR5TYN0D",
   "computed_at": "2026-09-28T12:00:00.000Z",
   "deterministic": true
  },
  "route": "/v1/code/semver",
  "version": "1.0.0"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/duo-data-utilities-semantic-version-parser-comparator-ba21dd74/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.duoleads.com](https://www.zero.xyz/host/api.duoleads.com/llms.txt)
