How to Delete Aliased Preview Deployments?


I would like to delete a branch created by dependabot, however the dashboard doesn’t allow me from deleting the preview deployment because it is assigned to an alias.

The deployment isn’t useful anymore, and the branch associated with the deployment is deleted, may I know how can I delete it?



I’m just now facing something similar to this (transitioning to live site instead of Pages). I had to delete the alias from the Custom Domains tab.

@sdayman Thanks for the reply.

The alias for custom domain (production) can be deleted, but I am trying to delete a preview deployment. Pages doesn’t seem to allow me to do this. (The alias is auto generated by Pages with the branch name)


I am facing the same problem here, my github repo was using some not-so-good branch name, and created an auto deployment in Cloudflare Pages, then an alias was created under such <not-so-good>.<page-id> the Pages system is telling can only push new commits to the branch but cannot delete the only deployment under this branch,

Even I have deleted the branch from Github repo, but CF Pages doesn’t synchronize and would show the alias for-ever?

This is insane


I am also facing the same issue and hoping someone can provide a solution.

+1 ditto
API responds with “Cannot delete aliased deployment” for the last deployment of a (now old and deleted from the repo) branch

Thanks for the reports, made an internal ticket for the Pages team to investigate.


@azhao Thanks! Hope this will be fixed soon.

1 Like

What is the status of this investigation? :slight_smile: I’m still experiencing this issue.

Also unable to delete an accidentally created and unneeded preview deploy on account of it being aliased to <spurious-branch>.<myproject>

+1 unable to delete a no longer needed alias preview deployment.

It’s too bad that this continues to go unaddressed, as for me it’s a fatal flaw in an otherwise excellent platform.

If I push a git branch, there will be a preview deployment forever? No thanks.

I was so happy to find Cloudflare Pages, it was fast and easy to get set up… but unfortunately I am going to have to look elsewhere for static web page hosting.

facing the same issue, any solution yet?


Not bring able to delete the last build for an alias / the alias itself isn’t great for a few reasons.
In my case it lead to using old urls not realising they are outdated (e.g. going to when actually it’s Had the old one been cleaned up I would have seen the 404 and checked the URL.

Wow, this is crazy.

My workaround was to delete and recreate the entire project.

After a year, I would like to provide an update on this issue.

TL;DR: This is an expected behaviour.

According to a discussion on the CF Discord Server, Pages prevents us from deleting a preview deployment probably because CF wants to minimise the risk of deleting important deployments, like staging, accidentally. There is a quote from Walshy from CF:

I wasn’t around when it was made but I can only assume it was made so you don’t accidentally delete something like staging
It’s more of a safety thing than anything
People use the aliases a lot so keeping a version of that around and not deletable makes sense

Source: Discord

The original question was raised by elijah: Discord

While I understand this is intended for safety, I still hope Pages will allow us to delete other preview deployments as deleting some of them is not “destructive” at all. I believe Pages could still minimise the risk of developers deleting important deployments accidentally with reconfirmation or allow developers to configure “protected” preview deployments which cannot be deleted easily.

Pages is a great product and it would be even better if this could be addressed.

It is unacceptable that I can delete the entire project but not individual deployments. What if there are really bad things accidentally published on preview? One must also delete production altogether and recreate a new project!?

Delete the bad things from the branch, push to the branch so the bad commit isn’t the most recent deployment. Now you can delete the bad deployment. (Of course, the bad things are still in the repository, but that’s a different issue.)

Unfortunately, I am using Direct Upload without git branches or repo.

We now support this through the force query param!

$ curl "<account-id>/pages/projects/<project-name>/deployments/<deployment-id>" \
  -H 'Authorization: Bearer <api-token>'

  "result": null,
  "success": false,
  "errors": [
      "code": 8000035,
      "message": "Cannot delete aliased deployment without ?force=true"
  "messages": []

$ curl "<account-id>/pages/projects/<project-name>/deployments/<deployment-id>?force=true" \
  -H 'Authorization: Bearer <api-token>'

  "result": null,
  "success": true,
  "errors": [],
  "messages": []

UI coming soon :slight_smile: