API Documentation

All endpoints require authentication via an API key. Pass it as a Bearer token in the Authorization header or as an api_key query parameter.

Want to try before signing up? Use the interactive Playground →

Authentication

Include your API key in every request using one of these methods:

# Option 1: Authorization header (recommended)
curl -H "Authorization: Bearer snp_your_api_key" ...

# Option 2: Query parameter
curl "https://api-snap.com/api/qr?data=test&api_key=snp_your_api_key"

Rate Limit Headers

Every response includes X-RateLimit-Limit and X-RateLimit-Remaining headers so you can track usage.

GET/api/qr

QR Code Generation

Generate QR codes in PNG or SVG format with customizable colors and sizes.

Parameters

NameRequiredDescription
dataRequiredThe text or URL to encode
sizeOptionalImage width in pixels (max 1000, default 300)
formatOptional"png" or "svg" (default "png")
darkOptionalDark color hex (default #000000)
lightOptionalLight color hex (default #ffffff)

Example

curl "https://api-snap.com/api/qr?data=https://example.com&size=400&format=svg" \
  -H "Authorization: Bearer snp_your_api_key"

Returns image/png or image/svg+xml

GET / POST/api/hash

Hash Generation

Generate cryptographic hashes using SHA-256, SHA-512, MD5, and more.

Parameters

NameRequiredDescription
textRequiredThe text to hash (query param for GET, body field for POST)
algorithmOptionalAlgorithm: md5, sha1, sha256, sha512, sha384, sha3-256, sha3-512 (default sha256)
encodingOptionalOutput encoding: hex, base64, base64url (default hex)

Example

curl "https://api-snap.com/api/hash?text=Hello+World&algorithm=sha256" \
  -H "Authorization: Bearer snp_your_api_key"

Returns JSON: {"hash": "...", "algorithm": "sha256", "encoding": "hex"}

GET/api/uuid

UUID / ID Generation

Generate unique identifiers in various formats. Great for database IDs, tokens, and more.

Parameters

NameRequiredDescription
formatOptionalFormat: uuid, v4, nanoid, nanoid-short, hex, base64, numeric, timestamp (default uuid)
countOptionalNumber of IDs to generate, 1-100 (default 1)
prefixOptionalPrefix to prepend to each ID (e.g., 'usr_', 'txn_')

Example

curl "https://api-snap.com/api/uuid?format=nanoid&count=5&prefix=usr_" \
  -H "Authorization: Bearer snp_your_api_key"

Returns JSON: {"id": "..."} for count=1, {"ids": [...]} for count>1

POST/api/base64

Base64 Encode/Decode

Encode or decode strings using Base64 or Base64URL encoding.

Parameters

NameRequiredDescription
inputRequiredThe string to encode or decode
actionOptional"encode" or "decode" (default "encode")
urlSafeOptionalUse base64url variant (default false)

Example

curl -X POST "https://api-snap.com/api/base64" \
  -H "Authorization: Bearer snp_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"input": "Hello, World!", "action": "encode"}'

Returns JSON: {"result": "SGVsbG8sIFdvcmxkIQ==", "action": "encode"}

POST/api/jwt-decode

JWT Decode

Decode and inspect JWT tokens without verification. See header, payload, and expiry information.

Parameters

NameRequiredDescription
tokenRequiredThe JWT token to decode

Example

curl -X POST "https://api-snap.com/api/jwt-decode" \
  -H "Authorization: Bearer snp_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."}'

Returns JSON: {"header": {...}, "payload": {...}, "expired": false, "expiresAt": "..."}

GET/api/color

Color Conversion

Convert colors between hex, RGB, and HSL. Includes brightness and dark/light detection.

Parameters

NameRequiredDescription
colorRequiredColor in hex (#ff0000 or ff0000), rgb(255,0,0), or hsl(0,100%,50%)

Example

curl "https://api-snap.com/api/color?color=6366f1" \
  -H "Authorization: Bearer snp_your_api_key"

Returns JSON with hex, rgb, hsl, brightness, isDark fields

GET/api/lorem

Lorem Ipsum Generator

Generate placeholder text in paragraphs. Output as plain text or HTML.

Parameters

NameRequiredDescription
paragraphsOptionalNumber of paragraphs, 1-20 (default 3)
sentencesOptionalSentences per paragraph, 1-20 (default 5)
formatOptional"text" (JSON response) or "html" (HTML paragraphs) (default "text")

Example

curl "https://api-snap.com/api/lorem?paragraphs=3&sentences=4" \
  -H "Authorization: Bearer snp_your_api_key"

Returns JSON: {"text": "...", "paragraphs": [...]}

GET/api/placeholder

Placeholder Images

Generate SVG placeholder images with custom dimensions, colors, and text.

Parameters

NameRequiredDescription
wOptionalWidth in pixels (1-2000, default 300)
hOptionalHeight in pixels (1-2000, default 200)
bgOptionalBackground color hex without # (default cccccc)
fgOptionalText color hex without # (default 666666)
textOptionalCustom text (default "WxH")

Example

curl "https://api-snap.com/api/placeholder?w=600&h=400&bg=4f46e5&fg=ffffff&text=Hero+Image" \
  -H "Authorization: Bearer snp_your_api_key"

Returns image/svg+xml with immutable cache headers

GET/api/meta

URL Metadata / OG Tags

Extract Open Graph metadata, title, description, favicon, and more from any URL.

Parameters

NameRequiredDescription
urlRequiredThe URL to extract metadata from

Example

curl "https://api-snap.com/api/meta?url=https://github.com" \
  -H "Authorization: Bearer snp_your_api_key"

Returns JSON with title, description, image, siteName, favicon, author, etc.

POST/api/resize

Image Resize & Convert

Resize, crop, and convert images between formats. Supports multipart upload or JSON with base64/URL.

Parameters

NameRequiredDescription
imageRequiredImage file (multipart) or base64 string, or use 'url' field
urlOptionalURL of image to resize (alternative to image upload)
widthOptionalTarget width in pixels (max 4096)
heightOptionalTarget height in pixels (max 4096)
formatOptionalOutput format: png, jpeg, webp, avif (default png)
qualityOptionalOutput quality 1-100 (default 80, for jpeg/webp/avif)
fitOptionalResize fit: cover, contain, fill, inside, outside (default cover)

Example

curl -X POST "https://api-snap.com/api/resize" \
  -H "Authorization: Bearer snp_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com/photo.jpg","width":400,"format":"webp"}'

Returns the resized image in the requested format

POST/api/markdown

Markdown to HTML

Convert Markdown to HTML. Returns either styled full HTML page or raw HTML fragment.

Parameters

NameRequiredDescription
markdownRequiredMarkdown content to convert
styledOptionalReturn full styled HTML page (default true). Set false for raw HTML fragment.

Example

curl -X POST "https://api-snap.com/api/markdown" \
  -H "Authorization: Bearer snp_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"markdown": "# Hello World\n\nThis is **bold** text."}'

Returns text/html (styled) or JSON with html field (unstyled)

GET/api/screenshot

Screenshot Capture

Capture a visual preview of any URL. Returns an SVG representation.

Parameters

NameRequiredDescription
urlRequiredThe URL to capture (must be valid)
widthOptionalViewport width (default 1280)
heightOptionalViewport height (default 720)

Example

curl "https://api-snap.com/api/screenshot?url=https://example.com&width=1280" \
  -H "Authorization: Bearer snp_your_api_key"

Returns image/svg+xml

POST/api/pdf

HTML to PDF

Convert HTML content to a downloadable PDF document.

Parameters

NameRequiredDescription
htmlRequiredHTML content to convert to PDF
titleOptionalDocument title and filename (default "document")

Example

curl -X POST "https://api-snap.com/api/pdf" \
  -H "Authorization: Bearer snp_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"html": "<h1>Invoice #123</h1><p>Amount: $99.00</p>", "title": "Invoice"}' \
  -o invoice.pdf

Returns application/pdf

Error Responses

StatusMeaning
400Bad request — missing or invalid parameters
401Unauthorized — missing or invalid API key
429Rate limit exceeded — upgrade your plan for more requests
502Bad gateway — upstream URL could not be fetched
500Internal server error