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:
| Scope | Allows |
|---|---|
links:read | Listing and reading links |
links:write | Creating, changing, archiving and deleting links |
stats:read | Click stats and the click log |
keys:manage | Creating and revoking API keys |
workspace:manage | Renaming 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
| Field | Type | Notes |
|---|---|---|
url | string | Required. The destination. http and https only. |
slug | string | Up to 64 letters, numbers, - and _. Generated if left out. |
title | string | Up to 200 characters. |
tags | string[] | Up to 20 tags. |
redirect_type | number | 301, 302 (default), 307 or 308. |
expires_at | string | ISO 8601 date-time with offset. |
expired_url | string | Where visitors go after the link expires or hits its cap. |
max_clicks | number | Stop redirecting after this many clicks. |
passthrough_query | boolean | Pass 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.
Links
| Method | Path | What it does |
|---|---|---|
| POST | /links | Create a link. Returns 201. |
| POST | /links/bulk | Create up to 100 links. Returns 207 with a result for each. |
| GET | /links | List links. ?q= &tag= &archived=false|true|all &sort= &order= &page= &per_page= |
| GET | /links/:id | One link by id. |
| GET | /links/by-slug/:slug | One link by its short name. |
| PATCH | /links/:id | Change any field, or set archived. |
| DELETE | /links/:id | Delete a link and its clicks. Archive it instead to keep the stats. |
| GET | /links/:id/qr | QR code. ?format=png|svg&size=512 |
Stats
| Method | Path | What it does |
|---|---|---|
| GET | /links/:id/stats | Totals, series, referrers, countries, devices, browsers and OS. ?range=24h|7d|30d|90d|all&include_bots=false |
| GET | /links/:id/clicks | The raw click log, paged. |
| GET | /stats/overview | Workspace totals, series and top links. |
Workspace and keys
| Method | Path | What it does |
|---|---|---|
| GET | /me | The current key or user and its workspace. |
| PATCH | /workspace | Rename the workspace. {"name": "…"} |
| GET | /keys | List API keys. |
| POST | /keys | Create a key with a set of scopes. |
| DELETE | /keys/:id | Revoke a key. |
| GET | /members | List members. |
| POST | /members | Invite someone by e-mail. |
| DELETE | /members/:userId | Remove 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.
| Status | Meaning |
|---|---|
400 | The request body or a parameter isn't valid. |
401 | The key is missing, wrong or revoked. |
403 | The key doesn't have the scope this call needs. |
404 | No link with that id or name in this workspace. |
409 | That short name is already taken. |
429 | Too many requests. Wait and retry. |