go2url

API docs

Every request goes to https://go2url.co/api/v1 and sends JSON back.

Authentication

Create a key in the dashboard under API keys, then send it on every request:

Authorization: Bearer g2u_live_…

Keys carry scopes. Give each app only the ones it needs:

ScopeAllows
links:readListing and reading links
links:writeCreating, changing, archiving and deleting links
stats:readClick stats and the click log
keys:manageCreating and revoking API keys
workspace:manageRenaming the workspace and managing members

Store keys as an environment variable such as GO2URL_API_KEY, never in front-end code.

Create a link

const res = await fetch("https://go2url.co/api/v1/links", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.GO2URL_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ url: "https://example.com/spring", slug: "spring-sale" }),
});
const link = await res.json();
// link.short_url → "https://go2url.co/spring-sale"

The response includes id, slug, short_url, destination, clicks, last_click_at and qr_url, along with every field below.

Link fields

FieldTypeNotes
urlstringRequired. The destination. http and https only.
slugstringUp to 64 letters, numbers, - and _. Generated if left out.
titlestringUp to 200 characters.
tagsstring[]Up to 20 tags.
redirect_typenumber301, 302 (default), 307 or 308.
expires_atstringISO 8601 date-time with offset.
expired_urlstringWhere visitors go after the link expires or hits its cap.
max_clicksnumberStop redirecting after this many clicks.
passthrough_querybooleanPass the visitor's query string on to the destination.

Destinations can use {path}, {1}, {2} for parts of the short link's path and {name} for a query parameter.

Stats

MethodPathWhat it does
GET/links/:id/statsTotals, series, referrers, countries, devices, browsers and OS. ?range=24h|7d|30d|90d|all&include_bots=false
GET/links/:id/clicksThe raw click log, paged.
GET/stats/overviewWorkspace totals, series and top links.

Workspace and keys

MethodPathWhat it does
GET/meThe current key or user and its workspace.
PATCH/workspaceRename the workspace. {"name": "…"}
GET/keysList API keys.
POST/keysCreate a key with a set of scopes.
DELETE/keys/:idRevoke a key.
GET/membersList members.
POST/membersInvite someone by e-mail.
DELETE/members/:userIdRemove a member.

Limits and errors

The API allows 600 requests a minute per client IP. Errors come back with a status code and a JSON body that says what to fix.

StatusMeaning
400The request body or a parameter isn't valid.
401The key is missing, wrong or revoked.
403The key doesn't have the scope this call needs.
404No link with that id or name in this workspace.
409That short name is already taken.
429Too many requests. Wait and retry.