Skill: Delete Site

Permanently delete one of your organization's sites, its files and its custom domains, in two steps. The first call only previews what would go and returns a confirmation token.

Delete Site permanently deletes a site your organization owns: every version of its files, its record, and its custom domains. It comes with the Web Builder, so anyone who can use the Web Builder can ask it to delete a site. Deleting from the site’s page in Sites is limited to owners and admins.

It always takes two calls. The first deletes nothing; it says what would be deleted and returns a token. Only a second call with that token and the site’s exact name deletes the site.

Parameters

ParameterTypeDescription
site_namestringThe site to delete. It is lowercased and every character outside a-z, 0-9 and - becomes - before the lookup, as Create Site slugs it
confirm_tokenstring or nullnull on the first call. On the second, exactly the token the first call returned. Anything else is treated as a new first call
confirm_site_namestring or nullnull on the first call. On the second, the site’s site_name, matched exactly, including case

The two steps

  1. Preview. The skill returns what deleting would do and a token valid for 10 minutes. The Web Builder shows you the message, for example: “Deleting “spring-offer” will take down the public site at … Reply yes to delete it permanently.” Its turn ends there, so it can’t confirm on your behalf in the same reply.
  2. Delete. After you reply yes, the Web Builder calls again with the token and the exact name. Custom domains are released first, then the files, then the site record.

If a delete stops partway, calling again with the same token, while it is still valid, finishes it.

Responses

Preview (nothing deleted):

FieldDescription
successfalse
statusconfirmation_required
user_messageWhat deleting would do, for the person
site_name, organizationThe site and its organization’s slug
live_urlThe address that will stop serving
connected_domainsCustom domains that will be released
confirm_token, confirm_token_expires_atThe token for the second call, and when it expires
refusal_reasonPresent when a second call was refused, for example because its token had expired. A new token comes with it

Deleted:

FieldDescription
successtrue
site_name, organizationThe site and its organization’s slug
released_domainsCustom domains released
messageConfirms the files and the record were removed, and names any released domains
Caution

A deleted site can’t be restored. To take a site down and keep it, unpublish or archive it on its page in Horizon instead.


Related skills: List Sites | Create Site