← Home

API Documentation

POST /v1/diff

Compare two JSON values and return a structured diff.

Request Body

{
  "left":  { },          // required — any JSON value
  "right": { },          // required — any JSON value
  "options": {           // optional
    "includeUnchanged": false,  // count unchanged leaves in stats
    "maxDepth": 64              // recursion limit (1–256)
  }
}

Success Response 200

{
  "ok": true,
  "stats": {
    "added": 1,
    "removed": 0,
    "changed": 1,
    "unchanged": 1,
    "processingTimeMs": 0.08
  },
  "diff": [
    { "op": "replace", "path": "/name", "oldValue": "Alice", "newValue": "Bob" },
    { "op": "add",     "path": "/role", "value": "admin" }
  ]
}

Diff Operations

OpMeaningFields
addPresent in right, absent in leftpath, value
removePresent in left, absent in rightpath, value
replacePresent in both, values differpath, oldValue, newValue

Path Format

Paths use JSON Pointer (RFC 6901). Special characters are escaped: ~~0, /~1.

POST /v1/image/exif-summary

Extract essential EXIF metadata from a JPEG image.

Request

Send raw binary image data. Max upload: 5 MB.

curl -X POST https://utilsforagents.com/v1/image/exif-summary \
  --data-binary @photo.jpg -H "Content-Type: image/jpeg"

Success Response 200

{
  "ok": true,
  "processingTimeMs": 0.12,
  "exif": {
    "make": "Apple",
    "model": "iPhone 15 Pro",
    "software": "17.4",
    "dateTime": "2026:03:15 14:30:00",
    "dateTimeOriginal": "2026:03:15 14:30:00",
    "orientation": 1,
    "imageWidth": 4032,
    "imageHeight": 3024,
    "exposureTime": "1/120",
    "fNumber": 1.8,
    "iso": 100,
    "focalLength": 6.9,
    "gps": {
      "latitude": 40.446111,
      "longitude": -79.982222,
      "altitude": 350.5
    }
  }
}

POST /v1/image/scrub-metadata

Strip all metadata (EXIF, XMP, ICC, IPTC) from a JPEG or PNG and return the cleaned binary.

Request

Send raw binary image data. Max upload: 5 MB. Supports JPEG and PNG.

curl -X POST https://utilsforagents.com/v1/image/scrub-metadata \
  --data-binary @photo.jpg -H "Content-Type: image/jpeg" -o clean.jpg

Success Response 200

Returns the cleaned image binary with Content-Type: image/jpeg or image/png.

POST /v1/html/to-markdown

Convert HTML to clean Markdown. Strips script, style, iframe, and other dangerous tags before conversion.

Request (JSON)

curl -X POST https://utilsforagents.com/v1/html/to-markdown \
  -H "Content-Type: application/json" \
  -d '{"html":"<h1>Title</h1><p>Hello world</p>"}'

Request (raw HTML)

curl -X POST https://utilsforagents.com/v1/html/to-markdown \
  -H "Content-Type: text/html" \
  -d '<h1>Title</h1><p>Hello world</p>'

Success Response 200

{
  "ok": true,
  "processingTimeMs": 0.42,
  "charsBefore": 42,
  "charsAfter": 22,
  "markdown": "# Title\n\nHello world"
}

POST /v1/html/fetch-markdown

Fetch a remote URL and convert the HTML response to Markdown. Includes SSRF protection (blocks private IPs, localhost, metadata endpoints).

Request

curl -X POST https://utilsforagents.com/v1/html/fetch-markdown \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com"}'

Success Response 200

{
  "ok": true,
  "processingTimeMs": 1.2,
  "sourceUrl": "https://example.com",
  "charsBefore": 1256,
  "charsAfter": 423,
  "markdown": "# Example Domain\n\nThis domain is for use in..."
}

SSRF Protection

The fetch-markdown endpoint blocks requests to:

TargetReason
127.0.0.0/8, ::1, localhostLoopback
10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16Private networks
169.254.169.254Cloud metadata
*.internal, *.local, *.localhostInternal DNS

Max remote response: 2 MB. Timeout: 5 seconds.

POST /v1/text/fetch-content

Fetch a remote .json, .md, or .txt file and extract readable text as Markdown. Ideal for retrieving content from JS-rendered sites that load data from separate files.

Request

curl -X POST https://utilsforagents.com/v1/text/fetch-content \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com/api/projects.json"}'

Success Response 200

{
  "ok": true,
  "processingTimeMs": 0.8,
  "sourceUrl": "https://example.com/api/projects.json",
  "detectedFormat": "json",
  "charsBefore": 2048,
  "charsAfter": 512,
  "markdown": "## Project One\n\nFirst project description...\n\n## Project Two\n\n..."
}

Format Detection

Detected AsConditionProcessing
jsonContent-Type: application/json or .json extensionRecursive text extraction: identifies title/body fields, skips metadata (id, url, date, etc.)
htmlContent-Type: text/html or .html/.htm extensionFull HTML→Markdown conversion (same as /v1/html/fetch-markdown)
markdown.md extensionReturned as-is (trimmed)
textEverything else (.txt, plain text, etc.)Returned as-is (trimmed)

Same SSRF protection as fetch-markdown. Max remote response: 2 MB. Timeout: 5 seconds.

Error Responses

All errors return application/problem+json per RFC 9457.

StatusTypeWhen
400bad-requestBody too small or malformed
400invalid-jsonBody is not valid JSON (diff endpoint)
404not-foundUnknown route
405method-not-allowedWrong HTTP method
413payload-too-largeUpload exceeds 5 MB
415unsupported-media-typeNot a JPEG/PNG or no EXIF found
422invalid-schemaMissing left or right field
{
  "type": "https://utilsforagents.com/errors/payload-too-large",
  "title": "Payload Too Large",
  "status": 413,
  "detail": "Upload exceeds the 5MB limit."
}

GET /health

Returns service status.

{ "status": "ok", "service": "utilsforagents", "version": "1.5.0" }

Machine-Readable Spec

For AI agents, the full API contract is available at /agents.md in plain Markdown.