> ## Documentation Index
> Fetch the complete documentation index at: https://docs.supernote.com/llms.txt
> Use this file to discover all available pages before exploring further.

# deletePageElements

> Delete elements from the specified page in the current file.

```ts wrap theme={null}
static deletePageElements(
  numsInPage: number[],
  page: number,
  layer?: number | null
): Promise<APIResponse<boolean>>;
```

<Note>
  `layer` follows the same rule as other page element operation APIs: for note files (`.note`), omitting it uses the current layer; for recognized notes and document files, the parameter is ignored whether you pass it or not because they have only one layer.
</Note>

**Parameters**

| Parameter    | Type             | Description                                                                                                                                                                                                                                                                                                                                                                                            |
| ------------ | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `numsInPage` | `number[]`       | In-page element indices to delete, starting from `1`                                                                                                                                                                                                                                                                                                                                                   |
| `page`       | `number`         | Page index, starting from `0`                                                                                                                                                                                                                                                                                                                                                                          |
| `layer`      | `number \| null` | Optional layer parameter. For note files (`.note`), when omitted, the current layer is used. For recognized notes, the parameter is ignored whether you pass it or not because recognized notes have only one layer. For document files (`.pdf`, `.epub`, etc.), the parameter is ignored whether you pass it or not because document files have only one layer. When provided, valid values are `0-3` |

**Returns**

* [`APIResponse<boolean>`](/en/api-reference/supernote-plugin/types/api-response): `result === true` indicates the deletion succeeded

**Throws**

* Throws a parameter validation error when `numsInPage` is not a valid integer array
* Throws a parameter validation error when `page` is not an integer greater than or equal to `0`
* Throws a parameter validation error when `layer` is provided but is not an integer in the range `0-3`

## Example

```ts wrap theme={null}
import { PluginCommAPI } from 'sn-plugin-lib';

/**
 * Example: delete elements from a specified page in the current file.
 */
export async function exampleDeletePageElements() {
  const numsInPage = [1, 2];
  const page = 0;
  const layer = 0;
  const res = await PluginCommAPI.deletePageElements(numsInPage, page, layer);
  if (!res.success) {
    console.log('deletePageElements failed', res.error);
    throw new Error(res.error?.message ?? 'deletePageElements call failed');
  }
  console.log('deletePageElements result', res.result);
  return res.result;
}
```
