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
| Op | Meaning | Fields |
|---|---|---|
add | Present in right, absent in left | path, value |
remove | Present in left, absent in right | path, value |
replace | Present in both, values differ | path, 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:
| Target | Reason |
|---|---|
| 127.0.0.0/8, ::1, localhost | Loopback |
| 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16 | Private networks |
| 169.254.169.254 | Cloud metadata |
| *.internal, *.local, *.localhost | Internal 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 As | Condition | Processing |
|---|---|---|
json | Content-Type: application/json or .json extension | Recursive text extraction: identifies title/body fields, skips metadata (id, url, date, etc.) |
html | Content-Type: text/html or .html/.htm extension | Full HTML→Markdown conversion (same as /v1/html/fetch-markdown) |
markdown | .md extension | Returned as-is (trimmed) |
text | Everything 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.
| Status | Type | When |
|---|---|---|
| 400 | bad-request | Body too small or malformed |
| 400 | invalid-json | Body is not valid JSON (diff endpoint) |
| 404 | not-found | Unknown route |
| 405 | method-not-allowed | Wrong HTTP method |
| 413 | payload-too-large | Upload exceeds 5 MB |
| 415 | unsupported-media-type | Not a JPEG/PNG or no EXIF found |
| 422 | invalid-schema | Missing 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.