With our API you can use short URL functionality for your websites.

URL Only
for generating a URL with this API, send a POST or GET request in the following format:

- http://u2s.ir/?api=1&return_text=1&url={URL}

U2S then will create a short URL for the link and return it as a plain text. i.e:
- http://u2s.ir/u68

Generate & Redirect
if you send your request without "return_text" param, the user will be redirected to the results page on U2S site instead of just the shorten URL text being returned.

View clicks count
use this format if you want to know how many clicks have happend on your link:
- http://u2s.ir/?api=1&return_text=1&shorten={Shorten}


Extra Params:
we have some supported params which you can use them to get extra informations:
customurl : Custom short URL.
password : password for visiting the link.
expireddate : expire date (ex 2010/11/08).
expiredtime :expire time (ex 18:22).
totaluses :total uses from shorten URL
stringpreview : show string before redirect.
linkpreview :show link before redirect.
showframe :show link in frame for hidden URL.
return_long :if it is 1 then it will return the long address.

Error numbers :
0 :Unknown error. please try again .
-1 :the param for URL is invalid .
-2 :the param for Custom URL is invalid/the URL has been uesd before.
-3 :the param for expire date is not valid .
-4 :the param for expire time is not valid .
-5 :the param for password is not valid .
-6 :the param for Total uses is not valid .
-7 :the param for show frame is not valid .
-8 :the param for String Preview is not valid .
-9 :the param for link preview is not valid .
-11 :the param for URL is not for http://u2s.ir/