API Info

    Simply have your application access a URL similar to the following, via an HTTP GET request:

    cURL Command Line Example

    curl -d "url={YOUR LINK HERE}" http://qik.li/api/shorten.php

    Returns the shortened link on a single line. Replace {YOUR LINK HERE} with your link... please omit curly brackets!

    JSON/jQuery Example

    function CompressURL(url){

    var link = 'http://qik.li/api/shorten.php?format=json&url=' + encodeURIComponent(url)+'&jsoncallback=?';

    $.getJSON(link, function(data){




    PHP Source Code Example

    This example requires cURL (ubuntu/linux package name is php5-curl)

    function CompressURL($url,$format) {

    $ch = curl_init();

    curl_setopt($ch, CURLOPT_URL, "http://qik.li/api/shorten.php?url=".urlencode($url)."&format=".$format);

    curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);

    curl_setopt($ch, CURLOPT_HEADER, 0);

    $shorturl = curl_exec ($ch);

    curl_close ($ch);

    return $shorturl;

    } echo CompressURL("http://twitter.com","xml");

    Python Source Code Example

    import urllib
    def CompressURL(url):
    """Compress the URL using qik.li"""
    apiurl = "http://qikl.li/api/shorten.php?url="
    quoted = urllib.quote_plus(url)
    shorturl = urllib.urlopen(apiurl + quoted).read()
    return shorturl
    print CompressURL("http://www.twitter.com")


    This is the output in jSon format

    { "errorCode": 0, "errorMessage": "",
    "results": { "qikCode": SfRZ", "shortKeyword": "", "qikUrl": "http://qik.li/SfRZ"},
    "statusCode": "OK" }

    This is the output in xml format

    <?xml version="1.0" encoding="UTF-8" ?>
    - <qikli>
    <errorMessage />
    - <results>
    - <qikCode>
    - <![CDATA[ zaq4]]>
    - <qikUrl>
    - <![CDATA[ http://qik.li/zaq4]]>
    - <shortKeyword>
    - <![CDATA[keyword]]>