# Replace Page Content

`PUT /pages/{pageId}/content`

Replaces the complete markdown representation only when `If-Match` matches the current `ETag`. Read the page first, then reconcile and retry after a revision conflict.
## 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.
- `If-Match` (header, required): ETag returned when the current page content was read.
## Request Body

Required.

### `text/markdown`

```text
"string"
```
## Responses

### 204

Page content replaced. The new ETag is returned in the response headers.

#### Response headers

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

### 403

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


### `application/json`

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

### 409

If-Match did not match the current page revision.


### 428

The If-Match header is required.
