tny.gg

API

Make links from a script.

No API key and no sign-up. Send one request, get a short link back.

Request

curl -X POST https://tny.gg/api/shorten \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com/a/very/long/address"}'
FieldNeededWhat it does
urlyesThe address to shorten. Must start with http:// or https://.
slugnoA custom ending: 3 to 32 letters, numbers, dashes or underscores.
expiresno1h, 1d, 7d, 30d, or a number of seconds (60 to 31,536,000).
max_clicksnoThe link stops working after this many clicks by people. Use 1 for a one-time link.
passwordnoPeople must enter this (4 to 128 characters) before the link opens.
og_title, og_desc, og_imagenoThe preview card chat apps show for the link. The image must be an https:// address.
urlsnoUse instead of url to shorten up to 10 links at once: a list, or text with one link per line.

Form-encoded bodies work as well as JSON.

Response

{
  "ok": true,
  "code": "k7m2p",
  "url": "https://example.com/a/very/long/address",
  "short_url": "https://tny.gg/k7m2p",
  "preview_url": "https://tny.gg/k7m2p+",
  "qr_url": "https://tny.gg/qr/k7m2p",
  "manage_url": "https://tny.gg/m/k7m2p#3f9c…",
  "key": "3f9c…",
  "expires_at": null,
  "max_clicks": null,
  "password": false
}

Store key if you want stats later. It is shown once and cannot be recovered. expires_at is a Unix time in seconds.

qr_url is an SVG image of the QR code. Add /png for a PNG.

Several links at once

curl -X POST https://tny.gg/api/shorten \
  -H "Content-Type: application/json" \
  -d '{"urls": ["https://example.com/one", "https://example.com/two"]}'

The answer is { "ok": true, "results": [ … ] }, with one entry per link in the order you sent them. Each entry is either the same shape as a single response, or { "ok": false, "input": "…", "error": "…" } for a link that was refused. Every link counts toward the limits.

Errors

{ "ok": false, "error": "That ending is already taken. Please pick another." }

A refused request answers with status 400. Going over the limit answers 429, with a Retry-After header.

Limits

Each source can make a limited number of links per hour and per day. The limits are generous for personal use and are there to keep spam out. Please read the terms.