API Reference

tcgo.co.za URL Shortener REST API

Authentication

Protected endpoints require an API key via the x-api-key header.

x-api-key: tcgo-hc-xxxxxxxx

Read-only endpoints (list, stats, search, health) are open. Mutating endpoints (create, edit, delete) require a key.

Links

POST /api/go/create

requires api key

Create a short link.

{
  "short_code": "mylink",
  "url": "https://example.com",
  "go_set": "campaign_q2",
  "hits_expires": 1000,
  "time_expires": "2026-12-31 23:59:59",
  "password": "optional",
  "split_variants": ["https://a.com", "https://b.com"],
  "split_weights": [70, 30]
}
GET /api/go/list

List all links. Query params: go_set, limit (50), offset (0).

GET /api/go/{code}/stats

Link stats: hits, geo breakdown, A/B split results.

GET /api/go/search?q={term}

Search by code, URL, or GoSet.

PUT /api/go/{code}

requires api key

Update target URL.

{"url": "https://new-target.com"}
DELETE /api/go/{code}

requires api key

Delete a link.

Redirects

GET /go/{code}

Redirect to target URL (303). Appends UTM params if present.

GET /go/{code}?preview=1

Preview page with QR code, stats, and "Go to link" button.

GET /qr/{code}

Branded QR code PNG.

Dashboards

GET /go/dashboard

Analytics dashboard (HTML). Auto-refreshes every 30s.

GET /go/status

Service status with heatmap. ?format=json for JSON.

GET /go/import

Bulk CSV import form.

System

GET /api/go/health

Health check with uptime, link counts, click counts, system metrics.