API Reference/api/shorten

/api/shorten

Info

POST
Shorten a URL

Headers

Header NameTypeDescription
ZwsbooleanIf this header is present it will create a zero-width-space url
Max-ViewsnumberThe maximum amount of views before the url is deleted
AuthorizationstringA required field, your users auth token

Body (JSON)

Field NameTypeDescription
urlstringThe URL to shorten
vanitystring?The vanity URL to use. If the vanity is used already, it will error out.
{
"url": "https://google.com",
"vanity": "1234"
}

200
Ok (JSON)

Field NameTypeDescription
urlstringThe shortened URL
{
"url": "https://example.com/go/1234"
}

200
Ok (Text)

If the No-JSON header is present, it will return a text response. This is useful if you want to skip the JSON parsing, which can be slow in the case of jq.

https://example.com/go/1234

400
Bad Request (JSON)

  • no body - No JSON body was provided.
  • no url - No URL was provided. (.url)
  • invalid max views (invalid number) - The Max-Views header is set to an invalid number.
  • invalid max views (max views < 0) - The Max-Views header is set to a number less than 0.
  • vanity already exists - If a vanity is provided, and it exists.
  • vanity is empty - If a vanity is provided, and it is empty (no empty strings).

401
Forbidden (JSON)

  • no authorization - The Authorization header is not present.
  • authorization incorrect - The Authorization header is incorrect.
Last updated: 3/23/2023
Edit this page on GitHub