Skip to main content
DELETE
/
v1
/
links
curl --request DELETE \
  --url https://{environment}.shortpen.com/v1/links \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "url_id": 501
}'
{
  "success": true,
  "status_code": 200,
  "data": {
    "deleted": 1
  },
  "message": "Link successfully deleted"
}
Delete one or more links by supplying their url_id. Deletion is scoped to the organization tied to your API token, so you can only remove links your key owns.
You can find the url_id of any link by calling GET /v1/links — the id field in each item is the value you need.

How it works

Links are soft-deleted: they immediately disappear from GET /v1/links and stop resolving, but their historical analytics are retained and the link can be restored from the dashboard. The same destination slug becomes available for reuse once a link is deleted. Pass url_id as either:
  • a single integer — { "url_id": 501 }
  • an array of integers for bulk deletion — { "url_id": [501, 502, 503] }
Only links belonging to the authenticated organization are affected; IDs that do not match are skipped. If none of the supplied IDs match a link in your organization, the API returns a 404.

Request body

FieldTypeRequiredDescription
url_idinteger or integer[]ID of the link to delete, or an array of IDs for bulk deletion.

Response highlights

  • data.deleted — the number of links that were actually removed. With a bulk request, this can be lower than the number of IDs supplied if some did not belong to your organization.
{
  "success": true,
  "status_code": 200,
  "data": { "deleted": 1 },
  "message": "Link successfully deleted"
}

Error handling

StatusMeaning
400Validation error — url_id is missing or contains no valid IDs.
401Missing or invalid API token.
404None of the supplied IDs matched a link in the authenticated organization.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
url_id
required

ID of the link to delete, or an array of IDs for bulk deletion. Only links belonging to the authenticated organization are affected.

Example:

501

Response

Link(s) deleted successfully

success
boolean
required
Example:

true

status_code
integer
required
Example:

200

data
object
required
message
string
Example:

"Link successfully deleted"