Skip to main content

APIs and webhooks

The Castmill server exposes a small set of stable interfaces for integrations. Use them instead of the dashboard's internal endpoints, which follow the dashboard's needs and may change between releases.

InterfaceAddressUse it toAuthentication
Feeds API/api/v1/feedsPush data that widgets show on screensFeed token, or an organization member's or AI agent's token
MCP server/mcpLet AI agents manage content, schedules and devicesAgent secret
Widget webhooks/webhooks/widgets/...Push data to a widget with a push integrationNone
Addon routes/api/addons/<id>/..., /webhooks/addons/<id>/...Endpoints added by addonsDefined by the addon
Health/api/health, /api/versionLoad balancer checks and monitoringNone

All examples use these shell variables:

CASTMILL_URL=https://api.example.com
FEED_ID=... # shown on the feed's page in the dashboard
FEED_TOKEN=... # created on the feed's page, starts with cmfeed_

Feeds API​

A feed holds JSON data that widgets display, for example the latest sales figures, today's menu or the next departures. External systems such as scripts, Make or Zapier write to it; Castmill delivers the changes to every screen that shows the feed.

Send the token in the Authorization header as Bearer <token>:

  • A feed token (cmfeed_...) is created on the feed's page and can read and write only that feed. Prefer it for integrations.
  • The token of an organization member or an AI agent can write to every feed its role allows, and to several feeds in one request.

Endpoints​

Method and pathAction
POST /api/v1/feeds/:id/entriesAdd one entry (a JSON object), or several (a JSON array, or {"entries": [...]}). For list feeds.
PUT /api/v1/feeds/:id/dataReplace the whole document. For document feeds.
DELETE /api/v1/feeds/:id/entries/:entry_idDelete one entry
DELETE /api/v1/feeds/:id/entriesDelete all entries
GET /api/v1/feeds/:idRead the feed's settings and current data
POST /api/v1/feeds/entriesAdd the same entry to several feeds: {"feeds": [...], "entry": {...}}. Member and agent tokens only.

Examples​

Add an entry to a list feed:

curl -X POST "$CASTMILL_URL/api/v1/feeds/$FEED_ID/entries" \
-H "Authorization: Bearer $FEED_TOKEN" \
-H "Content-Type: application/json" \
-d '{"title": "Q3 target reached", "value": 1250000, "external_id": "kpi-q3"}'

Replace a document feed:

curl -X PUT "$CASTMILL_URL/api/v1/feeds/$FEED_ID/data" \
-H "Authorization: Bearer $FEED_TOKEN" \
-H "Content-Type: application/json" \
-d '{"soup": "Tomato and basil", "main": "Mushroom risotto", "price": 12.5}'

Limits​

LimitValue
Entry size64 KB
Document size256 KB
Entries per request100
Requests per token120 per minute
Requests per feed240 per minute

Requests over a rate limit receive HTTP 429. The server logs which credential wrote to which feed, but never the token or the body.

Feeds describes list and document modes, deduplication with external_id and copying media into Castmill.

MCP server​

The Model Context Protocol server lets AI agents work with Castmill with the same permissions as a user. See MCP server.

Widget webhooks​

A widget whose data integration uses push mode receives data at POST /webhooks/widgets/:integration_id/:widget_config_id.

caution

Widget webhooks do not check signatures, so anyone who knows the address can post data to it. Use the Feeds API, which requires a token, for new integrations.

Health and version​

curl "$CASTMILL_URL/api/health"
# {"status":"ok"}

curl "$CASTMILL_URL/api/version"
# {"status":"ok","build":{"castmill_git_sha":"...","built_at":"..."},"versions":{"castmill":"..."}}

Neither endpoint requires authentication or touches the database, which makes /api/health suitable for load balancer probes.

Real-time connections​

Players and the dashboard use Phoenix channels over WebSockets: players connect to /socket and the dashboard to /user_socket. These protocols are internal to Castmill's own clients. To react to changes from another system, use an addon hook instead.