Apply Exact Content Edits
POST
/pages/{pageId}/edits
const url = 'https://markdawn.space/api/v1/pages/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/edits';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"edits":[{"id":"rename-heading","oldText":"# Draft","newText":"# Notes"}]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://markdawn.space/api/v1/pages/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/edits \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "edits": [ { "id": "rename-heading", "oldText": "# Draft", "newText": "# Notes" } ] }'Replaces one or more exact passages without replacing the full page. Each old passage must occur exactly once, and missing or overlapping matches are rejected. Use Idempotency-Key when retrying the same request.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”pageId
required
string format: uuid
The UUID of the page.
Header Parameters
Section titled “Header Parameters”Idempotency-Key
string
Use the same key to retry the same request. Completed responses are replayed for 24 hours; incomplete reservations expire after 5 minutes.
Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
edits
required
Array<object>
object
id
required
string
oldText
required
string
newText
required
string
Example
{ "edits": [ { "id": "rename-heading", "oldText": "# Draft", "newText": "# Notes" } ]}Responses
Section titled “Responses”One result for each requested edit and the new ETag.
Media typeapplication/json
Headers
Section titled “Headers”ETag
string
Revision identifier for the returned page content.
The API token is missing a required scope: pages:write.
Media typeapplication/json
Structured error returned when the request cannot be completed.
object
error
required
Error details for programmatic handling.
object
code
required
Stable error code.
string
message
required
Human-readable explanation.
string
Examplegenerated
{ "error": { "code": "example", "message": "example" }}