Skip to content

REST API

All REST routes register under the namespace cartbay/v1.

POST /wp-json/cartbay/v1/capture

Purpose: create, update, or delete a consented checkout capture.

Permission: public.

Protection: RateLimiter::check('capture') before capture work.

Arguments:

ArgumentTypeNotes
emailstringSanitized and validated email.
consentbooleantrue captures; false withdraws and deletes active capture.
cartobject/arrayRestore-safe client cart fallback.
sourcestringclassic or block.
session_idstringOptional existing CartBay session ID.
GET /wp-json/cartbay/v1/analytics?days=30

Permission: manage_woocommerce.

Allowed days: 7, 30, 90.

Returns analytics generated by AnalyticsService.

These routes are registered by the CartBay Pro add-on, not the free plugin. All require manage_woocommerce.

MethodPathPurpose
POST/wp-json/cartbay/v1/license/activateActivate a WPAnchorBay license key.
GET/wp-json/cartbay/v1/license/statusRead local/current license status.
POST/wp-json/cartbay/v1/license/deactivateRemove/deactivate local license state.

All require manage_woocommerce.

MethodPathPurpose
POST/wp-json/cartbay/v1/test/triggerRequires Test Mode; creates a dummy abandoned session and near-term email job.
POST/wp-json/cartbay/v1/test/emailSends a basic test email or recovery email preview by step.

Restore and unsubscribe are intentionally not REST routes.

Query argHandlerPurpose
?cartbay_restore={token}template_redirectRestore cart and redirect to checkout.
?cartbay_unsubscribe={token}initSuppress email and cancel future work.
  • Public capture protection is rate limiting, nonce origin checks, a server-side cart requirement, and a per-session token — not authentication.
  • Admin routes must use real WordPress capabilities; nonce checks are not authorization.