---
title: "Convert between ISO 8601 durations, seconds, clock time and human text like \"1h30m\" or \"90 minutes\"."
method: POST
path: "/api/v1/duration"
tags: ["Converters"]
---

# Convert between ISO 8601 durations, seconds, clock time and human text like "1h30m" or "90 minutes".

`POST /api/v1/duration`

## Request

- Base URL: `https://programmes.net`
- URL: `https://programmes.net/api/v1/duration`
- Auth: none declared

Duration Converter. Operations: `convert` — Parse any duration (ISO 8601, 1h30m, 90 minutes, 1:30:00, seconds) into every representation. `to-iso` — Convert any duration to a canonical ISO 8601 duration string. `humanize` — Render a duration as words ("1 hour 30 minutes") or compact text ("1h 30m").

## Request body

- union
  - DurationConvert: Parse any duration (ISO 8601, 1h30m, 90 minutes, 1:30:00, seconds) into every representation.
    - `operation` 'convert', required
    - `input` string: A duration in any supported format.
    - `options` object
  - DurationToIso: Convert any duration to a canonical ISO 8601 duration string.
    - `operation` 'to-iso', required
    - `input` string: A duration in any supported format.
    - `options` object
      - `weeks` boolean: Use PnW when the value is whole weeks.
      - `calendarUnits` boolean: Use years (365 d) and months (30 d).
  - DurationHumanize: Render a duration as words ("1 hour 30 minutes") or compact text ("1h 30m").
    - `operation` 'humanize', required
    - `input` string: A duration in any supported format.
    - `options` object
      - `compact` boolean: Use 1h 30m instead of words.

## Response `200`

The operation ran.

- object
  - `ok` unknown, required
  - `tool` 'duration', required
  - `operation` 'convert' | 'to-iso' | 'humanize', required
  - `result` unknown, required

## Other responses

- `400`: The request is not valid (https://programmes.net/api#invalid-request); The tool has no such operation (https://programmes.net/api#unknown-operation)
- `404`: No such tool (https://programmes.net/api#unknown-tool)
- `413`: The request or its input is too large (https://programmes.net/api#content-too-large)
- `415`: The body must be JSON (https://programmes.net/api#unsupported-media-type)
- `422`: An option is missing, of the wrong type or out of range (https://programmes.net/api#invalid-options); This call needs more CPU than one API call may use (https://programmes.net/api#refused); The operation could not process the input (https://programmes.net/api#tool-error)
- `429`: Too many requests (https://programmes.net/api#rate-limited)
- `500`: Internal error (https://programmes.net/api#internal-error)

---

[API](https://skmtc.dev/programmes/apis/programmes-net-api.md) · [All operations](https://skmtc.dev/programmes/apis/programmes-net-api/llms.txt) · [OpenAPI document](https://skmtc.dev/programmes/apis/programmes-net-api/revisions/aa939784a2e6?raw)
