deftools.io

API Reference

Public HTTP endpoints that generate images and graphics on demand. No authentication required. All endpoints accept GET requests and return data you can use directly in <img src>, curl, or any HTTP client.

Also available as an OpenAPI 3.0 spec (machine-readable).

/api/placeholder

Generate a placeholder image with custom dimensions, background and foreground colors, and optional centered label text. Returns SVG by default; pass fmt=png for a rasterized PNG.

Parameters

Parameter Type Default Description
w number 600 Width in pixels (1–2000)
h number 400 Height in pixels (1–2000)
bg hex (no #) 3b82f6 Background fill color
fg hex (no #) ffffff Text/foreground color
text string {w}×{h} Centered label text
fmt string svg Output format: svg or png

Examples

Basic — SVG

<img src="https://deftools.io/api/placeholder?w=800&h=300&bg=0f172a&fg=f8fafc&text=Banner" />
800×300 dark placeholder banner

Raster PNG

<img src="https://deftools.io/api/placeholder?w=600&h=400&bg=7c3aed&fg=ffffff&text=API&fmt=png" />
600×400 purple placeholder PNG

curl

curl -o banner.png 'https://deftools.io/api/placeholder?w=1200&h=400&bg=059669&fg=ffffff&text=Hero&fmt=png'

See the interactive placeholder image generator for a visual interface with live preview, rounded corners, and format selection.

/api/og

Generate a 1200×630 Open Graph card for any tool on deftools.io. Each card shows the tool name, description, and site branding in the dark theme design. Used automatically in every tool page's <meta property="og:image">.

Parameters

Parameter Type Default Description
slug string Tool slug (e.g. json-formatter). Falls back to generic card when omitted.

Examples

OG card for a specific tool

<img src="https://deftools.io/api/og?slug=json-formatter" />
OG card for JSON Formatter

Generic card (no slug)

<img src="https://deftools.io/api/og" />
Generic OG card for deftools.io

curl

curl -o og-card.png 'https://deftools.io/api/og?slug=json-formatter'

/api/qr

Generate a QR code from any text or URL. Returns SVG by default; pass fmt=png for a rasterized PNG. Supports all standard error correction levels and custom colors. Uses the same qrcode-generator library as the interactive tool.

Parameters

Parameter Type Default Description
text string Required. Content to encode (URL, text, WiFi config, etc.)
size number 320 Image width/height in pixels (64–2000)
fg hex (no #) 0a0e14 Foreground (module) color
bg hex (no #) ffffff Background color
ecl string M Error correction: L (7%), M (15%), Q (25%), H (30%)
margin number 2 Quiet zone in modules (0–4)
fmt string svg Output format: svg or png

Examples

Basic — SVG

<img src="https://deftools.io/api/qr?text=https://deftools.io&size=320" />
QR code linking to deftools.io

Custom colors — PNG

<img src="https://deftools.io/api/qr?text=hello&fg=5b8cff&bg=f5f5ff&fmt=png" />
Blue QR code saying hello

curl

curl -o qr.svg 'https://deftools.io/api/qr?text=https://deftools.io&size=180&fg=5b8cff'
curl -o qr.png 'https://deftools.io/api/qr?text=WiFi&fmt=png'

See the interactive QR code generator for a visual interface with WiFi, email, SMS, and vCard support, plus live preview and download buttons.

/api/ip

Returns your public IP address and geolocation data derived from Cloudflare's edge. No external APIs, no rate limits — every field comes from the request itself. Useful for debugging, testing CORS setups, or geolocating API clients.

Parameters

Parameter Type Default Description
format string json Output format: json (default) or html

Response fields

Field Type Description
ip string Your public IP address from CF-Connecting-IP
country string? Two-letter ISO country code (e.g. US)
city string? City name
region string? Region / state name
asn number? Autonomous System Number (e.g. 15169)
asOrganization string? ISP or organization name
latitude number? Approximate latitude
longitude number? Approximate longitude
timezone string? IANA timezone identifier
colo string? Three-letter Cloudflare colo code (e.g. SFO)

Examples

JSON

curl https://deftools.io/api/ip

HTML table

curl https://deftools.io/api/ip?format=html

fetch() from the browser

const res = await fetch('https://deftools.io/api/ip');
const data = await res.json();
console.log(data.ip, data.country, data.city);

/api/uuid

Generate random UUIDs (RFC 4122 version 4) in bulk. Uses the Workers runtime's native crypto.randomUUID() — no external dependencies, no rate limits. Useful for test data, database seeding, or API request ID generation.

Parameters

Parameter Type Default Description
v string 4 UUID version. Only 4 (random) is currently available.
count number 1 Number of UUIDs to generate (1–100)

Examples

Single UUID

curl https://deftools.io/api/uuid

Bulk — 5 UUIDs

curl 'https://deftools.io/api/uuid?v=4&count=5'

fetch() from the browser

const res = await fetch('https://deftools.io/api/uuid?count=10');
const uuids = await res.json();
console.log(uuids);

See the interactive UUID generator for v4 and v7 UUIDs with timestamp extraction, GUID formatting, and bulk generation in the browser.

/api/hash

Compute cryptographic hashes using the Web Crypto API. Supports SHA-1, SHA-256, SHA-384, and SHA-512 with hex, Base64, or Base64URL output formats. Useful for checksums, content verification, integration testing, and CI/CD pipelines.

Parameters

Parameter Type Default Description
text string Required. The text to hash.
algo string sha256 Algorithm: sha1, sha256, sha384, or sha512
fmt string hex Output format: hex, base64, or base64url

Examples

SHA-256 (default)

curl 'https://deftools.io/api/hash?text=hello%20world'

SHA-512 in Base64

curl 'https://deftools.io/api/hash?text=hello&algo=sha512&fmt=base64'

fetch() from the browser

const res = await fetch('https://deftools.io/api/hash?text=test&algo=sha256');
const data = await res.json();
console.log(data.hash);

See the interactive hash generator for MD5, file hashing, and multiple output formats with copy and download buttons.

Notes

Caching: Placeholder SVGs and PNGs are cached for 1 year on the CDN (max-age=31536000, immutable). OG image cards are cached for 1 day on the client and 7 days at edge (s-maxage=604800).

CORS: All endpoints include Access-Control-Allow-Origin: * — they work from any domain, in <img>, fetch(), and CSS url().

Rate limits: These run on Cloudflare Workers behind a CDN with generous caching headers. There are no hard rate limits at the application layer, but sustained high traffic is automatically absorbed by the CDN.

No authentication: Every endpoint is public. No API key, token, or sign-up required.