Skip to content

About NOS.RE Url Shortener

NOS.RE

NOS.RE is a simple URL shortener focused on the nostr community.

It is free to use and is donation supported like all Relayable.org services.

Browser Bookmarklet

Drag this link to your browser link bar to allow for shortneing from site wish to shorten:
NOS.RE Popup

Security

NOS.RE uses recaptcha, DNS Spam Blacklists, rate-limiting, link active validation, and many other security measures to prevent Spam and other potential issues. If you encounter any issues please email us: abuse@relayable.org

API

You need to send parameters to https://api.nos.re/ either via GET or POST
(remember to URL-encode parameters if via GET). These parameters are:

  • The requested action: "shorturl" (get short URL for a link), "expand" (get long URL of a shorturl), "url-stats" (get stats about one short URL), "stats" (get stats about your links) or "db-stats" (get global link and click count)
  • With action = "shorturl" :
    • the url to shorten
    • optional keyword and title for custom short URLs
    • output format: either "jsonp", "json", "xml" or "simple"
  • With action = "expand" :
    • the shorturl to expand (can be either 'abc' or 'https://nos.re/abc')
    • output format: either "jsonp", "json", "xml" or "simple"

Sample Requests

Example of a GET request with Javascript (using jQuery) to shorten a URL

var api_url  = 'https://api.nos.re';
var response = $.get( api_url, {
    action:   "shorturl",
    format:   "json",
    url:      "https://relayable.org/"
    },
    // callback function that will deal with the server response
    function( data) {
        // now do something with the data, for instance show new short URL:
        alert(data.shorturl);
    }
);

Example of a POST request with PHP to expand a short URL

<?php
$api_url =  'https://api.nos.re/';

// Init the CURL session
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $api_url);
curl_setopt($ch, CURLOPT_HEADER, 0);            // No header in the result
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Return, do not echo result
curl_setopt($ch, CURLOPT_POST, 1);              // This is a POST request
curl_setopt($ch, CURLOPT_POSTFIELDS, array(     // Data to POST
        'shorturl' => 'lay',
        'format'   => 'json',
        'action'   => 'expand',
    ));

// Fetch and return content
$data = curl_exec($ch);
curl_close($ch);

// Do something with the result. Here, we echo the long URL
$data = json_decode( $data );
echo $data->longurl;

API Requests are rate-limited so if run into any issues please DM us: npub1hweyj43tg2ddgtkrgnj55cvg3d7qfckxppx6kyuk83puqkkzqhcqahyfue
NOS.RE on nostr