Everyone figured link shortening was eternal busywork. Dashboards. Copy-paste. Repeat until your eyes bleed. Then toui.io drops an API that scripts the whole mess—bulk creation, OG tags, custom codes. Changes everything for promo automation.
Look. That Friday deadline panic? Gone.
Your team’s spreadsheet hits your inbox: 50 product URLs, flash sale screaming. Old way: grind through toui.io dashboard, one-by-one, tweaking titles, OG descriptions for Facebook previews, copying shorts back. Soul-crushing.
But here’s the scriptable salvation. toui.io’s API—built by a dev who hated the dashboard grind himself. Paid plans only, sure, but it pays for itself in sanity.
I built toui.io partly because I kept running into this exact scenario – so the API is designed around it.
Spot on. No fluff.
Why toui.io API When Bitly’s Been Around Forever?
Bitly? Clunky. Enterprise pricing for basics. toui.io flips it: dev-first, Node.js friendly, no browser tax. And custom codes—“sale426” instead of gibberish—without jumping hoops. (Free tier gets random codes; Pro unlocks vanity.)
Unique insight: this echoes Twilio’s early days. Back then, SMS was manual carrier portals. Twilio API-fied it, devs built empires. toui.io could do the same for link tracking—turn marketing into a firehose, not a faucet. Bold prediction: dashboard-only shorteners die in two years.
How Do You Actually Use toui.io API?
Dead simple. Pro/Business account. API key from dashboard—copy once, .env it, gitignore the hell out of it.
Node 18+. npm i dotenv. Every script starts:
import "dotenv/config";
const API_KEY = process.env.TOUI_API_KEY;
if (!API_KEY) {
throw new Error("Missing TOUI_API_KEY in .env file");
}
Smart. Clones forget .env? Boom, clear error. No 401 ghosts.
POST to https://toui.io/api/v1/shorten. Bearer auth. JSON body: url, optional title, og_title, og_description, og_image_url, custom_code.
Barebones:
const response = await fetch("https://toui.io/api/v1/shorten", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.TOUI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
url: "https://shop.example.com/products/wireless-earbuds-pro",
title: "Wireless Earbuds Pro - Flash Sale",
}),
});
if (!response.ok) {
const err = await response.json();
throw new Error(`API error ${response.status}: ${err.error}`);
}
const data = await response.json();
console.log(data.short_url); // https://toui.io/xK3mQp
OG tags? Add ‘em. Social previews pop—60% off earbuds, weekend only. No fallback to crappy destination meta.
Custom code taken? 400 error. Check first if paranoid.
Bulk script—gold. Array of products, loop, createLink(). 50 links, verified, logged. 30 seconds.
const products = [
{
name: "Wireless Earbuds Pro",
url: "https://shop.example.com/products/wireless-earbuds-pro",
discount: "60%",
},
// etc.
];
for (const p of products) {
const result = await createLink({
url: p.url,
title: `${p.name} - ${p.discount} Flash Sale`,
og_title: `${p.name} - ${p.discount} Off This Weekend`,
og_description: "Limited time. Don't miss.",
});
console.log(`${p.name}: ${result.short_url}`);
}
That’s your promo engine. Analytics endpoint next—clicks, platforms. Script reports, Slack ‘em.
toui.io isn’t hype. It’s pragmatic. But paid-only API? Gimmick to upsell. Free tier teases dashboard; real power gated. Corporate spin? Kinda. Still—worth it if you’re scripting weekly blasts.
Dry humor: imagine marketing’s face when you deliver 50 perfect links pre-coffee. Priceless.
And verification. response.ok check everywhere. Parse errors. Production-ready patterns, no half-assed fetches.
Does toui.io API Replace Your Whole Link Workflow?
Not quite. Integrates. Zapier? Maybe. But raw Node wins for speed, control. No middleman tax.
Historical parallel: URL shorteners were Twitter toys (t.co). Bitly monetized. Rebrandly niched. toui.io devs it—social OG focus screams LINE/FB/X Asia push. Smart.
Critique: docs sparse beyond this guide. Assume you grok fetch. No SDKs yet—roll your own.
Prediction: toui.io adds webhooks next. Real-time click alerts. Devs feast.
One gripe—Node only in guide. Python? Curl? Possible, but examples bias JS shops.
Still. For spreadsheet slayers, killer.
🧬 Related Insights
- Read more: Veridian Guard: One Decorator to Rule Flaky LLM Calls
- Read more: TraceLit: LeetCode’s Visual Brain for Pointer Chaos
Frequently Asked Questions
What does toui.io API do?
Bulk-shorts URLs with custom codes, OG metadata for social previews. Tracks clicks, no dashboard.
How to get toui.io API key?
Pro/Business plan. Dashboard > API Keys > create. .env it.
Does toui.io API work for free users?
No. Dashboard only. API paid.