Public no-token API for every tool
Every tool's core logic is also exposed as a standalone JavaScript module. Import the function, call it with input, get the output — no credentials, no API key, no server round-trip.
Two ways to use the API
Pick whichever fits your use case. Both expose the exact same functions and parameters.
Option 1 — Import as an ES module (recommended for websites)
Load the function directly from the CDN. Works in any modern browser and Node 18+.
// Format SQL from any webpage import { formatCode } from 'https://bayhaqy.my.id/apps/api/code-formatter.js'; const result = formatCode({ language: 'sql', code: 'select * from users where id=1', indent: ' ', keywordCase: 'upper' }); console.log(result); // → "SELECT\n *\nFROM\n users\nWHERE\n id = 1"
Option 2 — Deploy as a REST API (for non-browser clients)
Wrap the modules in a Cloudflare Worker (free tier, 100k req/day) to get a public HTTPS endpoint with rate limiting. The full template is in worker-template.js.
# Install wrangler (Cloudflare CLI) npm install -g wrangler # Clone the repo and deploy git clone https://github.com/bayhaqy/apps.git cd apps/api wrangler deploy # Your API is now live at: # https://bayhaqy-api.<your-subdomain>.workers.dev/api/...
# Call it from anywhere — curl, Python, Go, anything curl "https://your-worker.workers.dev/api/code-formatter?language=sql&code=select%20*%20from%20users&keywordCase=upper" # Response: // "SELECT\n *\nFROM\n users"
Available endpoints
Every endpoint accepts both GET (query params) and POST (JSON body). Response is always JSON.
| Endpoint | Parameters | Returns |
|---|---|---|
/api/code-formatter | language, code, indent, keywordCase | Formatted code string |
/api/text-diff | original, modified, mode, ignoreCase, ignoreWhitespace | Diff ops, stats, HTML |
/api/text-clean | text, rules{trimLines, collapseSpaces, removeEmptyLines, ...} | Cleaned text |
/api/date-diff | from, to (YYYY-MM-DD), excludeWeekends, excludeHolidays | Years/months/days + totals |
/api/date-add | date, amount, unit (days/weeks/months/years) | Resulting date + day of week |
/api/age | birthDate, asOf | Age breakdown + next birthday |
/api/workday | startDate, workdays, excludeHolidays | End date after N workdays |
/api/timezone/list | — | Array of IANA timezone names |
/api/timezone/convert | fromCity, hour, targetCity | Hour, dayOffset, businessHours flag |
/api/timezone/meeting | fromCity, targetCities[] | Best hour + per-city results |
/api/loan | principal, annualRate, termMonths, interestType, startDate | Monthly payment, totals, full schedule |
/api/convert | value, from, to, category | Converted value + factor |
/api/currency/rates | base, apiSource | Live currency rates |
/api/currency/convert | amount, from, to, rates, base | Converted amount + rate |
/api/qr/wifi | ssid, password, encryption, hidden | WIFI: QR string |
/api/qr/email | to, subject, body | mailto: QR string |
/api/qr/vcard | name, phone, email, org, url | vCard 3.0 QR string |
Live playground
Try the API directly in your browser. Pick an endpoint, fill in the params, hit "Run".
Rate limiting & fair use
Browser module (Option 1): No rate limit — the code runs in your own browser. Use it as much as you want.
REST API (Option 2): Default 60 requests/minute per IP. The included Cloudflare Worker template uses a token-bucket limiter. For higher limits, deploy your own Worker — the free tier gives 100k requests/day.
All endpoints are stateless. No data is logged, stored, or tracked. The Worker template doesn't even use a database — rate limit buckets live in-memory and reset on cold start.
Available modules
| Module | Functions | Size |
|---|---|---|
code-formatter.js | formatCode, formatSql, formatPython, formatHtml, formatCss, formatJs | ~5 KB |
text-diff.js | diffText, cleanText, diffChars, diffWords, diffLines | ~5 KB |
date-calculator.js | dateDifference, addDays, calculateAge, workdayCalculator | ~5 KB |
timezone-slider.js | convertTimezone, listTimezones, findMeetingTime | ~4 KB |
loan-calculator.js | calculateLoan | ~4 KB |
converter.js | convertUnit, convertTemperature, convertShoeSize, fetchCurrencyRates, convertCurrency | ~6 KB |
qr-studio.js | formatWifi, formatEmail, formatSms, formatPhone, formatVCard, generateQrDataUrl | ~3 KB |
worker-template.js | Cloudflare Worker with all endpoints + rate limiter | ~6 KB |