WooCommerce plugin docs / REST API

REST API

Namespace: aiwsa/v1 (filter aiwsa_rest_namespace) Base: /wp-json/aiwsa/v1/

Shopper routes require the nonce from GET /config (and conversation ownership where noted). Analytics routes require an administrator permission callback.

Do not send API keys to these endpoints.


Shopper / widget

MethodRoutePurpose
GET/configBootstrap: nonce, flags, appearance, fallbacks, quick actions. No nonce required (by design). Uncacheable.
POST/conversationsStart chat. Body channel: widget, block, shortcode, product (default widget). block is a channel label only.
GET/conversations/{uuid}Read conversation if owned
DELETE/conversations/{uuid}Erase if owned
POST/conversations/{uuid}/messagesOne turn. message and/or action_id (Quick Action)
POST/confirmRedeem or cancel staged intent. Body: intent_uuid, uuid, optional cancel
GET/cartSession cart + URLs
POST/cart/addStage add (confirmation broker). product_id, optional variation, qty, conversation uuid
POST/cart/updateQuantity. cart_item_key, quantity
POST/cart/removeRemove line. cart_item_key
GET/products/refreshLive price/stock for card IDs (ids)
GET/products/{id}/variationsPurchasable variations
GET/products/compareCompare catalog products
GET/recommendationscontext=product or context=cart
POST/stock-alertsproduct_id, email

Admin

MethodRoutePurpose
GET/analyticsDashboard JSON for managers
GET/analytics/orders/{order_id}Attribution row (no customer email/payment in UI)

Errors

Unexpected throwables become JSON errors (not a white screen). Rate-limit responses include headers from Rate_Limiter. Trace IDs join logs and the response.


Example: config

GET /wp-json/aiwsa/v1/config

Use nonce (and X-WP-Nonce) on subsequent calls. features.ai is true when a provider is configured. transport may be sse even though the bundled widget uses POST.


PHP extensibility (high level)

Stable integration points are hooks (hooks.md) and aiwsa_register_tools / aiwsa_register_providers. Prefer those over instantiating internal classes.

Useful types (may evolve): Settings, Tool_Result, Search_Criteria, Conversation. Treat anything under includes/ without a hook as internal.