Links API

Keys

PermissionAllows
links:readList and read links, their history, and whether a name is free
links:writeMake, change, turn off and turn on links
links:choose_nameChoose a link's name; without it, every name is generated. Granted by an admin
stats:readRead click counts

Calls

POST/api/v1/linksMake a link: target; optional title, notes, expires_at; name only with links:choose_name
GET/api/v1/linksThis integration's links: status, q, limit, cursor
GET/api/v1/links/{name}One link
PATCH/api/v1/links/{name}Change target, title, notes, expires_at; an absent field is left alone, null clears it
POST/api/v1/links/{name}/disableTurn off
POST/api/v1/links/{name}/enableTurn back on
GET/api/v1/links/{name}/historyEvery change, newest first
GET/api/v1/links/{name}/statsClicks, previews and unique visitors by Manila day: from, to
GET/api/v1/names/{name}Free, taken, reserved or invalid
GET/api/v1/openapi.jsonOpenAPI 3.1

Making a link

curl https://links.wchi.app/api/v1/links \
  -H "Authorization: Bearer lk_live_…" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{ "target": "https://forms.office.com/r/…", "title": "Free lunch sign-up" }'

201
{ "link": { "name": "k7xq2m", "short_url": "https://wchi.app/k7xq2m",
            "target": "https://forms.office.com/r/…", "status": "active", … } }

Rules

Errors

{ "error": { "code": "name_taken", "message": "…", "detail": "…", "docs": "https://links.wchi.app/developers#name_taken" } }
CodeHTTPMeaning
invalid_key401The API key is missing, revoked or not recognised.
idempotency_key_required400Every POST needs an Idempotency-Key header (1 to 255 characters).
invalid_request400The request doesn't match the API.
invalid_filter400A filter or range in the address can't be used.
name_invalid400A name is 1 to 64 letters, digits and hyphens, and doesn't start or end with a hyphen.
target_not_allowed400The target must be an http or https address, and not another short link.
missing_permission403This integration isn't allowed to do that.
name_not_allowed403This integration makes links with generated names only. Choosing a name needs the links:choose_name permission, which an admin grants.
not_found404This integration has no link with that name.
name_taken409That name is already a link.
name_reserved409That name is reserved.
request_in_progress409A request with this Idempotency-Key is still being handled. Retry shortly.
idempotency_key_reused422This Idempotency-Key was already used with a different request.
rate_limited429Too many new links from this integration. Retry after the time given.
internal500Something went wrong on Links' side.