Skip to main content

Notices REST API

Endpoints for reading and dismissing admin notices. Notices are surfaced in the Benecaster notification center — the bell icon in the Benecaster top bar. Both endpoints require manage_options and a valid X-WP-Nonce header.


GET /benecaster/v1/notices

Returns all active notices for the current site.

Auth: manage_options + X-WP-Nonce

Response:

{
  "items": [
    {
      "id": 5,
      "notice_id": "v1.4.2-security",
      "source": "remote",
      "type": "error",
      "scope": "global",
      "message": "Version 1.4.2 fixes a critical vulnerability. Update now.",
      "action_url": "https://benecaster.com/changelog/1.4.2",
      "action_label": "View changelog",
      "dismissible": false,
      "created_at": "2026-05-17T08:00:00"
    }
  ],
  "unread_count": 3
}

Notice object fields:

Field Type Description
id int Database row ID — use this in POST /notices/{id}/dismiss
notice_id string Stable semantic identifier for this notice type; used for deduplication
source string remote (pushed from benecaster.com), local (generated by the plugin)
type string Severity: critical, warning, info, tip, or marketing
scope string global (all Benecaster screens) or a specific page slug
message string HTML-safe notice body
action_url string|null URL for the action button; null when no action
action_label string|null Button label text; null when no action
dismissible bool false for Critical notices — cannot be dismissed until the underlying condition resolves
created_at string ISO 8601 datetime

Notice severity:

Type Behavior
critical Persistent banner across all Benecaster admin screens; dismissible: false
warning Bell icon (orange); dismissible
info Bell icon; dismissible
tip Bell icon; dismissible
marketing Bell icon; dismissible

POST /benecaster/v1/notices/{id}/dismiss

Dismisses a dismissible notice. The {id} is the numeric database row ID from the items array in GET /notices.

Auth: manage_options + X-WP-Nonce

Response:

{
  "dismissed": true
}

Errors:

Code HTTP Condition
rest_not_found 404 Notice ID does not exist
rest_forbidden 403 Notice has dismissible: false — Critical notices cannot be dismissed via API

Attempting to dismiss a critical notice returns 403. Critical notices clear automatically when the underlying condition resolves (for example, a grace period notice clears when the license is renewed).

See Also