Developer API

Server-to-server only. Send your site's key in the X-API-Key header. Keys are issued by SpLink admins and shown once.

curl -X POST "$SPLINK_BASE_URL/api/v1/links" \
  -H "X-API-Key: $SPLINK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"long_url":"https://foodpulse.net/recipes/appam"}'

# → { "slug": "a1B2c3D", "short_url": "https://splink.pro/a1B2c3D", ... }
GET
/api/v1/whoami

Check your key and which deployment you're talking to. Call once at startup.

POST
/api/v1/links

Create one link. Body: { long_url, alias?, expires_at?, password? }. Plain links are de-duplicated per site.

POST
/api/v1/links/bulk

Create up to 500 links. Body: { items: [{ long_url, alias?, ref? }] }. Row errors don't stop the batch; ref is echoed back.

GET
/api/v1/links?limit=100

Your site's most recent links.

GET
/api/v1/links/{slug}/stats

Clicks, last scan, referrers, countries and devices for one link.

GET
/api/v1/analytics/summary

Totals and breakdowns for your whole site.

GET
/api/v1/analytics/clicks.csv?since=&until=

Raw click export (CSV).

POST
/api/v1/webhooks

Subscribe to link.clicked events. Body: { url }. Returns a signing secret once.

GET
/api/v1/webhooks

List webhooks with delivery health.

POST
/api/v1/webhooks/{id}/rotate-secret

New signing secret; re-enables a paused hook.

DELETE
/api/v1/webhooks/{id}

Unsubscribe.

GET
/api/qr/{slug}?fmt=png|svg&size=10

QR image for any live link (no key needed).

GET
/go/{slug}

Plain 307 redirect for crawlers and link previews.

Verifying webhooks

Each delivery carries X-SpLink-Signature: sha256=<hex> — an HMAC-SHA256 of the raw body with your secret. Compare in constant time. Failed deliveries retry once; a hook pauses after 20 failures in a row.

Errors

401 missing/invalid key · 409 name taken or reserved · 410 expired · 422 bad URL or input. Error bodies look like { "detail": "..." }.