Skip to content
RedirHub/API
Sign inGet API key
Links · links.count
GET/links/countlinks.count

Count links

Returns how many links match the current filters — cheaper than paging through GET /links when all you need is a total.

Base URL
https://api.redirhub.com/v1
Auth
Bearer token
Idempotent
Yes
Returns
application/json

The request

Call GET /links/count with your bearer token. Narrow or order the result with the query parameters below.

# Count links
curl "https://api.redirhub.com/v1/links/count" \
  -H "Authorization: Bearer $REDIRHUB_TOKEN"

Query parameters

ParameterDescription
sortoptionalstringSort results by field. Prefix with - for descending order. Available sorts: id, created_at, updated_at, total_clicksid-idcreated_at-created_atupdated_at-updated_attotal_clicks-total_clicks
filteroptionalobjectFilter results by one or more fields. Available filters: id, host, path, tld, handler, type, destination, search, tags, traffic, dns_correct, status, created_after, created_before
filter[id]optionalstring
filter[host]optionalstringA hostname already connected to the workspace. See List hostnames.
filter[path]optionalstring
filter[tld]optionalstring
filter[handler]optionalstringWhat the link is: short-url or qr for a short link on a short-link hostname, redirect or migration for a redirect on the redirected hostname.
filter[type]optionalstringRecord type. List the available types with GET /shared/types.
filter[destination]optionalstringWhere matching traffic is sent.
filter[search]optionalstring
filter[tags]optionalstringFreeform labels. Filter on them with filter[tags].
filter[traffic]optionalstring
filter[dns_correct]optionalstring
filter[status]optionalstringThe HTTP status code used for the redirect response.
filter[created_after]optionalstring
filter[created_before]optionalstring

The response

A 200 returns the record as JSON.

{
  "total": 1,
  "paused": 1,
  "dns_issue": 1,
  "no_clicks": 1,
  "refreshing": true
}

Status codes

200
SuccessRecord totals for the current filter: all of them, the paused ones, the ones whose hostname does not point to RedirHub, and the ones with no clicks in the last four weeks (this week included). Totals are kept for a minute; for a workspace with 10,000 links or more, older totals are returned at once with refreshing true while fresh ones are computed, so ask again a few seconds later. The first time such a workspace is counted, only total comes back, with refreshing true, until the rest is computed.
401
UnauthenticatedUnauthenticated
429
Too many requestsToo many requests