
# Delete a section

Delete a section, its metadata, and every page in it. Pages in its sub-sections are deleted too. To keep a page, move it to another section first.

```sh
DELETE https://sitepaste.com/api/v1/public/sites/{siteId}/sections/{sectionPath}
```

Requires the `content` scope.

The path names the section exactly as [the PATCH](/api/sections/patch-sections-contenttype#addressing-a-section) does: the content type, then the section under it, nesting one level for `docs` and `blog` and two for `standalone`. A group root such as `/sections/docs` cannot be deleted and answers 405. GET and PATCH still accept it.

Clearing a section's title and description with [PATCH](/api/sections/patch-sections-contenttype) leaves its pages in place, and a nav group keeps its position. This route is the one that removes the section and its pages.

## Usage

```bash
curl -X DELETE "https://sitepaste.com/api/v1/public/sites/default/sections/standalone/api" \
  -H "Authorization: Bearer $TOKEN"
```

## Authorizations

| Header | Type | Required | Description |
|--------|------|----------|-------------|
| Authorization | string | Yes | Bearer token (`Authorization: Bearer sp_...`). Created in the dashboard under Account > Tokens. See [authentication](/api/authentication). |

## Response

204 No Content. The section is gone, along with any sub-sections under it and every page filed in either. A failed request deletes nothing.

Deleting `api` deletes `api/builds` and its pages too. A section whose name only starts the same way, such as `api-v2`, is a different section and keeps its pages.

To see how many pages a delete will take, read the section first. Its `pageCount` counts the pages filed directly in it, and each sub-section reports its own.

## Errors

| Code | Meaning |
|------|---------|
| 400 | The path names no section: an unknown content type, or a depth a section cannot have |
| 404 | The site has no such section |
| 405 | The path is a `docs` or `blog` group root, which cannot be deleted. `Allow` lists the methods it does take |