# OutlineApi.add()

```ts
add(title: string, pageIndex: number, options?: AddBookmarkOptions): Promise<number[]>
```

Add one bookmark, as the last child of the bookmark at `options.parentPath` (omitted: top level), going to `pageIndex`. Needs the `edit-pages` feature.

- Kind: method
- Since: 1.0.0

| Parameter | Type | Description |
| --- | --- | --- |
| `title` | `string` | The bookmark's title. |
| `pageIndex` | `number` | The zero-based page it goes to. |
| `options?` | `AddBookmarkOptions` | `parentPath` (a path into `get()`'s tree; omitted, top level) and `invalidateSignatures`. |

Returns `Promise<number[]>`: The new bookmark's path, for `delete()` / `setTitle()`.

Throws:

- `INVALID_ARGUMENT` — a page index out of range, or a `parentPath` that names no bookmark.
- `FEATURE_NOT_LICENSED` — the license lacks `edit-pages`.
- `PAGE_ERROR` — the change could not be written.
- `DOCUMENT_CLOSED` — the document has been closed.
- `INVALID_STATE` — a certified document, unless `options.invalidateSignatures` (no certification level allows bookmark changes); or a progressive document still downloading.

```ts
const path = await doc.outline.add('Appendix', doc.pageCount - 1);
await doc.outline.add('Tables', doc.pageCount - 1, { parentPath: path });
```

Part of [OutlineApi](https://kernstra.com/docs/web-sdk/api/doc-outline) in the Kernstra Web SDK 1.0.0 API reference.

Web page: https://kernstra.com/docs/web-sdk/api/doc-outline/add
