Archiving a short URL

An archived short link is only hidden from the Dashboard, yet it remains accessible and functions as intended

To archive an existing short link

  1. Create a secret API key from the Integrations and API menu: https://app.short.io/settings/integrations/api-key
  2. Get the ID of the short link which you want to archive:
  • In the Short.io Dashboard open the link for editing:
  • Copy the link ID from your browser's address bar:
  1. Install prerequisites for requests (if necessary, depending on your programming language):
pip install requests
  1. Using the code snippet below, create a file: filename.py/ .js/ .rb

📘

Please replace LINK_ID and APIKEY with the appropriate values.

import requests

url = "https://api.short.io/links/archive"

import json
payload = json.dumps({"link_id":LINK_ID})
headers = {
    'content-type': "application/json",
    'authorization': "<<apiKey>>"
    }

response = requests.request("POST", url, data=payload, headers=headers)

print(response.text)
const data = {
  "link_id":'LINK_ID'
};

const options = {
  headers: {
    'content-type': 'application/json',
    authorization: '<<apiKey>>'
  },
  method: "post",
  body: JSON.stringify(data)
};

const response = await fetch('https://api.short.io/links/archive', options)
console.log(await response.json());
require 'uri'
require 'net/http'
require 'openssl'
require 'json'

url = URI("https://api.short.io/links/archive")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request["authorization"] = '<<apiKey>>'
request.body = JSON.generate({"link_id":LINK_ID})

response = http.request(request)
puts response.read_body
  1. Launch the file:
python filename.py
node filename.js
ruby filename.rb
  1. The JSON response should be "success": true:
{
  "success":true
}

You have successfully archived a short link through our API.

Now the link is not visible from the Branded links panel. You can find it by using the filters and setting the Search query to archived:true :