Skip to main content

API

Programmatic developer utilities for scripts, CI, and internal platforms.

Cliviro exposes small, predictable endpoints for formatting JSON, decoding and inspecting JWTs, inspecting XML, generating UUIDs and fixture passwords, hashing text inputs, converting dates, transforming text, and converting YAML from automation.

curl example

curl -X POST https://cliviro.com/v1/format/json \
  -H "Content-Type: application/json" \
  -d '{"input":"{\"ok\":true}","mode":"format"}'

Endpoints

Live utility endpoints with explicit limits.

Responses are JSON, request bodies stay small, structured inspection and conversion are bounded, and JWT decoding does not perform signature verification.

POST

/v1/format/json

Format and validate JSON payloads from scripts, CI, or internal tools.

POST

/v1/decode/jwt

Decode JWT headers and claims without logging sensitive tokens.

POST

/v1/inspect/token

Inspect compact JWT segments, registered claims, custom claims, and numeric date fields.

GET

/v1/generate/uuid

Generate UUIDs and identifiers for tests, fixtures, and automation.

GET

/v1/generate/password

Generate bounded fixture passwords with configurable character groups.

POST

/v1/hash

Generate SHA digests for bounded text inputs from scripts and CI.

POST

/v1/convert/date

Convert ISO dates and Unix timestamps into stable script-friendly date fields.

POST

/v1/convert/yaml

Convert YAML to JSON or JSON to YAML with bounded script-friendly output.

POST

/v1/inspect/xml

Validate, format, and count XML elements for scripts and CI checks.

POST

/v1/transform/text

Encode and decode Base64, URL, and HTML entity text from scripts and CI.

Request format

POST endpoints require application/json and return 400 for malformed requests.

Validation

Invalid JSON, invalid JWT payloads, and malformed structured documents return 422 with a readable message.

Limits

Generator counts plus hash, date, token, text, XML, and YAML input sizes are bounded to keep responses predictable.

Automation starter

Run the repo example against a local server.

The example script calls JSON formatting, UUID generation, hashing, and date conversion endpoints with bounded inputs so shell and CI usage has a concrete starting point.

scripts/examples/api-automation.sh

CLIVIRO_BASE_URL=http://localhost:3000 pnpm example:api

Examples

Copy-ready requests and response shapes.

The public API stays intentionally small. Each endpoint returns JSON, disables response caching, and favors explicit limits over hidden behavior.

/v1/format/json

Request

curl -X POST https://cliviro.com/v1/format/json \
  -H "Content-Type: application/json" \
  -d '{"input":"{\"ok\":true}","mode":"format"}'

Response

{
  "ok": true,
  "mode": "format",
  "output": "{\n  \"ok\": true\n}",
  "summary": "Object with 1 key"
}

400 for missing JSON bodies, 422 for JSON content that cannot be parsed.

/v1/decode/jwt

Request

curl -X POST https://cliviro.com/v1/decode/jwt \
  -H "Content-Type: application/json" \
  -d '{"token":"<compact-jwt>"}'

Response

{
  "ok": true,
  "header": { "alg": "HS256", "typ": "JWT" },
  "payload": { "sub": "user_123" },
  "verified": false
}

400 for malformed requests, 422 for tokens that are empty or not compact JWTs.

/v1/inspect/token

Request

curl -X POST https://cliviro.com/v1/inspect/token \
  -H "Content-Type: application/json" \
  -d '{"token":"<compact-jwt>"}'

Response

{
  "ok": true,
  "summary": "8 claims",
  "segments": {
    "count": 3,
    "header": { "length": 36, "present": true },
    "payload": { "length": 211, "present": true },
    "signature": { "length": 17, "present": true }
  },
  "registeredClaims": [
    { "key": "sub", "label": "Subject", "value": "user_123", "present": true }
  ],
  "customClaims": [
    { "key": "name", "value": "Cliviro Demo" }
  ],
  "timestamps": {
    "exp": { "value": 1893542400, "formatted": "Jan 2, 2030, 12:00:00 AM UTC", "present": true }
  },
  "verified": false
}

400 for malformed requests, 413 for tokens over 20,000 characters, 422 for invalid compact JWTs.

/v1/generate/uuid

Request

curl "https://cliviro.com/v1/generate/uuid?count=2"

Response

{
  "ok": true,
  "count": 2,
  "uuids": [
    "b994ef3c-76de-49f6-984b-1cd085846e7a",
    "43234cfb-510b-4ccf-9351-3d5c09190b8d"
  ]
}

The count query is clamped from 1 through 50 to keep responses bounded.

/v1/generate/password

Request

curl "https://cliviro.com/v1/generate/password?count=2&length=20&symbols=false"

Response

{
  "ok": true,
  "count": 2,
  "length": 20,
  "options": {
    "uppercase": true,
    "lowercase": true,
    "numbers": true,
    "symbols": false
  },
  "passwords": [
    "examplePassword12345",
    "fixturePassword67890"
  ]
}

Count is clamped from 1 through 20, length from 8 through 64, and character flags must be true or false.

/v1/hash

Request

curl -X POST https://cliviro.com/v1/hash \
  -H "Content-Type: application/json" \
  -d '{"input":"Cliviro","algorithm":"SHA-256"}'

Response

{
  "ok": true,
  "algorithm": "SHA-256",
  "digest": "98864d8ae6e6554ffb46dca677bf68b582d64107454fa6f29e278af52a33953e",
  "inputLength": 7
}

400 for malformed requests, 413 for inputs over 100,000 characters, 422 for unsupported algorithms.

/v1/convert/date

Request

curl -X POST https://cliviro.com/v1/convert/date \
  -H "Content-Type: application/json" \
  -d '{"input":"1893456000","timeZone":"Asia/Kolkata"}'

Response

{
  "ok": true,
  "input": "1893456000",
  "iso": "2030-01-01T00:00:00.000Z",
  "unixSeconds": 1893456000,
  "unixMilliseconds": 1893456000000,
  "utc": "Jan 1, 2030, 12:00:00 AM",
  "timeZone": "Asia/Kolkata",
  "formatted": "Jan 1, 2030, 5:30:00 AM"
}

400 for malformed requests, 413 for inputs over 200 characters, 422 for invalid dates or unsupported time zones.

/v1/convert/yaml

Request

curl -X POST https://cliviro.com/v1/convert/yaml \
  -H "Content-Type: application/json" \
  -d '{"mode":"yaml-to-json","input":"name: Cliviro\nfeatures:\n  - tools"}'

Response

{
  "ok": true,
  "mode": "yaml-to-json",
  "output": "{\n  \"name\": \"Cliviro\",\n  \"features\": [\n    \"tools\"\n  ]\n}",
  "message": "YAML converted to JSON.",
  "inputLength": 33,
  "outputLength": 56
}

400 for malformed requests, 413 for inputs over 100,000 characters, 422 for invalid mode or conversion errors.

/v1/inspect/xml

Request

curl -X POST https://cliviro.com/v1/inspect/xml \
  -H "Content-Type: application/json" \
  -d '{"input":"<project><tool status=\"live\">JSON</tool></project>"}'

Response

{
  "ok": true,
  "output": "<project>\n  <tool status=\"live\">\n    JSON\n  </tool>\n</project>",
  "message": "Valid XML with 2 elements.",
  "elements": 2,
  "inputLength": 50,
  "outputLength": 62
}

400 for malformed requests, 413 for inputs over 100,000 characters, 422 for invalid XML.

/v1/transform/text

Request

curl -X POST https://cliviro.com/v1/transform/text \
  -H "Content-Type: application/json" \
  -d '{"kind":"base64","mode":"encode","input":"Cliviro"}'

Response

{
  "ok": true,
  "kind": "base64",
  "mode": "encode",
  "output": "Q2xpdmlybw==",
  "message": "Text encoded as Base64.",
  "inputLength": 7,
  "outputLength": 12
}

400 for malformed requests, 413 for inputs over 100,000 characters, 422 for invalid kind, mode, or decode input.