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

# getTitles

> 获取笔记文件的标题数据。

<Note>
  只有笔记文件才有标题数据，文档文件没有标题数据。
</Note>

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

**参数**

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

**返回**

* [`APIResponse<Title[]>`](/zh/api-reference/supernote-plugin/types/api-response)：
  `result` 为标题数据数组（类型见 [Title](/zh/api-reference/supernote-plugin/types/title)）

## 示例

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

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