Cannot re-add removed custom domain

After removing a custom domain from a Cloudflare Page, I cannot re-add it because the form states that the domain is “already associated with an existing project”, but I am sure it’s not.

Any tips on fixing this?

Nevermind, managed to removed via API request using this code:

import requests

email="your@email-address"
account_id="youraccount-id"
api_key="your-api-key-which-is-secret"
project_name="name-of-pages-app"
domain_name="nameofdomain.whatever"


url = f"https://api.cloudflare.com/client/v4/accounts/{account_id}/pages/projects/{project_name}/domains/{domain_name}"

headers = {
    "Content-Type": "application/json",
    "X-Auth-Email": email,
    "X-Auth-Key": api_key,
}

response = requests.delete(url, headers=headers)

print(response.json())

if response.status_code == 200:
    print("Domain removed successfully.")
else:
    print("Failed to remove domain.")