Skip to main content

Deleting a short URL

  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:

Screenshot

  • Copy the link ID from your browser's address bar:

Screenshot

  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 {user.link_id} and {user.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;
}

  1. The JSON response should be "success": true, idString: '{user.link_id}' :
{
"success": true,
idString: 'LINK_ID'
}

Most important key in the response is idString.