# ISO 8601 Duration Parser

> ISO 8601 Duration Parser is a paid API for AI agents from datetime.openverbs.com, paid per call via x402, $0.002/call, status unknown (last checked 2026-09-15).

Parses an ISO 8601 duration string into its component parts and returns a normalized ISO string plus totalSeconds (null when years or months are present).

## Facts

- Endpoint: POST https://datetime.openverbs.com/v1/parse
- Price: $0.002/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/iso-8601-duration-parser-a70afe81
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_1Hay7OCuINTrCF41mbbGr

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 iso-8601-duration-parser-a70afe81 -d '<json body>'
```

Example prompt: Parse the ISO 8601 duration 'P1Y2M10DT2H30M' and tell me what each component means — years, months, days, hours, minutes — and give me the total seconds if you can.

## When to prefer this

Use this endpoint when you need to decompose or normalize an ISO 8601 duration string into its individual components (years, months, days, hours, minutes, seconds), or to get totalSeconds for fixed-length durations. If you need to add a duration to a specific date or compute the duration between two dates, prefer the /v1/add or /v1/between sibling endpoints instead. This is the right choice when the goal is purely parsing and understanding a duration string, not performing date arithmetic.

## Known failure modes

- Invalid ISO 8601 duration string returns a 400 error
- Duration string shorter than 2 characters rejected by schema validation
- Malformed input (e.g. missing 'P' prefix) returns parsing error
- totalSeconds is null for durations containing years or months — not an error but may surprise callers expecting a numeric result
- Empty body or missing 'duration' field returns schema validation error

## How this service works

Parse an ISO 8601 duration such as 'P1Y2M10DT2H30M' into its components. Returns a normalized ISO string and totalSeconds — but totalSeconds is null when the duration contains years or months, because those are calendar-variable (use /v1/add or /v1/between for exact date math).

## Output

Returns a normalized ISO 8601 duration string and an object with individual components (years, months, weeks, days, hours, minutes, seconds). Also returns totalSeconds as a number when the duration contains no years or months (since those are calendar-variable); totalSeconds is null if years or months are present.

## Request schema (JSON Schema)

```json
{
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "type": "object",
 "properties": {
  "input": {
   "type": "object",
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "type": "string",
     "enum": [
      "POST"
     ]
    },
    "bodyType": {
     "type": "string",
     "enum": [
      "json",
      "form-data",
      "text"
     ]
    },
    "body": {
     "type": "object",
     "properties": {
      "duration": {
       "type": "string",
       "minLength": 2,
       "maxLength": 128,
       "description": "ISO 8601 duration, e.g. 'P3W' or 'PT1H30M'."
      }
     },
     "required": [
      "duration"
     ],
     "additionalProperties": false
    }
   },
   "required": [
    "type",
    "method",
    "bodyType",
    "body"
   ],
   "additionalProperties": false
  }
 },
 "required": [
  "input"
 ]
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/iso-8601-duration-parser-a70afe81/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from datetime.openverbs.com](https://www.zero.xyz/host/datetime.openverbs.com/llms.txt)
