RT.nu provides a simple REST/json interface for shortening URLS and retrieving basic stats. The official RT.nu API url is: http://rt.nu/api/

api/shorten/

Methods
POST, GET
Formats
JSON
Parameters
  • url - The long url to be shortened.
Returns
{ 
	"error" : false,
  	"error_message" : null,
  	"response" : "http://rt.nu/vt6x"
}
						

/api/stats/[short]/original

Methods
POST, GET
Formats
JSON
Parameters
[short] - The four digit short url path
Returns
{ "error" : false,
  "error_message" : null,
  "response" : "http://www.omnipotent.net/jquery.sparkline/#who"
}
						

/api/stats/[short]/clicks

This method returns the total number of clicks for the url specified by [short]

Methods
POST, GET
Formats
JSON
Parameters
[short] - The four digit short url path
Returns
{ "error" : false,
  "error_message" : null,
  "response" : "25"
}
						

/api/stats/[short]/rank

This method returns the total number of shortened urls (total) and where the current url ranks based on total clicks

Methods
POST, GET
Formats
JSON
Parameters
[short] - The four digit short url path
Returns
{ 
  "error" : false,
  "error_message" : null,
  "response" : 
   { 
      "rank" : "27",
      "total" : "98"
   }
}
						

/api/stats/[short]/velocity

This method returns an array containing the total number of clicks per hour this url has received.

Methods
POST, GET
Formats
JSON
Parameters
[short] - The four digit short url path
Returns
{ 
  "error" : false,
  "error_message" : null,
  "response" : [ 
      { "0" : "45",
        "1" : "2009-05-05",
        "2" : "7",
        "date" : "2009-05-05",
        "hour" : "7",
        "redirects" : "45"
      },
      { "0" : "37",
        "1" : "2009-05-05",
        "2" : "8",
        "date" : "2009-05-05",
        "hour" : "8",
        "redirects" : "37"
      },
      { "0" : "2",
        "1" : "2009-05-05",
        "2" : "9",
        "date" : "2009-05-05",
        "hour" : "9",
        "redirects" : "2"
      }
    ]
}
						

/api/stats/[short]/referrers

Returns the distinct referring urls and the number of times it referred a visitor.

Methods
POST, GET
Formats
JSON
Parameters
[short] - The four digit short url path
Returns
{ 
  "error" : false,
  "error_message" : null,
  "response" : [ 
      { "0" : "No Referrer",
        "1" : "24",
        "referrals" : "24",
        "referrer" : "No Referrer"
      },
      { "0" : "http://twitter.com/",
        "1" : "2",
        "referrals" : "2",
        "referrer" : "http://twitter.com/"
      },
      { "0" : "http://powertwitter.me/",
        "1" : "1",
        "referrals" : "1",
        "referrer" : "http://powertwitter.me/"
      }
    ]
}
						

api/stats/domains/last/[n]

Methods
POST, GET
Formats
JSON
Parameters
[n] - any number between 1-100 ex: /api/stats/domains/last/5 or /api/stats/domains/last/10
Returns
{ 
  "error" : false,
  "error_message" : null,
  "response" : [ { "0" : "http://mdog02.deviantart.com/art/Experiences-58166534",
        "1" : "bd_j",
        "2" : "2009-04-30 15:30:27",
        "date_created" : "2009-04-30 15:30:27",
        "original" : "http://mdog02.deviantart.com/art/Experiences-58166534",
        "short" : "bd_j"
      },
      { "0" : "http://elbelbelb2000.blogtog.com/",
        "1" : "2aah",
        "2" : "2009-04-30 14:57:19",
        "date_created" : "2009-04-30 14:57:19",
        "original" : "http://elbelbelb2000.blogtog.com/",
        "short" : "2aah"
      },
      { "0" : "http://google.com/",
        "1" : "q3hz",
        "2" : "2009-04-30 14:47:46",
        "date_created" : "2009-04-30 14:47:46",
        "original" : "http://google.com/",
        "short" : "q3hz"
      }
    ]
}
						

api/stats/urls/byhour

Methods
POST, GET
Formats
JSON
Parameters
none
Returns
{ 
  "error" : false,
  "error_message" : null,
  "response" : [ { "0" : "1",
        "1" : "2009-04-30",
        "2" : "13",
        "date" : "2009-04-30",
        "hour" : "13",
        "urls" : "1"
      },
      { "0" : "42",
        "1" : "2009-04-30",
        "2" : "14",
        "date" : "2009-04-30",
        "hour" : "14",
        "urls" : "42"
      }
    ]
}
						

api/stats/redirects/byhour

Methods
POST, GET
Formats
JSON
Parameters
none
Returns
{ 
  "error" : false,
  "error_message" : null,
  "response" : [ { "0" : "1",
        "1" : "2009-04-30",
        "2" : "13",
        "date" : "2009-04-30",
        "hour" : "13",
        "redirects" : "1"
      },
      { "0" : "42",
        "1" : "2009-04-30",
        "2" : "14",
        "date" : "2009-04-30",
        "hour" : "14",
        "redirects" : "42"
      }
    ]
}
						

api/stats/domains/popular

Methods
POST, GET
Formats
JSON
Parameters
none
Returns
{ 
  "error" : false,
  "error_message" : null,
  "response" : [ { "0" : "rt.nu",
        "1" : "6",
        "host" : "rt.nu",
        "urls" : "6"
      },
      { "0" : "google.com",
        "1" : "4",
        "host" : "google.com",
        "urls" : "4"
      },
      { "0" : "www.yahoo.com",
        "1" : "2",
        "host" : "www.yahoo.com",
        "urls" : "2"
      }
	  ...
    ]
}