Skip to main content

REST: WordPress Push-Content (/api/wordpress/push-content)

This page describes the incoming REST endpoint of the cockpitOS Dashboard, through which a registered WordPress website (e.g., with the cockpitOS plugin) can send shops, events, news, offers, services, and static pages to the central database.

Implementation in the Monorepo: apps/dashboard/src/app/api/wordpress/push-content/route.ts

Note on Base URL

Replace {DASHBOARD_ORIGIN} with the public URL of your dashboard instance (e.g., https://dashboard.example.com). Locally often http://localhost:3000.

Overview

AspectDetails
MethodPOST
Path/api/wordpress/push-content
AuthenticationHTTP Header Authorization: Bearer <apiKey>
API KeyThe website API key of the WordPress instance, as stored in cockpitOS under WordPress management (WordPressWebsite.apiKey in the database)
Content-Typeapplication/json
CORSAccess-Control-Allow-Origin: * (Preflight OPTIONS is supported)

Without a valid key, the API responds with 401; if no matching website entry exists, with 404.

Request Body

The body is a JSON object. All top-level fields are optional. You can send any combination (only news, only shops, etc.).

{
"shops": [],
"events": [],
"news": [],
"offers": [],
"services": [],
"pages": []
}

shops (Array)

For each entry, the following fields are evaluated (additional keys are ignored):

FieldTypeDescription
idstring (optional)If set and present in the same centerUpdate, otherwise Create
namestringRequired (empty → entry is skipped)
categorystringDefault: "Other"
description, floor, location, logo, phone, email, website, openingHoursstring or nullOptional
statusstringDefault: "Active"
shopChainId / chainIdstring (UUID, optional)Links the shop with an existing Shop Chain (ShopChain). Invalid/missing UUID → error entry in data.errors, shop is not saved.
chainName, shopChainName, brandName, kette, marke, …string (optional)AI/editor-friendly aliases: chain is searched by name (case insensitive); if missing, it is created (only additive data, category from shop or chainCategory / chainCategoryId).
chainCategory, kettenKategoriestring (optional)Only for newly created chain: category name (matched against cockpit categories).
chainCategoryId, kettenKategorieIdstring (UUID, optional)Only for new chain: direct Category UUID.
clearShopChain, unlinkFromChain, standaloneShop, einzelshopboolean (optional)true → remove link to the chain (Standalone Shop).
modus / shopTypstring (optional)Values like single, standalone, without chain → like above disconnect.
agencyosId, externalId, clientReferencestring (optional)Stored in shop metadata under agencyosPushId; same value in the same center → Update instead of duplicate (sensible for AgencyOS; WordPress usually ignores).

The same Shop Push Logic is also used for AgencyOS Content Push.

events (Array)

FieldTypeDescription
idstring (optional)Update if ID exists in center
titlestringRequired
startDate, endDatestring (ISO) / dateOptional; Default: startDate = now, endDate = one hour later
description, location, imagestring or nullOptional
statusstringDefault: "Active"

Internally, source is set to wordpress.

news (Array)

FieldTypeDescription
idstring (optional)Update if ID exists in center
titlestringRequired
excerpt, summary, content, author, category, imagestring or nullOptional
publishDatestring (ISO) / dateOptional; Default: current date
statusstringDefault: "Published"

Internally, source is set to wordpress.

offers (Array)

FieldTypeDescription
idstring (optional)Update if ID exists in center
titlestringRequired
startDate, endDatestring (ISO) / dateOptional; Default: endDate = 7 days after startDate
description, discount, imagestring or nullOptional
statusstringDefault: "Active"

Internally, source is set to wordpress.

services (Array)

FieldTypeDescription
idstring (optional)Update if ID exists in center
namestringRequired
category, description, floor, location, phone, email, website, openingHoursstring or nullOptional
statusstringDefault: "Active"

pages (Array)

Static WordPress pages (e.g., directions, house rules) for context (e.g., chatbot). They are not mirrored as normal CMS page entities like in the website tab, but stored in WordPressWebsite.staticPages.

FieldTypeDescription
slugstring
titlestring
contentstringWill be truncated to 10,000 characters

Additional Logic: If a page titled "Opening Hours" is included (recognized by title/slug), and the field openingHours is still empty in the center, a truncated text (HTML tags removed, max. 500 characters) will be adopted into the center.

Response

Success (HTTP 200)

{
"success": true,
"data": {
"summary": {
"shops": 0,
"events": 0,
"news": 0,
"offers": 0,
"services": 0
},
"errors": ["optional: error messages per record"]
},
"message": "Push-Content processed"
}

errors is omitted if no individual errors occurred. In case of partial failure, individual records may fail while others are still processed.

The associated WordPress website receives an updated lastSync; in case of errors, lastError (truncated) can be set.

Errors

HTTPMeaning
401No Authorization: Bearer header
404No WordPressWebsite with this API key
400Invalid JSON
500Unexpected server error

Example: curl

curl -sS -X POST "${DASHBOARD_ORIGIN}/api/wordpress/push-content" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_WORDPRESS_WEBSITE_API_KEY" \
-d '{
"news": [
{
"title": "Sample News",
"excerpt": "Short text",
"content": "<p>HTML content</p>",
"status": "Published"
}
]
}'
  • Register / link website: POST /api/wordpress/websites (Dashboard session or API key matching in header with body – see apps/dashboard/src/app/api/wordpress/websites/route.ts).
  • Embedding configuration (public with website key): GET /api/wordpress/embed-config – see comment in apps/dashboard/src/app/api/wordpress/embed-config/route.ts.
  • Outgoing notifications to external systems (not for writing to cockpit): Webhooks – see Integration & Webhooks.

Further API Documentation

A complete OpenAPI reference of all dashboard endpoints is still in planning; this endpoint is currently the centrally documented interface for content from WordPress to Cockpit.

Nutzungsstatistik: Seitenaufrufe werden anonymisiert erfasst. Im Umami-Dashboard nach diesem Pfad filtern: /en/developer-guide/api-wordpress-push-content