> ## 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.

# getKeyWords

> 获取笔记/文档文件的关键字。

```ts wrap theme={null}
static getKeyWords(notePath: string, pageList: number[]): Promise<APIResponse<KeyWord[]>>;
```

**参数**

| 参数         | 类型         | 说明           |
| ---------- | ---------- | ------------ |
| `notePath` | `string`   | 笔记/文档文件路径    |
| `pageList` | `number[]` | 页码列表（从 0 开始） |

**返回**

* [`APIResponse<KeyWord[]>`](/zh/api-reference/supernote-plugin/types/api-response)：
  `result` 为关键字数组（类型见 [KeyWord](/zh/api-reference/supernote-plugin/types/key-word)）。

## 示例

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

/**
 * 获取关键字列表的示例。
 */
export async function exampleGetKeyWords() {
  const notePath = '/storage/emulated/0/Note/demo.note';
  const res = await PluginFileAPI.getKeyWords(notePath, [1]);
  if (!res.success) {
    throw new Error(res.error?.message ?? 'getKeyWords 调用失败');
  }
  return res.result;
}
```
