Deleting a short URL

Instructions on how to remove an existing short link

To delete 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 delete:
  • In the Short.io Dashboard open the link for editing:
  • Copy the link ID from your browser's address bar:
  1. Then you may need to install prerequisites for HTTP requests (if necessary, depending on your programming language and its version).
  2. Use the following code snippets to delete a short link:

📘

Please replace LINK_ID and APIKEY with the appropriate values.

<?php
$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.short.io/links/<<link_id>>",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "DELETE",
  CURLOPT_HTTPHEADER => [
    "Authorization: <<apiKey>>",
    "accept: application/json"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}  

import requests

url = "https://api.short.io/<<link_id>>"

headers = {
    "accept": "application/json",
    "Authorization": "<<apiKey>>"
}

response = requests.delete(url, headers=headers)

print(response.text)
const url = 'https://api.short.io/links/<<link_id>>';
const options = {
  method: 'DELETE',
  headers: {accept: 'application/json', Authorization: '<<apiKey>>'}
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.short.io/links/<<link_id>>"))
    .header("accept", "application/json")
    .header("Authorization", "<<apiKey>>")
    .method("DELETE", HttpRequest.BodyPublishers.noBody())
    .build();
HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
    Method = HttpMethod.Delete,
    RequestUri = new Uri("https://api.short.io/links/<<link_id>>"),
    Headers =
    {
        { "accept", "application/json" },
        { "Authorization", "<<apiKey>>" },
    },
};
using (var response = await client.SendAsync(request))
{
    response.EnsureSuccessStatusCode();
    var body = await response.Content.ReadAsStringAsync();
    Console.WriteLine(body);
}
  1. The JSON response should be "success": true, idString: 'LINK_ID' :
{
  "success": true,
  idString: 'LINK_ID'
}

Most important key in the response is idString.