# Append Or Prepend Content

`POST /pages/{pageId}/content-operations`

Adds markdown at the beginning or end of the current page content. The operation runs against the latest content and returns the new `ETag`. Use `Idempotency-Key` when retrying the same request.
## Authentication

Use one of the following authentication alternatives:

- **API token** (`bearerToken`) : Send a named API token in the Authorization header. Send it in the `Authorization: Bearer <token>` header.
- **Better Auth browser session** (`browserSession`) : Use the Better Auth session cookie from a signed-in browser session. Send it in the `better-auth.session_token` cookie.
## Token permissions

API tokens must include `pages:write`.
## Parameters

- `pageId` (path, required): The UUID of the page.
- `Idempotency-Key` (header, optional): Use the same key to retry the same request. Completed responses are replayed for 24 hours; incomplete reservations expire after 5 minutes.
## Request Body

Required.

### `application/json`

```json
{
  "id": "append-summary",
  "operation": "append",
  "content": "\n\n## Summary\n"
}
```
## Responses

### 200

Content was added and the new ETag is returned.

#### Response headers

- `ETag`: Revision identifier for the returned page content. Type: `string`.

### `application/json`

```json
{
  "id": "string",
  "etag": "string"
}
```

### 403

The API token is missing a required scope: pages:write.


### `application/json`

```json
{
  "error": {
    "code": "string",
    "message": "string"
  }
}
```
