Delete Link
DELETE
https://api.example.com/api/link/{id}
Requires authentication:
x-api-key: YOUR_API_KEY
Permanently deletes an existing shortened link using its database ID. Returns the link object as it existed immediately before deletion.
Headers
-
x-api-keystring requiredYour API authentication key.Example:YOUR_API_KEY
Path parameters
-
idinteger requiredThe database ID of the shortened link to delete.Example:1
Responses
- 200OK
- 404Not Found
Request
curl -X DELETE 'https://api.example.com/api/link/1' \
-H 'x-api-key: YOUR_API_KEY'
const response = await fetch('https://api.example.com/api/link/1', {
method: 'DELETE',
headers: {
'x-api-key': 'YOUR_API_KEY',
},
});
const data = await response.json();
console.log(data);
import requests
response = requests.delete(
"https://api.example.com/api/link/1",
headers={
"x-api-key": "YOUR_API_KEY",
},
)
print(response.json())
<?php
$ch = curl_init('https://api.example.com/api/link/1');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'x-api-key: YOUR_API_KEY',
],
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
print_r($response);
Response
OK
{
"id": 1,
"name": "google",
"url": "https://google.com",
"count": 0,
"creator": "API",
"creatorID": "0",
"createdAt": 1795400000000
}
Not Found
{
"msg": "That link no longer exists."
}