URL SHORTENINGMADE FREE, EASY
AND ACCESSIBLE
SHORTEN URL USING PUBLIC API
JavaScriptPythonGOOther
        
          
          let longurl = "https://verylongurl.example.com";
          
          fetch("https://api.clic.run/create",
          {headers:{"Content-Type":" application/json"},
          body:JSON.stringify({url:longurl}),
          method:"POST"})
          .then((resp) => resp.json())
          .then(data=>{
            if(!data.error){
              console.log("Shortend URL:"+data.short);
            }
            else{
              console.log("Error:"+data.error);
            }
          });
          
        
        
          import requests
          
          longUrl = 'https://verylongurl.example.com'
          obj = {'url': longUrl}
          
          x = requests.post("https://api.clic.run/create", data = obj)
          
          print(x.text)
          # {"short":"clic.run/n5EBkwjKl"}
          
        
        
          package main
          
          import "fmt"
          import "net/http"
          import "io/ioutil"
          import "bytes"
          
          func main() {
            longUrl := "https://verylongurl.example.com";
            jsonLoad := fmt.Sprintf(`{"url":"%s"}`, longUrl)
            
            var jsonStr = []byte(jsonLoad)
            req, err := http.NewRequest("POST", "https://api.clic.run/create", bytes.NewBuffer(jsonStr))
            req.Header.Set("Content-Type", "application/json")
            
            client := &http.Client{}
            resp, err := client.Do(req)
            if err != nil {
              panic(err)
            }
            defer resp.Body.Close()
            
            body, _ := ioutil.ReadAll(resp.Body)
            fmt.Println(string(body))
            // {"short":"clic.run/XMQljJnwm"}
          }
          
        
        
          Send a post request from any other environment
          
          The api is public, so you can shorten url by sending a post request to
          
          https://api.clic.run/create
          
          with this JSON payload
          
          {url:"https://yourlongurl.example.com"}