Skip to content

Save page content

POST
/categories/{category}/pages/{page}/contents/{pageContent}
curl --request POST \
--url https://flow.work.optidata.cloud/api/categories/993/pages/2927/contents/4508 \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "data": "[{\"type\":\"h1\",\"children\":[{\"text\":\"Onboarding checklist\"}]},{\"type\":\"p\",\"children\":[{\"text\":\"Request a laptop and set up your Optiwork account on day one. Read the security handbook and enable two-factor authentication.\"}]}]" }'

Saves a document into a page version. The caller must be able to edit the page.

  • Without draft, the document replaces the content of {pageContent}, which must be a draft — a published version can no longer change (403).
  • With draft: true, a new draft is created from the document, whatever {pageContent} is. Use this to start revising a published page; read the new draft’s id from the response.

The response confirms the save without echoing data.

category
required
integer

Id of the category. Read it from GET /categories.

page
required
integer

Id of a page of that category.

pageContent
required
integer

Id of a version of that page — a page’s page_content_id, or the id returned when saving a new draft.

Media typeapplication/json
object
data
required

The document, as a JSON-encoded array of editor block nodes.

string
draft

true to create a new draft from data instead of updating {pageContent}.

boolean | null
Examples

Save into the current draft

{
"data": "[{\"type\":\"h1\",\"children\":[{\"text\":\"Onboarding checklist\"}]},{\"type\":\"p\",\"children\":[{\"text\":\"Request a laptop and set up your Optiwork account on day one. Read the security handbook and enable two-factor authentication.\"}]}]"
}

The saved version, without its document.

Media typeapplication/json

A page version without its document.

object
id
required
integer
page_id
required
integer
user_id

Id of the user who started this version.

integer
name

Optional label of the version.

string | null
status
required
string
Allowed values: draft published
created_at
string format: date-time
updated_at
string format: date-time
deleted_at
string | null format: date-time
Examples
{
"id": 4508,
"page_id": 2927,
"user_id": 20,
"name": null,
"status": "draft",
"created_at": "2026-10-19T13:50:45.000000Z",
"updated_at": "2026-10-19T13:51:31.000000Z",
"deleted_at": null
}

No authentication key was sent.

Media typeapplication/json

Authentication failures use an error key rather than message.

object
error
required
string
Examples
Examplemissing

No bearer token sent

{
"error": "JWT passport exception: Missing bearer token in request"
}

The caller may not edit the page, or {pageContent} is already published and draft was not set.

Media typeapplication/json
One of:

Generic error envelope used by permission, lookup and framework failures.

object
message
required
string
Examples
{
"message": "This action is unauthorized."
}

No such resource — or it does not belong to the category or page in the path.

Media typeapplication/json

Generic error envelope used by permission, lookup and framework failures.

object
message
required
string
Examples
Examplemissing
{
"message": "No query results for model [App\\Models\\Page] 999999"
}

The authentication key is expired or not recognised. Get a fresh one and retry.

Media typeapplication/json

Authentication failures use an error key rather than message.

object
error
required
string
Examples
Exampleexpired
{
"error": "JWT passport expired: Passport expired"
}

The body failed validation.

Media typeapplication/json
object
message
required

The first validation message.

string
errors
required

Validation messages keyed by field name.

object
key
additional properties
Array<string>
Examples
ExamplemissingData
{
"message": "The data field is required.",
"errors": {
"data": [
"The data field is required."
]
}
}