REST API v1

Use an API key to create and manage short links from scripts, browser extensions, ShareX, or iOS Shortcuts. Every endpoint only operates on links owned by the key's account.

Authentication

First create an API key on the My links page. The plaintext key is shown only once.

Use either header:

Authorization: Bearer tr_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Or:

X-API-Key: tr_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Only a sha256 hash of the key is stored. Lost keys cannot be recovered; disable and create a new one. Each key allows up to 240 requests per hour.

Endpoints

MethodPathDescription
POST/api/v1/linksCreate a link (tags / groups / UTM supported)
GET/api/v1/linksList your links with pagination; filter with ?tag=name&tag_kind=tag|group Filter
GET/api/v1/links/{code}Link details (with tags / groups)
PATCH/api/v1/links/{code}Update destination, note, expiry, password, click limit, status, tags / groups, UTM
DELETE/api/v1/links/{code}Soft delete (analytics retained)
GET/api/v1/links/{code}/statsClick analytics (7 days by default; ?days=1..30)

Create a link

POST /api/v1/links,Content-Type: application/json。

curl -X POST "https://taourl.de/api/v1/links" \ -H "Authorization: Bearer tr_live_xxx" \ -H "Content-Type: application/json" \ -d '{ "url": "https://example.com/a/very/long/path", "alias": "promo2026", "title": "Autumn campaign", "expire_at": "2026-12-31 23:59:59", "password": "1234", "max_clicks": 500, "tags": ["Singles Day", "WeChat"], "groups": ["2026 autumn campaign"], "utm": { "source": "wechat", "medium": "social", "campaign": "autumn" } }'

Field reference:

FieldRequiredDescription
urlYesDestination URL; http:// is added if missing; max 2000 characters
aliasNoCustom alias, 1–40 letters / numbers / underscores / hyphens; omitted means random
titleNoNote, up to 100 characters
expire_atNoExpiry, e.g. 2026-12-31 23:59:59; omitted means permanent
passwordNoAccess password, 4–64 characters
max_clicksNoClick limit; 0 or omitted means unlimited
tagsNoTag array (or comma-separated string), each up to 30 characters; created automatically, max 8
groupsNoGroup array (or comma-separated string), same rules as tags; for campaign / project grouping
utmNoObject; may contain source / medium / campaign / term / content (full keys such as utm_source are also accepted), each value up to 200 characters
utm_source etc.NoMay also be sent at the top level utm_source / utm_medium / utm_campaign / utm_term / utm_content

On success, returns 201:

{ "ok": true, "data": { "code": "promo2026", "short_url": "https://taourl.de/promo2026", "url": "https://example.com/a/very/long/path?utm_source=wechat&utm_medium=social&utm_campaign=autumn", "alias": "promo2026", "title": "Autumn campaign", "tags": ["Singles Day", "WeChat"], "groups": ["2026 autumn campaign"], "status": 1, "state": "live", "click_count": 0, "max_clicks": 500, "clicks_left": 500, "has_password": true, "expire_at": "2026-12-31 23:59:59", "created_at": "2026-11-26 12:00:00", "last_click_at": null, "safety_status": 0, "safety_label": "Not checked" } }

List and detail

# List: ?page=1&per=20&status=live|disabled curl "https://taourl.de/api/v1/links?page=1&per=20" \ -H "Authorization: Bearer tr_live_xxx" # Filter by tag/group (exact name match) curl "https://taourl.de/api/v1/links?tag=%E5%8F%8C%E5%8D%81%E4%B8%80&tag_kind=tag" \ -H "Authorization: Bearer tr_live_xxx" # Single link curl "https://taourl.de/api/v1/links/promo2026" \ -H "Authorization: Bearer tr_live_xxx"

The list returns items、total、page、per、pages; each item includes tags and groups arrays. A single-link request only returns links owned by the current account; another account's code always returns 404.

Update a link

PATCH /api/v1/links/{code}; send only the fields to change.

curl -X PATCH "https://taourl.de/api/v1/links/promo2026" \ -H "Authorization: Bearer tr_live_xxx" \ -H "Content-Type: application/json" \ -d '{ "title": "Campaign ended", "status": 0, "max_clicks": 0, "password": "", "tags": ["Archived"], "groups": [], "utm": {"campaign": "autumn-closed"} }'

password An empty string clears the password;expire_at null makes the link permanent;max_clicks cannot be lower than clicks already recorded;tags / groups an empty array clears the binding;utm only appends or fills empty values; existing same-name parameters on the destination are not overwritten.

Delete and analytics

# Delete curl -X DELETE "https://taourl.de/api/v1/links/promo2026" \ -H "Authorization: Bearer tr_live_xxx" # Analytics (default 7 days) curl "https://taourl.de/api/v1/links/promo2026/stats?days=7" \ -H "Authorization: Bearer tr_live_xxx"

Analytics return total / today / unique visitors, daily series, top referrers, device breakdown,browsers、oses、countries and the latest 10 clicks (including browser、os、country); bots are excluded. An empty country means the request did not pass through Cloudflare or had no trusted country header.

Error codes

HTTPcodeMeaning
400invalid_jsonRequest body is not valid JSON
401unauthorized / invalid_keyMissing or invalid API key
403forbidden / account_disabledKey lacks permission or the account is disabled
404not_foundLink does not exist or belongs to another account
409alias_taken / alias_invalidAlias is taken or invalid
422invalid_url / invalid_expire_at / invalid_password / invalid_max_clicks / unsafe_urlValidation failed or blocked by security
429rate_limited / quota_exceededRate limit exceeded or daily quota exhausted
500server_error / create_failedServer error

All errors return {"ok":false,"error":{"code":"...","message":"..."}}。