Front API
The Front API is the API of the people who use the marketplace. It acts on behalf of one signed-in member with their own email and password, so it is safe to call from code your users run: a mobile app, a single-page app, or the JavaScript of your theme.
https://<primary address>/front_api/v1Typical integrations
Section titled “Typical integrations”- Mobile apps for customers or vendors. See Build a mobile app.
- Headless storefronts with your own front end. See Build a headless storefront.
- Interactive theme features: a wishlist button, a vendor favourites page, a quantity badge on the cart icon, written in your theme’s JavaScript. See Use vendors as wishlist items.
Authentication
Section titled “Authentication”The member logs in with POST /auth/login and receives a token valid for one year, sent as
Authorization: Bearer <token>. Inside a theme on the marketplace’s domain, the storefront
session works as well. Visitors who are not signed in can use a few endpoints: sign-up,
password reset, categories, public vendor profiles, reviews and the guest cart. Details in
Authentication.
Cross-origin requests are allowed from any origin, so a front end on another domain can call the API directly with a Bearer token.
Resources
Section titled “Resources”| Resource | Endpoints | Who |
|---|---|---|
| Session | POST /auth/login · GET /auth/me · DELETE /auth/logout |
Member |
| Account | POST /account/create · PATCH /account/update · POST /account/forgot-password · POST /account/reset-password · POST /account/change-password · POST /account/email-exist |
Visitor or member |
| Checkout addresses | GET and POST /account/checkout-addresses · GET, PUT and DELETE /account/checkout-addresses/{id} |
Member |
| Categories | GET /categories · GET /categories/{category_id} |
Anyone |
| Cart | POST /carts · GET /carts/{url_key} · POST /carts/{url_key} (add an item) · PUT and DELETE /carts/{url_key}/order_items/{order_item_id} · GET /carts/{url_key}/listings/{listing_id}/quantity |
Visitor or member |
| Cart delivery | GET /carts/{url_key}/orders/{order_id}/available-shipping-methods · PATCH /carts/{url_key}/orders/{order_id}/shipping-method · PUT /carts/{url_key}/checkout-addresses/{checkout_address_id} |
Visitor or member; the address step needs a member |
| Orders | GET /orders · GET /orders/{id} · messages, attachments and invoice number of an order |
Member, as customer or vendor of the order |
| Wishlist | GET /wishlists · POST /wishlists · GET /wishlists/{item_id}/check · DELETE /wishlists/{item_id} |
Member |
| Vendor’s own listings | GET /listings · GET /listings/{id} · POST /listings/add · PATCH /listings/{id}/edit · attachments and related listings |
Member who is a vendor |
| Listing attributes | GET /listings/attributes |
Anyone |
| Public profiles | GET /directories/{user_id} · GET /reviews/user/{user_id} |
Anyone |
See the Front API reference for request and response fields.
How the cart works
Section titled “How the cart works”POST /front_api/v1/cartswith an empty body creates a cart and returns itsurl_key. Keep it: every cart call is addressed by it.POST /front_api/v1/carts/{url_key}withlisting_idandquantity, plus optionalvariants,options,addonsandproperties, adds a listing.- The cart holds one order per vendor.
GET /front_api/v1/carts/{url_key}returns the cart with its orders, so you can choose a shipping method per order. - When a guest who owns a cart signs in, the cart is attached to their account on the next cart call.
A cart created by a guest can be read and changed by anyone who knows its url_key, until a
member owns it. Treat the url_key as a secret of the visitor’s session.
Things to know
Section titled “Things to know”- Responses are not uniform. Endpoints return
{"success": …},{"status": …}or{"code": …, "status": …}bodies depending on their family, and a few errors come back as HTML pages. See Errors. - Sign-up needs a group.
POST /account/createrequiresemail,passwordand thegroup_idthe member joins. Add?no-confirmation-emailto the URL to skip the welcome or confirmation email. - Logging out does not revoke the token. Delete it from the device.
- Payment is not part of the Front API. A cart is paid on the marketplace’s checkout pages, or with your own payment provider followed by an Admin API call from your server. See Record orders paid outside Kreezalid.