Storefront API

Used by Tienda's own shop, no stability promise

These endpoints are the ones the public online shop of Tienda calls. They are listed so an integrator knows what exists. Their fields can change between releases, and this page does not describe the answers field by field.

The shop is not named in the path. It is chosen by the host the browser comes from, as described in Shop fronts and domains: send the shop's host in the Origin header or in X-Shop-Host. If no shop claims the host, the answer is 404 with {"error": "Unknown shop"}. Module rules still apply: a shop without the Storefront or Catalog module gets module_disabled.

Public reads need no token. If a staff token is sent, it is read but not required. Texts come in the visitor's language: send Accept-Language.

Public reads

RequestWhat it returns
GET /api/v1/shop_fronts/currentThe shop front: name, ordering switch and closed notice, hours (hours), contact details, social links, languages.
GET /api/v1/shop_fronts/menu?slug=A navigation menu. Without slug, the menu the shop front names (default main-nav). Only visible items.
GET /api/v1/inventory/products, GET /api/v1/inventory/products/:idProducts.
GET /api/v1/inventory/categories, GET /api/v1/inventory/categories/:idCategories.
POST /api/v1/inventory/stock/availabilityWhether products are in stock.
GET /api/v1/searchSearch across the shop.
GET /api/v1/cms/pages, GET /api/v1/cms/pages/:idPages. Ask for one with ?path=/page/about-us.
GET /api/v1/cms/pages/:id/blocksThe blocks of a page.
GET /api/v1/cms/heros, cms/announcements, cms/faq_lists, cms/feature_rowsContent blocks (index and show).
GET /api/v1/cms/product_viewers/:id, .../:id/productsA product list block and its products.
GET /api/v1/pos/delivery_time_slots, GET /api/v1/pos/pickup_time_slotsDelivery and pickup slots (index and show; ?available=true for slots that can be booked).
GET /api/v1/events/events, GET /api/v1/events/events/:id, GET /api/v1/events/event_questionsEvents and the questions on their forms.
GET /api/v1/inventory/subscription_plans, .../:idSubscription plans.
GET /api/v1/events/public_tickets/:guidA ticket by its link (needs the ticket's own identifier).

Public writes the shop uses

RequestWhat it does
POST /api/v1/pos/ordersPlaces an order as a guest or customer. Refused with 422 webshop_closed while the shop is closed to orders. For a web order the answer carries a payment_token.
POST /api/v1/pos/coupons/validateChecks a coupon code. Wrong guesses by a visitor who is not signed in are limited.
POST /api/v1/pos/gift_cards/balanceReads a gift card's balance by code. Limited in the same way.
GET /api/v1/payment_gateway/shop_payments/availableWhich payment gateways the shop offers.
POST /api/v1/payment_gateway/shop_paymentsStarts an online payment for an order, with the payment_token.
GET /api/v1/payment_gateway/shop_payments/:idThe state of a payment. See Payment gateways.
GET/POST /api/v1/payment_gateway/pay_linksPay links for an order.
POST /api/v1/inventory/subscription_plans/:id/signupSigns a customer up for a plan.
POST /api/v1/events/events/:event_id/ticketsReserves or orders tickets.
GET /api/v1/shop/loyalty, POST /api/v1/shop/loyalty/redeemA customer's loyalty balance, and spending points.
GET /api/v1/subscriptions/mine and its actionsA customer's own subscriptions: pause, resume, cancel.

The customer account

A shop customer signs in with an e-mailed code, with no password. The customer token is issued for one shop and means nothing at another shop. A staff token is refused here.

RequestWhat it does
POST /api/v1/storefront/account/session/request_code with {email, locale}Sends a code. The answer is the same for a known and an unknown address.
POST /api/v1/storefront/account/session with {email, code, name?, phone?, locale?}Signs in, and makes the account on first use. Returns a token.
GET, PATCH /api/v1/storefront/accountThe customer's profile.
GET /api/v1/storefront/account/orders, .../orders/:idTheir orders.
GET, POST, PATCH, DELETE /api/v1/storefront/account/addressesTheir addresses.
GET /api/v1/storefront/account/loyaltyTheir loyalty balance.
GET /api/v1/storefront/account/tickets, .../tickets/:guid, POST .../tickets/:guid/cancelTheir event tickets.

The code requests are rate limited: 5 per address and 30 per IP address in ten minutes, and 10 sign-in attempts per address in ten minutes. A limited request answers with a rate limit error.

Send the customer token as Authorization: Bearer <token>. The account data is limited to this shop and to the customer's own e-mail address.

What is not here

Registering as an API client for the shop, webhooks for shop customers, and a stable catalogue API for third parties are not available yet. For reading products from another system use the products feed.