POST /api/duration · USDC via x402Parse a duration like "2h30m" / "1d4h" / "90s" to seconds, or humanize a number of seconds.
| Field | Type | Description |
|---|---|---|
value * | any | Duration string ("1d2h3m4s") or number of seconds |
{
"seconds": 9000,
"human": "2h 30m",
"iso8601": "PT2H30M"
}
curl -i -X POST https://agent402.tools/api/duration \
-H "Content-Type: application/json" \
-d '{"value":"2h30m"}'
The response is HTTP 402 Payment Required with exact payment requirements. Any x402 v2 client pays automatically and retries:
import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";
const client = new x402Client();
registerExactEvmScheme(client, { signer: privateKeyToAccount(KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);
const res = await payFetch("https://agent402.tools/api/duration", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"value": "2h30m"
}),
});
GET /api/timeCurrent time: UTC ISO, epoch seconds/ms, day of week/year, ISO week — optionally rendered in any IANA timezone…
POST /api/time-convertConvert between epoch (s or ms), ISO 8601, and any IANA timezone. Give a value, get every representation back.…
POST /api/cron-nextParse a 5-field cron expression and return the next N run times (UTC).…