Agent Link API

one endpoint for short links

A link API with one call. This page is the reference. Every request is a plain GET, so it works from curl, a cron job or a browser address bar. There is nothing to install and nothing to configure.

Create a link

GET/

Send the long address in the long_url parameter. You get the short link back. Ask for the same address again and you get the same short link.

Parameters

NameDescription
long_urlrequiredThe address to shorten.
custom_aliasoptionalThe short name you want, if you do not like the one you are given.
formatoptionalhtml for a page, otherwise plain text.

No API key, no account, no rate-limit header to read. To see where a short link goes without following it, add + to the end of it.

Responses

A successful call returns 200 with the short link. A malformed address returns 400 and a sentence saying why. Links stay put: nothing is ever removed.

Request

curlHTTP
# create a link
curl "https://go.example/?long_url=https://example.com/a/very/long/path"

Response · 200

https://go.example/k3d9x

Where does it lead? Add a plus

curl "https://go.example/k3d9x+"

{
  "short": "https://go.example/k3d9x",
  "target": "https://example.com/a/very/long/pa...

Usage

Agent Link API: a free URL shortener. No sign-up and no API token.

Make a link. The answer is JSON and the short link is in "shorturl":

    https://www.agentlinkapi.com/api/v2/links?long_url=https://example.com/a/long/address

From a shell:

    curl -G https://www.agentlinkapi.com/api/v2/links --data-urlencode 'long_url=https://example.com/page?a=1&b=2'
    curl https://www.agentlinkapi.com/api/v2/links -d 'long_url=https://example.com/a/long/address'

Pick the short name yourself, 1 to 64 letters, digits, - or _:

    https://www.agentlinkapi.com/api/v2/links?custom_alias=my-name&long_url=https://example.com/a/long/address

As one line of text:

    https://www.agentlinkapi.com/api/v2/links?format=text&long_url=https://example.com/a/long/address

Follow a link, or see where it leads without going there:

    https://www.agentlinkapi.com/<code>         redirects
    https://www.agentlinkapi.com/<code>+        the address as text
    https://www.agentlinkapi.com/<code>.json    the address and when the link was made

Put long_url last, or percent-encode it: an address written out as it is
runs to the end of the line, with its own ? and & in it.

The same address gives the same short link every time, unless you name
it yourself. A name that is taken answers 409. Links do not expire.