← Blog
Guides2 min read

Shorten a URL from an automation or script: KooLink + cron

Automations need a shortener with no cap and no account. KooLink's API shortens from a script, cron job, or build step — and the MCP server does the same from an AI agent.

An automation is a bad place to hit a link quota or a signup wall. When you wire a shortener into a script, a cron job, or a build step, you want it to just work — every run, no card on file, no expiring link.

KooLink is built for that. Here is how to use it from an automation.

The basics: one POST

curl -X POST https://kool.ink/api/links \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com/deploy/artifact"}'

No API key. No account. No cap. The response is a clean JSON { "shortUrl": "https://kool.ink/xyz" } you can parse in any language.

From a script

Grab the shortened URL in a shell script:

SHORT=$(curl -s -X POST https://kool.ink/api/links \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com/some/deploy"}')
echo "$SHORT" | jq -r .shortUrl

From Node:

const res = await fetch("https://kool.ink/api/links", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ url: "https://example.com/deploy" }),
});
const { shortUrl } = await res.json();
console.log(shortUrl);

From Python:

import requests
r = requests.post("https://kool.ink/api/links", json={"url": "https://example.com/deploy"})
print(r.json()["shortUrl"])

From a cron job

A daily job that posts a deploy link and keeps it short:

0 9 * * * curl -s -X POST https://kool.ink/api/links -H "Content-Type: application/json" -d '{"url":"https://example.com/daily-report"}' >> /var/log/koolink.log

Because there is no quota, a cron job can run every day, every hour, or every minute without ever hitting a wall.

The CLI

Prefer a single command? The KooLink CLI is the same service from your shell:

npx @koolink/koolink https://example.com/very/long/path
# → https://kool.ink/xyz

Pipe in a URL you already have:

echo "https://example.com/long" | npx @koolink/koolink
# → https://kool.ink/xyz

From an AI agent

If your "automation" lives in an agent (Claude Code, Cursor, Windsurf, VS Code with Continue), point it at the hosted MCP server and it gets a shorten_url tool:

https://mcp.kool.ink

Ask the agent to shorten a URL and it does — one call, no browser, no copy-paste.

Why KooLink for automations

  • Anonymous. No key to store, rotate, or leak in a script.
  • Unlimited. No cap a job hits at an inopportune moment.
  • Permanent. Links do not expire, so a link a script created last year still works.
  • Clean JSON. Trivial to parse in bash, Node, Python, or anything else.

Do it

  • One POST: https://kool.ink/api/links with { "url": "..." }
  • One command: npx @koolink/koolink https://example.com/long/path
  • From your agent: https://mcp.kool.ink

Free forever. Unlimited. No signup.