API


Our API is fairly simple! First, to access it from your application, you will need an API key. You can generate or change your API key on your user page.

Once you have the key, all you need to do is make a proper request to our API page. Our API accepts both GET and POST methods. All you have to do is pass your key and the URL that you want to shorten. Here is an example of how you would do it with the GET method:


https://ze.wtf/api.php?key=<YOUR_KEY_HERE>&url=<YOUR_LONG_URL>

Additionally, you can specify a "ref" parameter to add a custom id to your url:


https://ze.wtf/api.php?key=<YOUR_KEY_HERE>&url=<YOUR_LONG_URL>&ref=<YOUR_CUSTOM_ID>

If you have done it correctly, your application will receive a JSON response that looks something like this:


{
	success: 1,
	url: https://ze.wtf/<YOUR_NEW_URL>,
	message: "URL shortened successfully."
}

If you haven't however, the response will make sure to tell you why. For example, this is what you will get if you forget to pass your key:


{
	success: 0,
	message: "ERROR: Missing API key"
}

You can also specify an additonal parameter called "simple". This will make the page return the shortened URL in case of successful insert or 0 in case of an error.

There are a total of 6 error messages you can receive, all of which are pretty self-explanatory:


  • Missing key
  • Missing url
  • Invalid key
  • Invalid url
  • Empty request
  • Url exists
  • Query failed

Happy programming!