Skip to main content
PATCH
/
change_url
Change Destination URL
curl --request PATCH \
  --url https://api.example.com/change_url
{
  "message": "<string>"
}
This endpoint allows you to change the destination URL that a short URL redirects to. The short URL code remains the same, but visitors will be redirected to the new destination.
This endpoint requires authentication. Include a valid Bearer token in the Authorization header.

Authentication

This endpoint uses HTTPBearer security. Include the access token obtained from the /login endpoint:
Authorization: Bearer <access_token>

Query Parameters

url
string
required
The new destination URL to redirect to. The URL will be automatically formatted and validated against the blacklist.

Response

message
string
Success message confirming the destination URL has been updated

Status Codes

  • 200: Destination URL successfully changed
  • 400: URL is blacklisted
  • 404: URL not found
  • 403: Invalid or expired token

URL Validation

The endpoint performs the following validations:
  • Checks if the URL is on the blacklist (returns 400 if blacklisted)
  • Automatically formats the URL using formatURL() helper
  • Updates the destination while keeping the short code unchanged
curl -X PATCH "https://api.example.com/change_url?url=https://newdestination.com" \
  -H "Authorization: Bearer <access_token>"

Example Use Cases

  • Update a campaign URL without changing the short link
  • Fix a typo in the destination URL
  • Redirect existing traffic to a new landing page
  • A/B test different destinations with the same short code

Build docs developers (and LLMs) love