API reference
HTTP API.
Create links and read their stats from your own code: JSON over HTTPS with a personal token. Included in Free.
- Base URL
- https://api.dwnl.cc/v1
- Auth
- Bearer token
- Format
- JSON, camelCase
Basics
Authentication
Every request carries a personal token in the Authorization header. Create one on the Developers page of the app and pick its scopes; the secret is shown once, so store it as one. Revoke a token on the same page and it stops working at once.
Scopes
- links:read
- List and read links
- links:write
- Create and edit links
- stats:read
- Read click stats
- traffic:read
- Read sources, offers, campaigns and conversions
- traffic:write
- Change them
Request
curl https://api.dwnl.cc/v1/me \ -H "Authorization: Bearer $DWNL_TOKEN"
Rate limits
Each token gets 600 requests a minute; the CLI counts as one token per signed-in machine. Every response says how many are left. Over the limit, the API answers 429 and says how long to wait.
Response headers
- RateLimit-Limit
- Requests allowed in the current minute
- RateLimit-Remaining
- Requests left in it
- RateLimit-Reset
- Seconds until it starts over
- Retry-After
- On a 429 only: seconds to wait
429 Too Many Requests
HTTP/2 429
RateLimit-Limit: 600
RateLimit-Remaining: 0
RateLimit-Reset: 12
Retry-After: 12
{
"code": "rate_limited",
"detail": "600 requests per minute per token. Retry after 12 s."
}Errors
A failed request returns a 4xx or 5xx status and a JSON body: a stable code to branch on and a sentence for people.
| Status | Code | When |
|---|---|---|
| 401 | unauthenticated | No token, or an unknown one |
| 401 | token_revoked | The token was revoked (token_expired: past its last day) |
| 403 | insufficient_scope | The token lacks the scope this call needs |
| 404 | not_found | No link with that code in your account |
| 409 | code_taken | The back-half you asked for is in use |
| 422 | invalid_target | The URL is not http(s), has spaces or points to dwnl.cc; `reason` says which |
| 422 | validation_error | The body is not JSON, or a field is unknown or has the wrong type |
| 429 | rate_limited | Over the rate limit |
404 Not Found
HTTP/2 404
{
"code": "not_found",
"detail": "No link with the code a8Kd3xQ."
}Links
POST/linksScope: links:write
Create a link
Shortens a URL. Without code, a 7-character code is generated. If you already shortened the same URL, your existing link comes back with 200 and existed: true; force: true makes another one. The link object is abridged here.
Body
- targetstring Required
- Where the link points: http(s), up to 2,048 characters
- codestring
- Your own back-half: 4 to 32 letters, digits, _ or -
- titlestring
- A name for the dashboard; never shown to visitors
- tagsstring[]
- Lowercase labels for filtering
Request
curl -X POST https://api.dwnl.cc/v1/links \
-H "Authorization: Bearer $DWNL_TOKEN" \
-H "Content-Type: application/json" \
-d '{"target":"https://example.com/blog/launch-notes","title":"Launch notes"}'201 Created
{
"link": {
"code": "a8Kd3xQ",
"shortUrl": "https://dwnl.cc/a8Kd3xQ",
"host": null,
"target": "https://example.com/blog/launch-notes",
"title": "Launch notes",
"tags": [],
"status": "active",
"expiresAt": null,
"codeLocked": false,
"createdAt": "2026-09-01T09:30:00Z",
"updatedAt": "2026-09-01T09:30:00Z"
},
"existed": false
}GET/linksScope: links:read
List links
Your links, newest first, a page at a time, each with its clicks of the last 30 days and of all time. Pass nextCursor back as cursor for the next page; it is null on the last one.
Query
- limitinteger
- 1 to 200, default 50
- cursorstring
- From the previous page
- statusstring
- Only active, paused or expired links
- qstring
- Search code, title, target and tags
Request
curl "https://api.dwnl.cc/v1/links?limit=2" \ -H "Authorization: Bearer $DWNL_TOKEN"
200 OK
{
"items": [
{
"code": "a8Kd3xQ",
"shortUrl": "https://dwnl.cc/a8Kd3xQ",
"host": null,
"target": "https://example.com/blog/launch-notes",
"title": "Launch notes",
"tags": [],
"status": "active",
"expiresAt": null,
"codeLocked": true,
"createdAt": "2026-09-01T09:30:00Z",
"updatedAt": "2026-09-01T09:30:00Z",
"clicks30d": 980,
"clicksTotal": 11250
},
{
"code": "Qm4tZ2p",
"shortUrl": "https://dwnl.cc/Qm4tZ2p",
"host": null,
"target": "https://example.com/pricing",
"title": "Pricing",
"tags": [],
"status": "active",
"expiresAt": null,
"codeLocked": true,
"createdAt": "2026-08-14T16:02:00Z",
"updatedAt": "2026-09-20T11:45:00Z",
"clicks30d": 410,
"clicksTotal": 3420
}
],
"nextCursor": "eyJpZCI6IlFtNHRaMnAifQ",
"total": 48
}GET/links/{code}Scope: links:read
Get a link
One link by its code. codeLocked is true once the link was opened: from then on its back-half cannot change.
Request
curl https://api.dwnl.cc/v1/links/a8Kd3xQ \ -H "Authorization: Bearer $DWNL_TOKEN"
200 OK
{
"code": "a8Kd3xQ",
"shortUrl": "https://dwnl.cc/a8Kd3xQ",
"host": null,
"target": "https://example.com/blog/launch-notes",
"title": "Launch notes",
"tags": [],
"status": "active",
"expiresAt": null,
"codeLocked": true,
"createdAt": "2026-09-01T09:30:00Z",
"updatedAt": "2026-09-01T09:30:00Z"
}PATCH/links/{code}Scope: links:write
Update a link
Changes only the fields you send. The short link and its click history stay the same. Links are never deleted: pause one, or give it an expiry date.
Body
- targetstring
- A new destination
- titlestring
- A new name; null removes it
- statusstring
- paused switches the link off (visitors see a notice by default); active switches it on
- expiresAtstring
- When it switches off by itself: a date or a time, UTC; null for never
Request
curl -X PATCH https://api.dwnl.cc/v1/links/a8Kd3xQ \
-H "Authorization: Bearer $DWNL_TOKEN" \
-H "Content-Type: application/json" \
-d '{"status":"paused"}'200 OK
{
"code": "a8Kd3xQ",
"shortUrl": "https://dwnl.cc/a8Kd3xQ",
"host": null,
"target": "https://example.com/blog/launch-notes",
"title": "Launch notes",
"tags": [],
"status": "paused",
"expiresAt": null,
"codeLocked": true,
"createdAt": "2026-09-01T09:30:00Z",
"updatedAt": "2026-10-15T08:12:00Z"
}GET/links/{code}/statsScope: stats:read
Link stats
Clicks per day and the top referrers, countries and devices for a period (abridged here). Known bots are left out.
Query
- rangestring
- 7d, 30d or 90d; default 30d
- tzstring
- IANA time zone for the daily buckets; default your account’s
Request
curl "https://api.dwnl.cc/v1/links/a8Kd3xQ/stats?range=30d" \ -H "Authorization: Bearer $DWNL_TOKEN"
200 OK
{
"code": "a8Kd3xQ",
"range": "30d",
"tz": "UTC",
"days": [
{ "date": "2026-09-15", "clicks": 980, "uniques": 610 },
{ "date": "2026-09-16", "clicks": 820, "uniques": 540 }
],
"total": 11250,
"uniques": 7200,
"lifetime": 11250,
"referrers": {
"rows": [
{
"key": "github.com",
"label": "github.com",
"clicks": 3100,
"share": 0.28
},
{
"key": "news.ycombinator.com",
"label": "news.ycombinator.com",
"clicks": 2600,
"share": 0.23
}
],
"otherClicks": 1500,
"otherCount": 9
}
}Account
GET/me
Current account
Who the token belongs to, the account's plan and the token itself (abridged: the full answer also lists linked sign-ins and preferences). Works with any valid token, so it is the quick way to check one.
Request
curl https://api.dwnl.cc/v1/me \ -H "Authorization: Bearer $DWNL_TOKEN"
200 OK
{
"id": "65f1c2a9e4b0a1d2c3e4f5a6",
"name": "Lena Hartmann",
"email": "lena@example.com",
"provider": "github",
"handle": "lenahartmann",
"memberSince": "2026-03-02T10:00:00Z",
"plan": {
"id": "free",
"since": null,
"agreement": null,
"contact": null
},
"deactivatedAt": null,
"token": {
"id": "tok_8f3k2m9q",
"prefix": "dwnl_pat_7Kq2",
"scopes": ["links:read", "links:write"],
"expiresAt": null
}
}Command line
The dwnl CLI
dwnl is a single binary for macOS and Linux on this API. It signs a terminal in with a device code, so there is no token to paste, and keeps the credential in the system keychain. --json prints machine-readable answers; DWNL_API_URL points it at another API.
- dwnl login
- Sign in: confirm the code it prints in the browser (--no-browser only prints it)
- dwnl whoami
- The account signed in on this terminal
- dwnl logout
- Revoke this terminal’s credential and remove it
- --json
- Answers and errors as JSON, for scripts
Terminal
# Install to ~/.local/bin (or: brew install isalikov/tap/dwnl)
curl -fsSL https://raw.githubusercontent.com/isalikov/dwnl/master/scripts/install.sh | sh
# Sign in once
dwnl login
Open https://app.dwnl.cc/developers/cli/device and enter WDJB-MJHT
Signed in as you@example.com (github)
# Who is signed in here
dwnl whoami
you@example.com (github)
Need a higher rate limit, or the traffic endpoints that come with Pro? Tell us what you are building.
Talk to us