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
| Parameter | Type | Description |
|---|---|---|
site_name | string | The 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_token | string or null | null 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_name | string or null | null on the first call. On the second, the site’s site_name, matched exactly, including case |
The two steps
- 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.
- 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):
| Field | Description |
|---|---|
success | false |
status | confirmation_required |
user_message | What deleting would do, for the person |
site_name, organization | The site and its organization’s slug |
live_url | The address that will stop serving |
connected_domains | Custom domains that will be released |
confirm_token, confirm_token_expires_at | The token for the second call, and when it expires |
refusal_reason | Present when a second call was refused, for example because its token had expired. A new token comes with it |
Deleted:
| Field | Description |
|---|---|
success | true |
site_name, organization | The site and its organization’s slug |
released_domains | Custom domains released |
message | Confirms the files and the record were removed, and names any released domains |
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