Project Phil Documentation
Sign in

Edit Link

Added in v1.0

PATCHhttps://api.example.com/api/link

Requires authentication: x-api-key: YOUR_API_KEY

Updates the name and destination URL of an existing shortened link. The link ID, new name and new destination URL must be supplied in the request body.

Headers

  • x-api-keystringrequired
    Your API authentication key.
  • Content-Typestringrequired
    Must be application/json.

Body parameters

  • idintegerrequired
    The database ID of the shortened link to update.
  • namestringrequired
    The new name for the shortened link.
  • urlstringrequired
    The new destination URL.

Responses

  • 200OK
  • 404Not Found
  • 409Conflict

Request

curl -X PATCH 'https://api.example.com/api/link' \
  -H 'x-api-key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "id": 123,
  "name": "example",
  "url": "https://example.com"
}'
const res = await fetch('https://api.example.com/api/link', {
  method: 'PATCH',
  headers: {
    'x-api-key': 'YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({ id: 123, name: 'example', url: 'https://example.com' })
});
const link = await res.json();
import requests

res = requests.patch(
    'https://api.example.com/api/link',
    headers={'x-api-key': 'YOUR_API_KEY'},
    json={'id': 123, 'name': 'example', 'url': 'https://example.com'}
)
link = res.json()
$ch = curl_init('https://api.example.com/api/link');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PATCH');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'x-api-key: YOUR_API_KEY',
    'Content-Type: application/json'
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
    'id' => 123,
    'name' => 'example',
    'url' => 'https://example.com'
]));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$link = json_decode(curl_exec($ch), true);

200 OK

{
  "id": 1,
  "name": "example",
  "url": "https://example.com",
  "count": 0,
  "creator": "API",
  "creatorID": "0",
  "createdAt": 1795400000000
}

404 Not Found

{
  "msg": "That link no longer exists."
}

409 Conflict

{
  "msg": "A link with that name already exists."
}
Written by !RAB Last updated 1 Dec 2026

Discussion 0

No comments yet. Sign in with Discord to start the conversation.