API Access

Registered Users Can Now Generate Short URL's From There Own Application/Website.

User Must Follow Below Step To Use our API Directly.

  1. First of all login to your account and then go to Settings.
  2. From there you will get your API Key (API Key is written at Bottom-Right Corner).
  3. Now you have to call our API with your API Key, Long URL and Custom Alias(If any)
  4. Our API URL is https://1yo.co/api?api=< YOUR API KEY >&url=< LONG URL TO BE SHORTEN >&custom=< CUSTOM ALIAS (if required) >
  5. After calling this url from your application it will return response JSON format.

Example in PHP:-

    $url="https://1yo.co/api?api=saSddas22Sc&url=https://google.co.in&custom=google"; //API URL which has to be called.
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_TIMEOUT, 60);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    $result = curl_exec($ch); // this will contain response of API request inJSON format
    $decoded_url=json_decode($result,true); //after decoding JSON string array will be stored in $decoded_url.
    //$decoded_url will contain array("error"=> "0 (if url Generated)", "short"=>  "Short URL")
    echo "URL GENERATED: ".$decoded_url["short"]; // display shortened URL.
    curl_close($ch);
?>