The Ajax API provides lightweight REST endpoints for building VersaCommerce themes.
Use cases
Typical uses of the Ajax API:
- Add products to the cart and update the cart counter.
- Show related product recommendations.
- Suggest products and collections while visitors type into a search field.
See the Ajax API reference for all available endpoints.
Making requests to the API
The Ajax API accepts two kinds of HTTP requests:
GETrequests to read the cart and some product dataPOSTrequests to change the cart of the current session
For example, to get the current cart contents, send a client-side request to the shop's /cart.js endpoint.
Requirements and limitations
- The API is unauthenticated. No access tokens or API keys are needed.
- There are no fixed rate limits. Requests are still subject to the platform's general abuse protection.
- All responses return JSON.
- The Ajax API cannot read customer or order data and cannot change shop data. For broader access, use the Admin API.