Your API Token

Loading...
Loading...

Keep your token secure. Never share it publicly or commit it to version control. Regenerating creates a new token and immediately revokes the previous one.

Created
-
Last used
-
Plan
-

Usage & Limits

Current hour
-
API requests this hour
Links you can still create today
Links remaining on your plan
Custom links remaining
Loading plan information...

Quick Start Guide

Full API documentation

Base URL

https://api.gjw.cx/api/v1

Authentication

Send your API token in the Authorization header of every request:

Authorization: Bearer YOUR_API_TOKEN

Example

curl -X POST https://api.gjw.cx/api/v1/shorten \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com/a/very/long/page"}'

Limits by plan

Limit Basic Standard Premium Unlimited
Links
New links per day10200UnlimitedUnlimited
Links per account2002,00020,000Unlimited
Custom links38190Unlimited
API requests
Requests per hour1,0001,0001,000Unlimited
Requests per second10101050
Concurrent requests55510

Scroll the table sideways to see all plans.

How limits are counted

LimitWhat countsResetsWhen exceeded
New links per dayNew links you shorten on the website, with the browser extensions, with bulk shortening or through the API. Deleting a link does not give it back. Shortening a URL that you already have as a regular link (sent without a custom code) returns that link and does not count.00:00 UTC+7403 daily_limit_reached
Links per accountThe links you have now, however they were made. Links in Trash do not count.When you delete a link403 link_limit_reached
Custom linksThe custom links you have now, not counting Trash. Each one also counts as a link.When you delete one403 custom_limit_reached
Requests per hourEvery API request with a valid token, errors included, also concurrency_limited and server_busy. Requests rejected with rate_limited or temporarily_throttled do not count.At the start of each clock hour429 rate_limited, Retry-After until the hour ends
Requests per secondThe same requests, per clock second.Every second429 rate_limited, Retry-After: 1
Concurrent requestsYour requests that are in progress at the same time.When a request finishes429 concurrency_limited, Retry-After: 1
  • Unlimited means no quota. Requests per second, concurrent requests and system protection still apply to every plan, including at most 30 requests per second from one IP address, so one server cannot go above 30 per second.
  • On plans with an hourly quota, responses carry X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset (the Unix time when the hour ends); they are not sent on Unlimited or on requests rejected before the quota check, such as a 401.
  • System protection can also answer 429 server_busy, temporarily_throttled (after more than 50 requests rejected with rate_limited or concurrency_limited in a minute) or ip_blocked (after more than 20 invalid tokens in a minute): wait the number of seconds in Retry-After, then try again.

Endpoints

POST /shorten
Create a short link. Body: {"url": "...", "custom": "SpringLaunch", "description": "..."}; custom (6-100 letters, digits, - or _; letter case is ignored; see the rules) and description are optional. Returns 201, or 200 with the existing link for a URL you already shortened.
GET /links
List your links, newest first. Query: limit (1-100, default 50) and cursor (use next_cursor from the previous page).
GET /link/{id}/stats
Click statistics for one of your links. {id} is the short code, e.g. abc123.
DELETE /link/{id}
Move one of your links to trash. It can be restored within 30 days.

Errors

Errors are JSON: {"error": "message", "code": "error_code"}. Codes: invalid_json / invalid_url / invalid_slug / slug_too_short / reserved_slug / invalid_description / invalid_limit / invalid_cursor (400), missing_token / invalid_token (401), account_blocked / domain_blocked / daily_limit_reached / link_limit_reached / custom_limit_reached (403), not_found (404), slug_taken (409), payload_too_large (413), rate_limited / concurrency_limited / server_busy / ip_blocked / temporarily_throttled (429, with Retry-After), internal_error (500), timeout / unavailable / slug_unavailable (503).