api


We also provide api for developers. You can use our service in any project and it doesn't matter what platform or what language do you use.

First of all you need to get your api key, submit your e-mail and we will send your api key(if you forgot your api key you can always resubmit your e-mail and we will resend it).

Wrong URL
get

After receiving your api key you can start to use our service. To use api you simply need to send ajax call to https://parg.co/api/shorten URL with post parameters listed bellow:

url - url you want to shorten
email - e-mail address connected to your api key
api_key - your api key

You'll get the answer in json format. You'll always get "status" with two expected values "success" or "failed". For both success and failed cases expected data is listed below:

success example:
{
    "short_url" : "https://parg.co/ba",
    "long_decoded" : "http://例子.测试",
    "long_encoded" : "http://xn--fsqu00a.xn--0zwm56d",
    "status" : "success"
}

failed example:
{
    "errors":[
        {
            "code" : 1001,
            "message" : "Empty URL" 
        }
    ],
    "status" : "failed"
}

error codes:
1001 - Invalid URL
1002 - Server error
2001 - Missing url parameter
2002 - Missing email parameter
2003 - Missing api_key parameter
2004 - Wrong email or api_key
2005 - Limit of requests is exceeded