Deleting a short URL
Delete a short URL
Information below might be outdated - please visit our recently updated API Reference
The instruction below shows how to delete the existing URL.
1) Get your API key here: https://app.short.io/settings/integrations/api-key
- Click "Create API key".
- Add a Secret key.
2) Copy an ID of a short link you want to delete.
- Open the statistics of the short link.
- Copy the link ID.
3) Install prerequisites for requests.
pip install requests
npm install --save axios
Now everything is ready to run the following snippet. It will delete a short URL.
4) Create a file: filename.py/ .js/ .rb. Use the code snippet below.
Please, replace LINK_ID with appropriate value.
import requests
url = "https://api.short.io/links/LINK_ID"
headers = {'authorization': '<<apiKey>>'}
response = requests.request("DELETE", url, headers=headers)
print(response.text)
const axios = require('axios');
const options = {
headers: {
'content-type': 'application/json',
authorization: 'API_KEY'
}
};
axios.delete('https://api.short.io/links/LINK_ID', options)
.then(function (response) {
console.log(response.data);
}) .catch(function (response) {
console.log(response);
});
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://api.short.io/links/LINK_ID")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Delete.new(url)
request["authorization"] = 'API_KEY'
response = http.request(request)
puts response.read_body
5) Launch the file.
python filename.py
node filename.js
ruby filename.rb
6) JSON Response (link is deleted).
Once you run the code, you will see the response.
{
"success":true,
id: 'LINK_ID'
}
Most important parameter here is the "id".
Updated 4 months ago