Skip to content

Developer Docs

REST API Reference

Smart Add-Ons REST API — 28+ endpoints under the saue/v1 namespace for addon groups, price preview, events, A/B tests, and licensing.

Base URL & namespace

Base URL: https://your-store.com/wp-json/saue/v1
Namespace: saue/v1

Authentication

Endpoints are split into two access levels:

  • Public — accessible without authentication. Used by the storefront (price preview, event tracking, addon group retrieval, cart validation).
  • manage_woocommerce — requires a WordPress user with the manage_woocommerce capability. Send credentials via WordPress REST API authentication (cookie nonce or Application Password).
  • Token — file upload endpoints accept a short-lived upload token generated server-side for the active session.

Example using Application Password:

curl -u "admin:xxxx xxxx xxxx xxxx xxxx xxxx" 
  https://your-store.com/wp-json/saue/v1/addons

Addon Group endpoints

EndpointMethodAuthDescription
/addonsGETmanage_woocommerceList all addon groups with pagination
/addonsPOSTmanage_woocommerceCreate a new addon group
/addons/{id}GETmanage_woocommerceGet a single addon group by ID
/addons/{id}PUTmanage_woocommerceUpdate an existing addon group
/addons/{id}DELETEmanage_woocommerceDelete an addon group (permanent)
/addons/{id}/duplicatePOSTmanage_woocommerceCreate an exact copy of the group
/addons/{id}/exportGETmanage_woocommerceExport group as a JSON file download
/addons/importPOSTmanage_woocommerceImport a group from JSON (multipart)

Storefront endpoints (public)

EndpointMethodAuthDescription
/addons/product/{product_id}GETPublicGet all resolved addon groups for a product ID
/price-previewPOSTPublicCalculate total price for a set of field selections
/validate-addonsPOSTPublicValidate field selections before add-to-cart (required fields, rules)
/analytics/eventsPOSTPublicRecord a storefront event (view, interaction, conversion)

File upload endpoints

EndpointMethodAuthDescription
/uploadPOSTToken (session)Upload a file for a file upload field. Returns a file reference ID.
/orders/{order_id}/items/{item_id}/uploads/{field_id}/downloadGETmanage_woocommerceAdmin download for an uploaded file attached to an order item

A/B Test endpoints

EndpointMethodAuthDescription
/ab-testsGETmanage_woocommerceList all A/B tests
/ab-testsPOSTmanage_woocommerceCreate a new A/B test
/ab-tests/{id}GETmanage_woocommerceGet results and status for a single test
/ab-tests/{id}PUTmanage_woocommerceUpdate a test (pause, change split)
/ab-tests/{id}/declare-winnerPOSTmanage_woocommerceEnd the test and apply the winning variant

AI suggestions endpoint

EndpointMethodAuthDescription
/ai/suggestPOSTmanage_woocommerceGet AI-generated upsell suggestions for a product. Requires Pro plan and backend OpenAI key.

License endpoints

EndpointMethodAuthDescription
/license/statusGETmanage_woocommerceGet current license status (plan, expiry, features)
/license/activatePOSTmanage_woocommerceActivate a license key on this site
/license/deactivatePOSTmanage_woocommerceDeactivate the current license (frees an activation slot)

Example: Price preview

POST /wp-json/saue/v1/price-preview
Content-Type: application/json

{
  "product_id": 123,
  "quantity": 2,
  "selections": [
    { "field_id": 10, "value": "yes" },
    { "field_id": 11, "value": "Happy Birthday!" }
  ]
}

Response:

{
  "base_price": "49.99",
  "addons_total": "6.00",
  "total": "55.99",
  "breakdown": [
    { "field_id": 10, "label": "Add gift wrapping", "price": "3.00" },
    { "field_id": 11, "label": "Gift message", "price": "0.00" }
  ]
}

Example: Get addon groups for a product

GET /wp-json/saue/v1/addons/product/123

Returns the resolved and ordered list of addon groups assigned to product 123, including all field definitions, options, pricing rules, and conditional logic.