openapi: 3.1.0 info: # Do not change the title, if the title changes, the import paths will be broken title: Api version: 0.1.0 description: API specification servers: - url: /api description: Base API path tags: - name: health description: Health operations - name: catalog description: Catalog read operations (categories, occasions, products) - name: cart description: Persisted cart operations (owner-scoped) - name: wishlist description: Persisted wishlist operations (owner-scoped) - name: checkout description: Checkout quote (server-side totals preview, owner-scoped) - name: orders description: Order operations (create from cart, list/get own orders) - name: payments description: Payment proof upload (Yape/Plin constancia, owner-scoped) - name: guest description: >- Checkout without an account. A guest order is reached with the access token returned when it is placed (and emailed to the customer), sent in the X-Order-Token header. - name: admin description: Backoffice operations (employee/admin only) - name: config description: Public store config (delivery fee, Yape, pickup points, banners) - name: auth description: Authenticated caller identity - name: legal description: Libro de Reclamaciones and consent ledger (Peruvian consumer + data-protection law) - name: seo description: Crawler-facing documents served by the API because they need catalogue data paths: /healthz: get: operationId: healthCheck tags: [health] summary: Liveness probe description: > Answers "is this process alive". Deliberately checks nothing else: a load balancer polls it constantly, and a liveness probe that depends on the database restarts every healthy instance during a database blip. Use /readyz to know whether the API can serve traffic. responses: "200": description: The process is running content: application/json: schema: $ref: "#/components/schemas/HealthStatus" /readyz: get: operationId: readinessCheck tags: [health] summary: Readiness probe description: > Answers "can this instance serve requests". Checks its dependencies (today: the database) and returns 503 when one of them is unreachable, so an uptime monitor pointed here reports the outage instead of a cheerful 200. Point external monitoring at this endpoint, not at /healthz. responses: "200": description: Ready to serve content: application/json: schema: $ref: "#/components/schemas/ReadinessStatus" "503": description: A dependency is unavailable content: application/json: schema: $ref: "#/components/schemas/ReadinessStatus" /sitemap.xml: get: operationId: getSitemap tags: [seo] summary: XML sitemap of the public storefront description: > The sitemap lives here, and not in the storefront build, because it has to list every active product with its last-modified date — data only the database has. Generating it at build time would tie the frontend build to a database and, worse, freeze the list at the moment of the last deploy, so a product published on Tuesday would stay invisible until the next release. Serve it to crawlers at the storefront origin (`/sitemap.xml`) by rewriting that path to this endpoint at the edge; the URL a crawler is told about, in robots.txt, is the storefront one. Returns 503 when PUBLIC_SITE_URL is not configured: the document is made of absolute URLs, and emitting it against a guessed origin would submit the wrong addresses to a search engine. responses: "200": description: Sitemap document content: application/xml: schema: type: string "503": description: No public site URL is configured for this deployment content: application/json: schema: $ref: "#/components/schemas/Error" /me: get: operationId: getMe tags: [auth] summary: Get the authenticated caller's profile (id, email, role) responses: "200": description: Caller profile content: application/json: schema: $ref: "#/components/schemas/Me" "401": description: Unauthenticated content: application/json: schema: $ref: "#/components/schemas/Error" patch: operationId: updateMe tags: [auth] summary: Update the authenticated caller's profile (name, phone, shipping address) requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/UpdateMeInput" responses: "200": description: Updated profile content: application/json: schema: $ref: "#/components/schemas/Me" "401": description: Unauthenticated content: application/json: schema: $ref: "#/components/schemas/Error" /me/guest-orders/claim: post: operationId: claimGuestOrders tags: [auth] summary: >- Move guest orders into the caller's account. Each order is identified by its id plus the access token issued when it was placed (the one in the confirmation email link). Holding the token is the proof of ownership; the caller's email plays no part. requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/GuestOrderClaimRequest" responses: "200": description: >- How many orders were moved. Pairs that do not match, or orders that already belong to an account, are skipped without saying which: an error per pair would let a caller probe which order ids exist. content: application/json: schema: $ref: "#/components/schemas/GuestOrderClaim" "400": description: Invalid body content: application/json: schema: $ref: "#/components/schemas/Error" "401": description: Unauthenticated content: application/json: schema: $ref: "#/components/schemas/Error" /categories: get: operationId: listCategories tags: [catalog] summary: List categories (by default only those with at least one active product) parameters: - name: includeEmpty in: query required: false description: When true, include categories without active products (admin views) schema: type: boolean default: false - name: includeInactive in: query required: false description: When true, include inactive categories (admin views) schema: type: boolean default: false responses: "200": description: Categories content: application/json: schema: type: array items: $ref: "#/components/schemas/Category" /occasions: get: operationId: listOccasions tags: [catalog] summary: List occasions (active only by default) parameters: - name: includeInactive in: query required: false description: When true, include inactive occasions (admin views) schema: type: boolean default: false responses: "200": description: Occasions content: application/json: schema: type: array items: $ref: "#/components/schemas/Occasion" /products: get: operationId: listProducts tags: [catalog] summary: List active products (paginated) parameters: - name: page in: query required: false schema: type: integer minimum: 1 default: 1 - name: limit in: query required: false schema: type: integer minimum: 1 maximum: 100 default: 20 - name: category in: query required: false description: Filter by category slug schema: type: string - name: occasion in: query required: false description: Filter by occasion slug schema: type: string - name: featured in: query required: false schema: type: boolean - name: q in: query required: false description: Case-insensitive name search schema: type: string responses: "200": description: Paginated products content: application/json: schema: $ref: "#/components/schemas/ProductList" /products/{slug}: get: operationId: getProduct tags: [catalog] summary: Get one active product by slug parameters: - name: slug in: path required: true schema: type: string responses: "200": description: Product content: application/json: schema: $ref: "#/components/schemas/Product" "404": description: Not found content: application/json: schema: $ref: "#/components/schemas/Error" /cart: get: operationId: getCart tags: [cart] summary: Get the authenticated user's cart responses: "200": description: Cart content: application/json: schema: $ref: "#/components/schemas/Cart" "401": description: Unauthenticated content: application/json: schema: $ref: "#/components/schemas/Error" /cart/items: post: operationId: addCartItem tags: [cart] summary: Add a variant to the cart (increments if already present) requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CartItemInput" responses: "200": description: Updated cart content: application/json: schema: $ref: "#/components/schemas/Cart" "404": description: Variant not found content: application/json: schema: $ref: "#/components/schemas/Error" "409": description: Out of stock content: application/json: schema: $ref: "#/components/schemas/Error" /cart/items/{variantId}: patch: operationId: updateCartItem tags: [cart] summary: Set the absolute quantity of a cart line parameters: - name: variantId in: path required: true schema: type: string format: uuid requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CartQuantityInput" responses: "200": description: Updated cart content: application/json: schema: $ref: "#/components/schemas/Cart" "404": description: Line not found content: application/json: schema: $ref: "#/components/schemas/Error" "409": description: Out of stock content: application/json: schema: $ref: "#/components/schemas/Error" delete: operationId: removeCartItem tags: [cart] summary: Remove a variant from the cart parameters: - name: variantId in: path required: true schema: type: string format: uuid responses: "200": description: Updated cart content: application/json: schema: $ref: "#/components/schemas/Cart" /cart/merge: post: operationId: mergeCart tags: [cart] summary: Merge a guest cart into the persisted cart (sums quantities, clamps to stock) requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CartMergeInput" responses: "200": description: Merged cart content: application/json: schema: $ref: "#/components/schemas/Cart" /wishlist: get: operationId: getWishlist tags: [wishlist] summary: Get the authenticated user's wishlist products responses: "200": description: Wishlist content: application/json: schema: $ref: "#/components/schemas/Wishlist" post: operationId: addWishlistItem tags: [wishlist] summary: Add a product to the wishlist (idempotent) requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/WishlistInput" responses: "200": description: Updated wishlist content: application/json: schema: $ref: "#/components/schemas/Wishlist" "404": description: Product not found content: application/json: schema: $ref: "#/components/schemas/Error" /wishlist/{productId}: delete: operationId: removeWishlistItem tags: [wishlist] summary: Remove a product from the wishlist parameters: - name: productId in: path required: true schema: type: string format: uuid responses: "200": description: Updated wishlist content: application/json: schema: $ref: "#/components/schemas/Wishlist" /checkout/quote: post: operationId: checkoutQuote tags: [checkout] summary: Preview server-side totals for the current cart (subtotal + shipping - coupon) requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CheckoutQuoteInput" responses: "200": description: Quote content: application/json: schema: $ref: "#/components/schemas/CheckoutQuote" "401": description: Unauthenticated content: application/json: schema: $ref: "#/components/schemas/Error" "409": description: Empty cart content: application/json: schema: $ref: "#/components/schemas/Error" "422": description: Coupon invalid content: application/json: schema: $ref: "#/components/schemas/Error" /orders: post: operationId: createOrder tags: [orders] summary: Create an order from the authenticated user's cart (totals computed server-side) requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateOrderInput" responses: "201": description: Created order content: application/json: schema: $ref: "#/components/schemas/Order" "400": description: Invalid body (missing address/pickup point) content: application/json: schema: $ref: "#/components/schemas/Error" "409": description: Empty cart, out of stock, or idempotency key already used by another order content: application/json: schema: $ref: "#/components/schemas/Error" "422": description: Coupon invalid content: application/json: schema: $ref: "#/components/schemas/Error" get: operationId: listOrders tags: [orders] summary: List the authenticated user's orders (paginated, newest first) parameters: - name: page in: query required: false schema: type: integer minimum: 1 default: 1 - name: limit in: query required: false schema: type: integer minimum: 1 maximum: 100 default: 20 responses: "200": description: Paginated orders content: application/json: schema: $ref: "#/components/schemas/OrderList" /orders/{id}: get: operationId: getOrder tags: [orders] summary: Get one of the authenticated user's orders (used for payment status polling) parameters: - name: id in: path required: true schema: type: string format: uuid responses: "200": description: Order content: application/json: schema: $ref: "#/components/schemas/Order" "404": description: Not found content: application/json: schema: $ref: "#/components/schemas/Error" /orders/{id}/payment-proof/upload-url: post: operationId: createPaymentProofUploadUrl tags: [payments] summary: Get a signed URL to upload a payment proof directly to private Storage parameters: - name: id in: path required: true schema: type: string format: uuid responses: "200": description: Signed upload URL content: application/json: schema: $ref: "#/components/schemas/PaymentProofUploadUrl" "404": description: Order not found content: application/json: schema: $ref: "#/components/schemas/Error" /orders/{id}/payment-proof: post: operationId: attachPaymentProof tags: [payments] summary: Attach an uploaded payment proof and move the order to verification parameters: - name: id in: path required: true schema: type: string format: uuid requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/AttachPaymentProofInput" responses: "200": description: Updated order content: application/json: schema: $ref: "#/components/schemas/Order" "400": description: The path is not an upload issued for this order content: application/json: schema: $ref: "#/components/schemas/Error" "404": description: Order not found content: application/json: schema: $ref: "#/components/schemas/Error" "409": description: Order not in a state that accepts a proof content: application/json: schema: $ref: "#/components/schemas/Error" /guest/checkout/quote: post: operationId: guestCheckoutQuote tags: [guest] summary: Preview server-side totals for a guest cart sent in the body (no account) requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/GuestCheckoutQuoteInput" responses: "200": description: Quote content: application/json: schema: $ref: "#/components/schemas/CheckoutQuote" "409": description: A line refers to a variant that is no longer sold content: application/json: schema: $ref: "#/components/schemas/Error" "422": description: Coupon invalid content: application/json: schema: $ref: "#/components/schemas/Error" /guest/checkout/cart: post: operationId: resolveGuestCart tags: [guest] summary: >- Resolve a guest cart (variant ids kept in the browser) into displayable lines. Variants that are no longer sold come back in `missing`; a line with no stock is still a line. requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/GuestCartInput" responses: "200": description: The lines that are still sold, and the ids of those that are not content: application/json: schema: $ref: "#/components/schemas/GuestCart" "400": description: Invalid body content: application/json: schema: $ref: "#/components/schemas/Error" /guest/orders: post: operationId: createGuestOrder tags: [guest] summary: >- Place an order without an account (totals computed server-side). Returns the order and the access token that reaches it afterwards. requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateGuestOrderInput" responses: "200": description: Repeated idempotency key — the order it already created content: application/json: schema: $ref: "#/components/schemas/GuestOrderReceipt" "201": description: Created order content: application/json: schema: $ref: "#/components/schemas/GuestOrderReceipt" "400": description: Invalid body (missing address/pickup point) content: application/json: schema: $ref: "#/components/schemas/Error" "403": description: The email belongs to a blocked account content: application/json: schema: $ref: "#/components/schemas/Error" "409": description: Out of stock, or idempotency key reused with a different email content: application/json: schema: $ref: "#/components/schemas/Error" "422": description: Coupon invalid content: application/json: schema: $ref: "#/components/schemas/Error" /guest/orders/{id}: get: operationId: getGuestOrder tags: [guest] summary: Get a guest order with its access token (used for payment status polling) parameters: - name: id in: path required: true schema: type: string format: uuid - $ref: "#/components/parameters/OrderTokenHeader" responses: "200": description: Order content: application/json: schema: $ref: "#/components/schemas/Order" "404": description: Not found, or the token does not open this order (indistinguishable on purpose) content: application/json: schema: $ref: "#/components/schemas/Error" /guest/orders/{id}/payment-proof/upload-url: post: operationId: createGuestPaymentProofUploadUrl tags: [guest] summary: Get a signed URL to upload a guest order's payment proof to private Storage parameters: - name: id in: path required: true schema: type: string format: uuid - $ref: "#/components/parameters/OrderTokenHeader" responses: "200": description: Signed upload URL content: application/json: schema: $ref: "#/components/schemas/PaymentProofUploadUrl" "404": description: Order not found content: application/json: schema: $ref: "#/components/schemas/Error" /guest/orders/{id}/payment-proof: post: operationId: attachGuestPaymentProof tags: [guest] summary: Attach an uploaded payment proof to a guest order and move it to verification parameters: - name: id in: path required: true schema: type: string format: uuid - $ref: "#/components/parameters/OrderTokenHeader" requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/AttachPaymentProofInput" responses: "200": description: Updated order content: application/json: schema: $ref: "#/components/schemas/Order" "400": description: The path is not an upload issued for this order content: application/json: schema: $ref: "#/components/schemas/Error" "404": description: Order not found content: application/json: schema: $ref: "#/components/schemas/Error" "409": description: Order not in a state that accepts a proof content: application/json: schema: $ref: "#/components/schemas/Error" /admin/payments/queue: get: operationId: listPaymentVerificationQueue tags: [admin] summary: List orders awaiting payment verification (oldest first), with a signed proof URL parameters: - name: page in: query required: false schema: type: integer minimum: 1 default: 1 - name: limit in: query required: false schema: type: integer minimum: 1 maximum: 100 default: 20 responses: "200": description: Paginated verification queue content: application/json: schema: $ref: "#/components/schemas/PaymentVerificationQueue" /admin/orders: get: operationId: listAdminOrders tags: [admin] summary: List all orders for back-office operations, searchable and filterable parameters: - name: q in: query required: false description: Matches order number, customer name or customer email schema: type: string - name: paymentStatus in: query required: false schema: type: string enum: [pendiente_pago, en_verificacion, pagado, rechazado, autorizado, expirado, reembolsado] - name: fulfillmentStatus in: query required: false schema: type: string enum: [en_preparacion, enviado, entregado, recojo_pendiente, recogido, cancelado] - name: userId in: query required: false schema: type: string format: uuid - name: from in: query required: false description: Orders created on or after this date schema: type: string format: date - name: to in: query required: false description: Orders created on or before this date (inclusive, end of day) schema: type: string format: date - name: page in: query required: false schema: type: integer minimum: 1 default: 1 - name: limit in: query required: false schema: type: integer minimum: 1 maximum: 100 default: 20 responses: "200": description: Paginated admin orders content: application/json: schema: $ref: "#/components/schemas/AdminOrderList" /admin/orders/{id}: get: operationId: getAdminOrder tags: [admin] summary: Get one order with items, customer and delivery detail parameters: - name: id in: path required: true schema: type: string format: uuid responses: "200": description: Order detail content: application/json: schema: $ref: "#/components/schemas/AdminOrderDetail" "404": description: Order not found content: application/json: schema: $ref: "#/components/schemas/Error" /admin/orders/{id}/approve: post: operationId: approveOrderPayment tags: [admin] summary: Approve a payment — moves the order to pagado and decrements stock (idempotent) parameters: - name: id in: path required: true schema: type: string format: uuid responses: "200": description: Updated order content: application/json: schema: $ref: "#/components/schemas/Order" "404": description: Order not found content: application/json: schema: $ref: "#/components/schemas/Error" "409": description: Order not awaiting verification, or insufficient stock to fulfil content: application/json: schema: $ref: "#/components/schemas/Error" /admin/orders/{id}/reject: post: operationId: rejectOrderPayment tags: [admin] summary: Reject a payment — moves the order to rechazado (idempotent, no stock change) parameters: - name: id in: path required: true schema: type: string format: uuid responses: "200": description: Updated order content: application/json: schema: $ref: "#/components/schemas/Order" "404": description: Order not found content: application/json: schema: $ref: "#/components/schemas/Error" "409": description: Order not awaiting verification content: application/json: schema: $ref: "#/components/schemas/Error" /admin/orders/{id}/payment-events: get: operationId: listOrderPaymentEvents tags: [admin] summary: Payment status history of an order, oldest first (who moved it, when and why) parameters: - name: id in: path required: true schema: type: string format: uuid responses: "200": description: Payment event history content: application/json: schema: $ref: "#/components/schemas/PaymentEventList" "404": description: Order not found content: application/json: schema: $ref: "#/components/schemas/Error" /admin/shipments: get: operationId: listShipments tags: [admin] summary: List paid orders in fulfilment (logistics board), filterable by method and status parameters: - name: deliveryMethod in: query required: false schema: type: string enum: [delivery, recojo] - name: status in: query required: false schema: type: string enum: [en_preparacion, enviado, entregado, recojo_pendiente, recogido, cancelado] - name: recentTerminalDays in: query required: false description: >- When set, terminal statuses (entregado, recogido) only include orders updated in the last N days; active statuses are never filtered. Omitted = full history (current behaviour). schema: type: integer minimum: 1 - name: page in: query required: false schema: type: integer minimum: 1 default: 1 - name: limit in: query required: false schema: type: integer minimum: 1 maximum: 100 default: 50 responses: "200": description: Paginated shipments content: application/json: schema: $ref: "#/components/schemas/ShipmentList" /admin/orders/{id}/fulfillment: post: operationId: advanceFulfillment tags: [admin] summary: Advance an order's fulfilment status (validated state transition) parameters: - name: id in: path required: true schema: type: string format: uuid requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/AdvanceFulfillmentInput" responses: "200": description: Updated order content: application/json: schema: $ref: "#/components/schemas/Order" "404": description: Order not found content: application/json: schema: $ref: "#/components/schemas/Error" "409": description: Order not in fulfilment, or invalid transition content: application/json: schema: $ref: "#/components/schemas/Error" /admin/products: get: operationId: listAdminProducts tags: [admin] summary: List all products for inventory management (includes inactive) parameters: - name: q in: query required: false schema: type: string - name: page in: query required: false schema: type: integer minimum: 1 default: 1 - name: limit in: query required: false schema: type: integer minimum: 1 maximum: 100 default: 20 responses: "200": description: Paginated admin products content: application/json: schema: $ref: "#/components/schemas/AdminProductList" post: operationId: createProduct tags: [admin] summary: Create a product (optionally with occasions and variants) requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateProductInput" responses: "201": description: Created product content: application/json: schema: $ref: "#/components/schemas/AdminProduct" "409": description: Slug or SKU already exists content: application/json: schema: $ref: "#/components/schemas/Error" /admin/products/{id}: patch: operationId: updateProduct tags: [admin] summary: Update a product's fields (partial); soft-delete via active=false parameters: - name: id in: path required: true schema: type: string format: uuid requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/UpdateProductInput" responses: "200": description: Updated product content: application/json: schema: $ref: "#/components/schemas/AdminProduct" "404": description: Product not found content: application/json: schema: $ref: "#/components/schemas/Error" "409": description: Slug already exists content: application/json: schema: $ref: "#/components/schemas/Error" delete: operationId: deleteProduct tags: [admin] summary: Hard-delete a product that was never sold (admin only) description: Products referenced by order items return 409 REFERENCED — deactivate instead. parameters: - name: id in: path required: true schema: type: string format: uuid responses: "204": description: Deleted "404": description: Product not found content: application/json: schema: $ref: "#/components/schemas/Error" "409": description: Product has sales (REFERENCED), deactivate instead content: application/json: schema: $ref: "#/components/schemas/Error" /admin/products/{id}/variants: post: operationId: createVariant tags: [admin] summary: Add a size/color variant to a product parameters: - name: id in: path required: true schema: type: string format: uuid requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateVariantInput" responses: "200": description: Updated product (with the new variant) content: application/json: schema: $ref: "#/components/schemas/AdminProduct" "404": description: Product not found content: application/json: schema: $ref: "#/components/schemas/Error" "409": description: SKU or size/color combination already exists content: application/json: schema: $ref: "#/components/schemas/Error" /admin/products/{id}/media: post: operationId: attachProductMedia tags: [admin] summary: Attach an uploaded photo/video to a product (appended last) parameters: - name: id in: path required: true schema: type: string format: uuid requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/AttachProductMediaInput" responses: "200": description: Updated product (with the new media) content: application/json: schema: $ref: "#/components/schemas/AdminProduct" "404": description: Product not found content: application/json: schema: $ref: "#/components/schemas/Error" /admin/media/{id}: delete: operationId: deleteProductMedia tags: [admin] summary: Remove a product media item parameters: - name: id in: path required: true schema: type: string format: uuid responses: "204": description: Deleted "404": description: Media not found content: application/json: schema: $ref: "#/components/schemas/Error" /admin/products/import: post: operationId: importProducts tags: [admin] summary: Bulk import products/variants from CSV (upsert by SKU); dryRun previews errors requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/ProductImportInput" responses: "200": description: Import result (row-level errors, imported count) content: application/json: schema: $ref: "#/components/schemas/ProductImportResult" "400": description: CSV could not be parsed content: application/json: schema: $ref: "#/components/schemas/Error" /admin/variants/{id}: patch: operationId: updateVariant tags: [admin] summary: Update a variant (stock, price override, active, size/color/sku) parameters: - name: id in: path required: true schema: type: string format: uuid requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/UpdateVariantInput" responses: "200": description: Updated product (owning the variant) content: application/json: schema: $ref: "#/components/schemas/AdminProduct" "404": description: Variant not found content: application/json: schema: $ref: "#/components/schemas/Error" "409": description: SKU or size/color combination already exists content: application/json: schema: $ref: "#/components/schemas/Error" /admin/categories: post: operationId: createCategory tags: [admin] summary: Create a category (admin only) requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateCategoryInput" responses: "201": description: Created category content: application/json: schema: $ref: "#/components/schemas/Category" "409": description: Category slug already exists content: application/json: schema: $ref: "#/components/schemas/Error" /admin/categories/{id}: patch: operationId: updateCategory tags: [admin] summary: Update a category (partial); activate/deactivate via active parameters: - name: id in: path required: true schema: type: string format: uuid requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/UpdateCategoryInput" responses: "200": description: Updated category content: application/json: schema: $ref: "#/components/schemas/Category" "404": description: Category not found content: application/json: schema: $ref: "#/components/schemas/Error" "409": description: Category slug already exists content: application/json: schema: $ref: "#/components/schemas/Error" delete: operationId: deleteCategory tags: [admin] summary: Delete a category (admin only); blocked when products reference it parameters: - name: id in: path required: true schema: type: string format: uuid responses: "204": description: Deleted "404": description: Category not found content: application/json: schema: $ref: "#/components/schemas/Error" "409": description: Category has products; deactivate it instead content: application/json: schema: $ref: "#/components/schemas/Error" /admin/occasions: post: operationId: createOccasion tags: [admin] summary: Create an occasion (admin only) requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateOccasionInput" responses: "201": description: Created occasion content: application/json: schema: $ref: "#/components/schemas/Occasion" "409": description: Occasion slug already exists content: application/json: schema: $ref: "#/components/schemas/Error" /admin/occasions/{id}: patch: operationId: updateOccasion tags: [admin] summary: Update an occasion (partial); activate/deactivate via active parameters: - name: id in: path required: true schema: type: string format: uuid requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/UpdateOccasionInput" responses: "200": description: Updated occasion content: application/json: schema: $ref: "#/components/schemas/Occasion" "404": description: Occasion not found content: application/json: schema: $ref: "#/components/schemas/Error" "409": description: Occasion slug already exists content: application/json: schema: $ref: "#/components/schemas/Error" delete: operationId: deleteOccasion tags: [admin] summary: Delete an occasion (admin only); blocked when products reference it parameters: - name: id in: path required: true schema: type: string format: uuid responses: "204": description: Deleted "404": description: Occasion not found content: application/json: schema: $ref: "#/components/schemas/Error" "409": description: Occasion is assigned to products; deactivate it instead content: application/json: schema: $ref: "#/components/schemas/Error" /admin/dashboard: get: operationId: getDashboard tags: [admin] summary: Backoffice landing KPIs, alerts and top products (employee + admin) responses: "200": description: Dashboard summary content: application/json: schema: $ref: "#/components/schemas/DashboardSummary" /admin/reports: get: operationId: getSalesReport tags: [admin] summary: Sales, funnel and abandoned-cart report for a date range (admin only) parameters: - name: from in: query required: false description: ISO date YYYY-MM-DD (inclusive). Defaults to 30 days ago. schema: type: string pattern: '^\d{4}-\d{2}-\d{2}$' - name: to in: query required: false description: ISO date YYYY-MM-DD (inclusive). Defaults to today. schema: type: string pattern: '^\d{4}-\d{2}-\d{2}$' responses: "200": description: Sales report content: application/json: schema: $ref: "#/components/schemas/SalesReport" /admin/coupons: get: operationId: listCoupons tags: [admin] summary: List coupons for management (admin only) parameters: - name: q in: query required: false schema: type: string - name: page in: query required: false schema: type: integer minimum: 1 default: 1 - name: limit in: query required: false schema: type: integer minimum: 1 maximum: 100 default: 20 responses: "200": description: Paginated coupons content: application/json: schema: $ref: "#/components/schemas/CouponList" post: operationId: createCoupon tags: [admin] summary: Create a coupon (admin only) requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateCouponInput" responses: "201": description: Created coupon content: application/json: schema: $ref: "#/components/schemas/Coupon" "409": description: Coupon code already exists content: application/json: schema: $ref: "#/components/schemas/Error" /admin/coupons/{id}: patch: operationId: updateCoupon tags: [admin] summary: Update a coupon's fields (partial); activate/deactivate via active parameters: - name: id in: path required: true schema: type: string format: uuid requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/UpdateCouponInput" responses: "200": description: Updated coupon content: application/json: schema: $ref: "#/components/schemas/Coupon" "404": description: Coupon not found content: application/json: schema: $ref: "#/components/schemas/Error" "409": description: Coupon code already exists content: application/json: schema: $ref: "#/components/schemas/Error" delete: operationId: deleteCoupon tags: [admin] summary: Delete a coupon (admin only); blocked if already redeemed parameters: - name: id in: path required: true schema: type: string format: uuid responses: "204": description: Deleted "404": description: Coupon not found content: application/json: schema: $ref: "#/components/schemas/Error" "409": description: Coupon already redeemed, cannot delete content: application/json: schema: $ref: "#/components/schemas/Error" /returns: get: operationId: listMyReturns tags: [returns] summary: List the authenticated caller's return tickets, optionally for one order parameters: - name: orderId in: query required: false schema: type: string format: uuid responses: "200": description: Return tickets (newest first) content: application/json: schema: type: array items: $ref: "#/components/schemas/ReturnTicket" "401": description: Unauthenticated content: application/json: schema: $ref: "#/components/schemas/Error" post: operationId: createReturn tags: [returns] summary: Open a return ticket for one of the caller's orders (requerimientos §7.6) requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateReturnInput" responses: "201": description: Created return ticket content: application/json: schema: $ref: "#/components/schemas/ReturnTicket" "404": description: Order not found or not owned by the caller content: application/json: schema: $ref: "#/components/schemas/Error" "409": description: An open ticket already exists for this order (ALREADY_OPEN) content: application/json: schema: $ref: "#/components/schemas/Error" "422": description: Order not delivered/picked up yet (NOT_ELIGIBLE) content: application/json: schema: $ref: "#/components/schemas/Error" /stock-alerts: post: operationId: createStockAlert tags: [catalog] summary: Subscribe to a back-in-stock email for a variant (idempotent) description: Authenticated callers default to their profile email; guests must send one. requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateStockAlertInput" responses: "201": description: Subscribed (or already subscribed) "400": description: Guest request without email content: application/json: schema: $ref: "#/components/schemas/Error" "404": description: Variant not found content: application/json: schema: $ref: "#/components/schemas/Error" "409": description: Variant currently has stock (IN_STOCK) content: application/json: schema: $ref: "#/components/schemas/Error" /admin/returns: get: operationId: listReturns tags: [admin] summary: List return tickets for the backoffice board (requerimientos §6.7) parameters: - name: status in: query required: false schema: type: string enum: [nueva, en_proceso, resuelta, cerrada] - name: page in: query required: false schema: type: integer minimum: 1 default: 1 - name: limit in: query required: false schema: type: integer minimum: 1 maximum: 100 default: 20 responses: "200": description: Paginated return tickets content: application/json: schema: $ref: "#/components/schemas/AdminReturnList" /admin/returns/{id}: patch: operationId: updateReturnStatus tags: [admin] summary: Update a return ticket's status parameters: - name: id in: path required: true schema: type: string format: uuid requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/UpdateReturnStatusInput" responses: "200": description: Updated return ticket content: application/json: schema: $ref: "#/components/schemas/AdminReturn" "404": description: Return ticket not found content: application/json: schema: $ref: "#/components/schemas/Error" /admin/users: get: operationId: listUsers tags: [admin] summary: List users for management (requerimientos §6.9, solo Admin) parameters: - name: role in: query required: false schema: type: string enum: [customer, employee, admin] - name: q in: query required: false schema: type: string - name: page in: query required: false schema: type: integer minimum: 1 default: 1 - name: limit in: query required: false schema: type: integer minimum: 1 maximum: 100 default: 20 responses: "200": description: Paginated users content: application/json: schema: $ref: "#/components/schemas/AdminUserList" post: operationId: createEmployee tags: [admin] summary: Create an employee (provisions a Supabase auth user, magic-link login) requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateEmployeeInput" responses: "201": description: Created employee content: application/json: schema: $ref: "#/components/schemas/AdminUser" "409": description: Email already registered content: application/json: schema: $ref: "#/components/schemas/Error" /admin/users/{id}: patch: operationId: updateUser tags: [admin] summary: Update a user — block a client, edit an employee, change role parameters: - name: id in: path required: true schema: type: string format: uuid requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/UpdateUserInput" responses: "200": description: Updated user content: application/json: schema: $ref: "#/components/schemas/AdminUser" "400": description: Cannot modify your own role or blocked status content: application/json: schema: $ref: "#/components/schemas/Error" "404": description: User not found content: application/json: schema: $ref: "#/components/schemas/Error" /complaints: post: operationId: createComplaint tags: [legal] summary: File a complaint in the Libro de Reclamaciones (Ley 29571, D.S. 011-2011-PCM) description: > Public on purpose and NOT authenticated: requiring an account to complain would itself obstruct the right to complain. Returns the correlativo and the legal response deadline; the full Hoja de Reclamación is emailed to the consumer as the required constancia. requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateComplaintInput" responses: "201": description: Filed complaint receipt content: application/json: schema: $ref: "#/components/schemas/ComplaintReceipt" "400": description: Invalid body (INVALID_BODY) content: application/json: schema: $ref: "#/components/schemas/Error" "422": description: A minor was declared without naming a guardian (GUARDIAN_REQUIRED) content: application/json: schema: $ref: "#/components/schemas/Error" /consents: post: operationId: recordConsent tags: [legal] summary: Record a grant or withdrawal of consent (Ley 29733, D.S. 016-2024-JUS) description: > Append-only. Withdrawing consent writes a new row with granted=false rather than updating the old one, because erasing the evidence would defeat demonstrability. The IP and user agent are taken from the request itself and are never accepted from the client, which would make the record forgeable and therefore worthless. requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/RecordConsentInput" responses: "204": description: Consent recorded "400": description: Invalid body (INVALID_BODY) content: application/json: schema: $ref: "#/components/schemas/Error" /admin/complaints: get: operationId: listComplaints tags: [admin] summary: List complaints for the backoffice, soonest legal deadline first parameters: - name: status in: query required: false schema: type: string enum: [pendiente, en_proceso, resuelto, cerrado] - name: type in: query required: false schema: type: string enum: [reclamo, queja] - name: page in: query required: false schema: type: integer minimum: 1 default: 1 - name: limit in: query required: false schema: type: integer minimum: 1 maximum: 100 default: 20 responses: "200": description: Paginated complaints content: application/json: schema: $ref: "#/components/schemas/AdminComplaintList" /admin/complaints/{id}: patch: operationId: respondComplaint tags: [admin] summary: Record the provider's response to a complaint description: > There is deliberately no DELETE for complaints anywhere in this API. Records are kept for two years; `cerrado` is how a file ends. parameters: - name: id in: path required: true schema: type: string format: uuid requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/UpdateComplaintInput" responses: "200": description: Updated complaint content: application/json: schema: $ref: "#/components/schemas/AdminComplaint" "404": description: Complaint not found content: application/json: schema: $ref: "#/components/schemas/Error" /config: get: operationId: getPublicConfig tags: [config] summary: Public store config for checkout/home (delivery fee, Yape, banners) responses: "200": description: Public config content: application/json: schema: $ref: "#/components/schemas/PublicConfig" /pickup-points: get: operationId: listPickupPoints tags: [config] summary: Active pickup points in the store's coverage area (for checkout recojo) responses: "200": description: Active pickup points content: application/json: schema: $ref: "#/components/schemas/PickupPointList" /admin/config: get: operationId: getAdminConfig tags: [admin] summary: Get store config for the admin panel (admin only) responses: "200": description: Admin config content: application/json: schema: $ref: "#/components/schemas/AdminConfig" put: operationId: updateAdminConfig tags: [admin] summary: Update store config — delivery fee, Yape number/QR, banners (admin only) requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/UpdateConfigInput" responses: "200": description: Updated admin config content: application/json: schema: $ref: "#/components/schemas/AdminConfig" /admin/config/media/upload-url: post: operationId: createConfigMediaUploadUrl tags: [admin] summary: Signed URL to upload a QR/banner image to public Storage (admin only) requestBody: required: false content: application/json: schema: $ref: "#/components/schemas/ConfigMediaUploadInput" responses: "200": description: Signed upload URL plus the public read URL content: application/json: schema: $ref: "#/components/schemas/ConfigMediaUploadUrl" /admin/pickup-points: get: operationId: listAdminPickupPoints tags: [admin] summary: List all pickup points including inactive (admin only) responses: "200": description: Pickup points content: application/json: schema: $ref: "#/components/schemas/PickupPointList" post: operationId: createPickupPoint tags: [admin] summary: Create a pickup point (admin only) requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreatePickupPointInput" responses: "201": description: Created pickup point content: application/json: schema: $ref: "#/components/schemas/PickupPoint" /admin/pickup-points/{id}: patch: operationId: updatePickupPoint tags: [admin] summary: Update a pickup point (admin only) parameters: - name: id in: path required: true schema: type: string format: uuid requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/UpdatePickupPointInput" responses: "200": description: Updated pickup point content: application/json: schema: $ref: "#/components/schemas/PickupPoint" "404": description: Pickup point not found content: application/json: schema: $ref: "#/components/schemas/Error" delete: operationId: deletePickupPoint tags: [admin] summary: Delete a pickup point (admin only); blocked if referenced by orders parameters: - name: id in: path required: true schema: type: string format: uuid responses: "204": description: Deleted "404": description: Pickup point not found content: application/json: schema: $ref: "#/components/schemas/Error" "409": description: Referenced by orders, cannot delete (deactivate instead) content: application/json: schema: $ref: "#/components/schemas/Error" /admin/ops: get: operationId: getOpsSnapshot tags: [admin] summary: Operational snapshot for the day the store is running description: > The handful of numbers that say whether the operation is healthy right now: how long the oldest unverified constancia has been waiting, how payments have been resolving, and whether notifications are going out. Separate from /admin/dashboard on purpose — that one is loaded on every visit to the panel and is about sales, this one runs heavier aggregate queries and is only read when somebody is looking at operations. responses: "200": description: Operational snapshot content: application/json: schema: $ref: "#/components/schemas/OpsSnapshot" /admin/notifications: get: operationId: listNotificationDeliveries tags: [admin] summary: Outbox — what was sent, what failed and what is still queued parameters: - name: status in: query required: false schema: type: string enum: [pendiente, enviado, fallido] - name: relatedType in: query required: false schema: type: string enum: [order, complaint, return, variant] - name: relatedId in: query required: false schema: type: string format: uuid - name: limit in: query required: false schema: type: integer minimum: 1 maximum: 100 default: 50 responses: "200": description: Delivery records, newest first content: application/json: schema: $ref: "#/components/schemas/NotificationDeliveryList" /admin/notifications/{id}/retry: post: operationId: retryNotificationDelivery tags: [admin] summary: Put a failed delivery back in the queue description: > Only a `fallido` record can be requeued. The usual reason a batch fails is configuration (an unverified sender domain, a missing API key), and once that is fixed those messages still need to go out — most of all the Hoja de Reclamación, which is the consumer's legal constancia of their filing. parameters: - name: id in: path required: true schema: type: string format: uuid responses: "200": description: Requeued content: application/json: schema: $ref: "#/components/schemas/NotificationDelivery" "404": description: Not found, or not in a state that can be requeued content: application/json: schema: $ref: "#/components/schemas/Error" components: parameters: OrderTokenHeader: name: X-Order-Token in: header required: true description: >- Access token of a guest order, as returned by createGuestOrder and emailed to the customer. A header and not a query parameter so it never lands in access logs. schema: type: string minLength: 1 maxLength: 128 schemas: HealthStatus: type: object properties: status: type: string required: - status ReadinessStatus: type: object description: > Kept deliberately small. This endpoint is reachable without authentication, so it carries no version, no configuration and no connection details — only whether each dependency answered and how long it took. properties: status: type: string enum: [ok, degraded] checks: type: object properties: database: $ref: "#/components/schemas/ReadinessCheck" required: - database required: - status - checks ReadinessCheck: type: object properties: status: type: string enum: [ok, error] latencyMs: type: integer required: - status Error: type: object properties: code: type: string message: type: string # Present on unexpected failures (500). It is the same id in the X-Request-Id response # header and in the server log line for this request, so a customer can quote it and # support can find the failure without guessing at timestamps. Never set on business # errors: those are expected outcomes, not incidents. requestId: type: string required: - code - message Me: type: object properties: user: type: object properties: id: type: string format: uuid email: type: string role: type: string enum: [customer, employee, admin] fullName: type: [string, "null"] phone: type: [string, "null"] shippingAddress: type: [string, "null"] required: - id - email - role - fullName - phone - shippingAddress required: - user UpdateMeInput: type: object properties: fullName: type: string minLength: 1 phone: type: string minLength: 1 shippingAddress: type: string Category: type: object properties: id: type: string format: uuid slug: type: string name: type: string sortOrder: type: integer active: type: boolean required: - id - slug - name - sortOrder - active Occasion: type: object properties: id: type: string format: uuid slug: type: string name: type: string sortOrder: type: integer active: type: boolean required: - id - slug - name - sortOrder - active CreateCategoryInput: type: object properties: name: type: string minLength: 1 slug: type: string description: URL-safe slug; generated from name when omitted active: type: boolean default: true sortOrder: type: integer default: 0 required: - name UpdateCategoryInput: type: object properties: name: type: string minLength: 1 slug: type: string active: type: boolean sortOrder: type: integer CreateOccasionInput: type: object properties: name: type: string minLength: 1 slug: type: string description: URL-safe slug; generated from name when omitted active: type: boolean default: true sortOrder: type: integer default: 0 required: - name UpdateOccasionInput: type: object properties: name: type: string minLength: 1 slug: type: string active: type: boolean sortOrder: type: integer ProductImage: type: object properties: kind: type: string enum: [image, video] path: type: string sortOrder: type: integer required: - kind - path - sortOrder ProductVariant: type: object properties: id: type: string format: uuid size: type: string color: type: string colorHex: type: [string, "null"] description: Swatch color as #RRGGBB; null falls back to the client-side name map sku: type: string stock: type: integer required: - id - size - color - colorHex - sku - stock Product: type: object properties: id: type: string format: uuid slug: type: string name: type: string description: type: [string, "null"] fit: type: [string, "null"] # Money is fixed-point numeric serialized as a string. Never parse to float for math. price: type: string badge: type: [string, "null"] featured: type: boolean category: $ref: "#/components/schemas/Category" occasions: type: array items: $ref: "#/components/schemas/Occasion" images: type: array items: $ref: "#/components/schemas/ProductImage" variants: type: array items: $ref: "#/components/schemas/ProductVariant" required: - id - slug - name - description - fit - price - badge - featured - category - occasions - images - variants ProductList: type: object properties: items: type: array items: $ref: "#/components/schemas/Product" total: type: integer page: type: integer limit: type: integer required: - items - total - page - limit CartItemInput: type: object properties: variantId: type: string format: uuid quantity: type: integer minimum: 1 default: 1 required: - variantId CartQuantityInput: type: object properties: quantity: type: integer minimum: 1 required: - quantity CartMergeInput: type: object properties: items: type: array items: $ref: "#/components/schemas/CartItemInput" required: - items CartItem: type: object properties: variantId: type: string format: uuid productId: type: string format: uuid slug: type: string name: type: string size: type: string color: type: string sku: type: string stock: type: integer # Effective unit price (variant override or product price). Fixed-point string. unitPrice: type: string quantity: type: integer image: type: [string, "null"] required: - variantId - productId - slug - name - size - color - sku - stock - unitPrice - quantity - image Cart: type: object properties: items: type: array items: $ref: "#/components/schemas/CartItem" required: - items WishlistInput: type: object properties: productId: type: string format: uuid required: - productId Wishlist: type: object properties: items: type: array items: $ref: "#/components/schemas/Product" required: - items CheckoutQuoteInput: type: object properties: deliveryMethod: type: string enum: [delivery, recojo] couponCode: type: [string, "null"] required: - deliveryMethod QuoteItem: type: object properties: variantId: type: string format: uuid name: type: string variantLabel: type: string # Fixed-point money strings. Never parse to float for math. unitPrice: type: string quantity: type: integer lineTotal: type: string required: - variantId - name - variantLabel - unitPrice - quantity - lineTotal CheckoutQuote: type: object properties: items: type: array items: $ref: "#/components/schemas/QuoteItem" subtotal: type: string shippingCost: type: string discountAmount: type: string total: type: string couponCode: type: [string, "null"] required: - items - subtotal - shippingCost - discountAmount - total - couponCode CreateOrderInput: type: object properties: deliveryMethod: type: string enum: [delivery, recojo] shippingAddress: type: [string, "null"] description: Required when deliveryMethod is delivery pickupPointId: type: [string, "null"] format: uuid description: Required when deliveryMethod is recojo couponCode: type: [string, "null"] idempotencyKey: type: [string, "null"] description: Client-supplied key; a repeated key returns the same order required: - deliveryMethod GuestOrderItemInput: type: object properties: variantId: type: string format: uuid quantity: type: integer minimum: 1 maximum: 99 required: - variantId - quantity GuestCartInput: type: object properties: items: type: array minItems: 1 maxItems: 50 items: $ref: "#/components/schemas/GuestOrderItemInput" required: - items GuestCart: type: object properties: items: type: array items: $ref: "#/components/schemas/CartItem" missing: type: array items: type: string format: uuid required: - items - missing GuestCheckoutQuoteInput: type: object properties: items: type: array minItems: 1 maxItems: 50 items: $ref: "#/components/schemas/GuestOrderItemInput" deliveryMethod: type: string enum: [delivery, recojo] couponCode: type: [string, "null"] required: - items - deliveryMethod CreateGuestOrderInput: type: object properties: email: type: string format: email maxLength: 254 fullName: type: string minLength: 1 maxLength: 120 phone: type: string minLength: 1 maxLength: 30 items: type: array minItems: 1 maxItems: 50 items: $ref: "#/components/schemas/GuestOrderItemInput" deliveryMethod: type: string enum: [delivery, recojo] shippingAddress: type: [string, "null"] maxLength: 500 description: Required when deliveryMethod is delivery pickupPointId: type: [string, "null"] format: uuid description: Required when deliveryMethod is recojo couponCode: type: [string, "null"] idempotencyKey: type: [string, "null"] maxLength: 128 description: Client-supplied key; a repeated key (with the same email) returns the same order required: - email - fullName - phone - items - deliveryMethod GuestOrderReceipt: type: object properties: order: $ref: "#/components/schemas/Order" accessToken: type: string description: >- Opens this order through the /guest/orders endpoints. The client keeps it; the customer also receives it inside the link of the confirmation email. required: - order - accessToken GuestOrderClaimRequest: type: object properties: orders: type: array minItems: 1 maxItems: 50 items: type: object properties: orderId: type: string format: uuid accessToken: type: string minLength: 1 maxLength: 128 required: - orderId - accessToken required: - orders GuestOrderClaim: type: object properties: claimed: type: integer minimum: 0 required: - claimed OrderItem: type: object properties: variantId: type: [string, "null"] format: uuid productName: type: string variantLabel: type: [string, "null"] sku: type: [string, "null"] unitPrice: type: string quantity: type: integer lineTotal: type: string required: - variantId - productName - variantLabel - sku - unitPrice - quantity - lineTotal Order: type: object properties: id: type: string format: uuid orderNumber: type: integer # Derived Yape match key: -{orderNumber} (see lib/brand). Not stored. referenceCode: type: string paymentStatus: type: string enum: [pendiente_pago, en_verificacion, pagado, rechazado, autorizado, expirado, reembolsado] # Which payment provider owns the order. The client branches on this to render the # right payment instructions instead of assuming there is only ever one method. paymentMethod: type: string enum: [manual_yape] fulfillmentStatus: type: [string, "null"] enum: [en_preparacion, enviado, entregado, recojo_pendiente, recogido, cancelado, null] deliveryMethod: type: string enum: [delivery, recojo] pickupPointId: type: [string, "null"] format: uuid shippingAddress: type: [string, "null"] subtotal: type: string shippingCost: type: string discountAmount: type: string total: type: string couponCode: type: [string, "null"] paymentProofStatus: type: [string, "null"] enum: [pendiente, aprobado, rechazado, null] createdAt: type: string format: date-time items: type: array items: $ref: "#/components/schemas/OrderItem" required: - id - orderNumber - referenceCode - paymentStatus - paymentMethod - fulfillmentStatus - deliveryMethod - pickupPointId - shippingAddress - subtotal - shippingCost - discountAmount - total - couponCode - paymentProofStatus - createdAt - items OrderListItem: type: object properties: id: type: string format: uuid orderNumber: type: integer referenceCode: type: string paymentStatus: type: string enum: [pendiente_pago, en_verificacion, pagado, rechazado, autorizado, expirado, reembolsado] fulfillmentStatus: type: [string, "null"] enum: [en_preparacion, enviado, entregado, recojo_pendiente, recogido, cancelado, null] deliveryMethod: type: string enum: [delivery, recojo] total: type: string createdAt: type: string format: date-time required: - id - orderNumber - referenceCode - paymentStatus - fulfillmentStatus - deliveryMethod - total - createdAt OrderList: type: object properties: items: type: array items: $ref: "#/components/schemas/OrderListItem" total: type: integer page: type: integer limit: type: integer required: - items - total - page - limit AdminOrderListItem: type: object properties: id: type: string format: uuid orderNumber: type: integer referenceCode: type: string customerEmail: type: string customerName: type: [string, "null"] customerIsGuest: type: boolean description: >- The order was placed without an account (guest checkout). The customer reaches it through the link in their email, not by logging in. deliveryMethod: type: string enum: [delivery, recojo] paymentStatus: type: string enum: [pendiente_pago, en_verificacion, pagado, rechazado, autorizado, expirado, reembolsado] fulfillmentStatus: type: [string, "null"] enum: [en_preparacion, enviado, entregado, recojo_pendiente, recogido, cancelado, null] total: type: string createdAt: type: string format: date-time required: - id - orderNumber - referenceCode - customerEmail - customerName - customerIsGuest - deliveryMethod - paymentStatus - fulfillmentStatus - total - createdAt AdminOrderList: type: object properties: items: type: array items: $ref: "#/components/schemas/AdminOrderListItem" total: type: integer page: type: integer limit: type: integer required: - items - total - page - limit AdminOrderDetail: type: object properties: id: type: string format: uuid orderNumber: type: integer referenceCode: type: string customerEmail: type: string customerName: type: [string, "null"] customerPhone: type: [string, "null"] customerIsGuest: type: boolean description: >- The order was placed without an account (guest checkout). The customer reaches it through the link in their email, not by logging in. paymentStatus: type: string enum: [pendiente_pago, en_verificacion, pagado, rechazado, autorizado, expirado, reembolsado] # Which payment provider owns the order. The client branches on this to render the # right payment instructions instead of assuming there is only ever one method. paymentMethod: type: string enum: [manual_yape] fulfillmentStatus: type: [string, "null"] enum: [en_preparacion, enviado, entregado, recojo_pendiente, recogido, cancelado, null] deliveryMethod: type: string enum: [delivery, recojo] pickupPointId: type: [string, "null"] format: uuid pickupPointName: type: [string, "null"] shippingAddress: type: [string, "null"] subtotal: type: string shippingCost: type: string discountAmount: type: string total: type: string couponCode: type: [string, "null"] paymentProofStatus: type: [string, "null"] enum: [pendiente, aprobado, rechazado, null] createdAt: type: string format: date-time updatedAt: type: string format: date-time items: type: array items: $ref: "#/components/schemas/OrderItem" required: - id - orderNumber - referenceCode - customerEmail - customerName - customerPhone - customerIsGuest - paymentStatus - paymentMethod - fulfillmentStatus - deliveryMethod - pickupPointId - pickupPointName - shippingAddress - subtotal - shippingCost - discountAmount - total - couponCode - paymentProofStatus - createdAt - updatedAt - items PaymentProofUploadUrl: type: object properties: uploadUrl: type: string description: PUT the file to this URL (direct to private Storage) path: type: string description: Storage object path to send back when attaching the proof token: type: string required: - uploadUrl - path - token AttachPaymentProofInput: type: object properties: path: type: string description: Storage object path returned by the upload-url endpoint amountReported: type: [string, "null"] required: - path PaymentVerificationItem: type: object properties: id: type: string format: uuid orderNumber: type: integer referenceCode: type: string customerEmail: type: string customerName: type: [string, "null"] customerPhone: type: [string, "null"] deliveryMethod: type: string enum: [delivery, recojo] # Order total (server-computed). Fixed-point money string. total: type: string # Amount the customer typed when uploading the proof, if any. May differ from total. amountReported: type: [string, "null"] # Signed, expiring URL to the constancia image in the private bucket (null if none). proofUrl: type: [string, "null"] createdAt: type: string format: date-time required: - id - orderNumber - referenceCode - customerEmail - customerName - customerPhone - deliveryMethod - total - amountReported - proofUrl - createdAt PaymentVerificationQueue: type: object properties: items: type: array items: $ref: "#/components/schemas/PaymentVerificationItem" total: type: integer page: type: integer limit: type: integer required: - items - total - page - limit PaymentEvent: type: object description: >- One entry in an order's payment history. Append-only: an event records the move that happened, so a later correction is a new event rather than an edit of this one. properties: id: type: string format: uuid provider: type: string enum: [manual_yape] # Provider vocabulary for what happened: proof_attached, manual_approved, # manual_rejected, expired_unpaid — or a gateway's own event name. type: type: string fromStatus: type: [string, "null"] enum: [pendiente_pago, en_verificacion, pagado, rechazado, autorizado, expirado, reembolsado, null] toStatus: type: string enum: [pendiente_pago, en_verificacion, pagado, rechazado, autorizado, expirado, reembolsado] # Null when no person was responsible: a gateway webhook or the expiry job. The # backoffice must render that as "sistema", never as a blank that reads like a name. actorName: type: [string, "null"] actorEmail: type: [string, "null"] amount: type: [string, "null"] currency: type: [string, "null"] createdAt: type: string format: date-time required: - id - provider - type - fromStatus - toStatus - actorName - actorEmail - amount - currency - createdAt PaymentEventList: type: object properties: items: type: array items: $ref: "#/components/schemas/PaymentEvent" required: - items ShipmentItem: type: object properties: id: type: string format: uuid orderNumber: type: integer referenceCode: type: string customerEmail: type: string customerName: type: [string, "null"] customerPhone: type: [string, "null"] deliveryMethod: type: string enum: [delivery, recojo] fulfillmentStatus: type: string enum: [en_preparacion, enviado, entregado, recojo_pendiente, recogido, cancelado] shippingAddress: type: [string, "null"] total: type: string createdAt: type: string format: date-time required: - id - orderNumber - referenceCode - customerEmail - customerName - customerPhone - deliveryMethod - fulfillmentStatus - shippingAddress - total - createdAt ShipmentList: type: object properties: items: type: array items: $ref: "#/components/schemas/ShipmentItem" total: type: integer page: type: integer limit: type: integer required: - items - total - page - limit AdvanceFulfillmentInput: type: object properties: to: type: string enum: [en_preparacion, enviado, entregado, recojo_pendiente, recogido, cancelado] required: - to AdminProductVariant: type: object properties: id: type: string format: uuid size: type: string color: type: string colorHex: type: [string, "null"] sku: type: string stock: type: integer priceOverride: type: [string, "null"] active: type: boolean required: - id - size - color - colorHex - sku - stock - priceOverride - active AdminProductMedia: type: object properties: id: type: string format: uuid kind: type: string enum: [image, video] path: type: string description: Storage object path in the public bucket sortOrder: type: integer required: - id - kind - path - sortOrder AttachProductMediaInput: type: object properties: path: type: string minLength: 1 description: Storage path returned by the media upload-url endpoint kind: type: string enum: [image, video] default: image required: - path AdminProduct: type: object properties: id: type: string format: uuid slug: type: string name: type: string description: type: [string, "null"] fit: type: [string, "null"] price: type: string badge: type: [string, "null"] featured: type: boolean active: type: boolean categoryId: type: string format: uuid categoryName: type: string occasions: type: array items: $ref: "#/components/schemas/Occasion" stockTotal: type: integer variants: type: array items: $ref: "#/components/schemas/AdminProductVariant" media: type: array items: $ref: "#/components/schemas/AdminProductMedia" required: - id - slug - name - description - fit - price - badge - featured - active - categoryId - categoryName - occasions - stockTotal - variants - media AdminProductList: type: object properties: items: type: array items: $ref: "#/components/schemas/AdminProduct" total: type: integer page: type: integer limit: type: integer required: - items - total - page - limit CreateVariantInput: type: object properties: size: type: string minLength: 1 color: type: string minLength: 1 colorHex: type: [string, "null"] pattern: "^#[0-9a-fA-F]{6}$" sku: type: string minLength: 1 stock: type: integer minimum: 0 default: 0 priceOverride: type: [string, "null"] required: - size - color - sku CreateProductInput: type: object properties: name: type: string minLength: 1 price: type: string categoryId: type: string format: uuid description: type: [string, "null"] fit: type: [string, "null"] badge: type: [string, "null"] featured: type: boolean default: false occasionIds: type: array items: type: string format: uuid variants: type: array items: $ref: "#/components/schemas/CreateVariantInput" required: - name - price - categoryId UpdateProductInput: type: object properties: name: type: string minLength: 1 price: type: string categoryId: type: string format: uuid description: type: [string, "null"] fit: type: [string, "null"] badge: type: [string, "null"] featured: type: boolean active: type: boolean occasionIds: type: array items: type: string format: uuid UpdateVariantInput: type: object properties: size: type: string minLength: 1 color: type: string minLength: 1 colorHex: type: [string, "null"] pattern: "^#[0-9a-fA-F]{6}$" sku: type: string minLength: 1 stock: type: integer minimum: 0 priceOverride: type: [string, "null"] active: type: boolean ProductImportInput: type: object properties: csv: type: string description: "Raw CSV text. Columns: nombre, categoria, ocasion, precio, talla, color, sku, stock, descripcion" dryRun: type: boolean default: false description: When true, validate and report errors without writing anything required: - csv ProductImportError: type: object properties: row: type: integer description: 1-based row number in the source file (header is row 1) message: type: string required: - row - message ProductImportResult: type: object properties: total: type: integer description: Data rows parsed (excludes header) imported: type: integer description: Rows written (0 when dryRun) valid: type: integer description: Rows that passed validation errors: type: array items: $ref: "#/components/schemas/ProductImportError" required: - total - imported - valid - errors Coupon: type: object properties: id: type: string format: uuid code: type: string type: type: string enum: [percent, fixed] value: type: string startsAt: type: [string, "null"] format: date-time endsAt: type: [string, "null"] format: date-time maxUses: type: [integer, "null"] usedCount: type: integer minPurchase: type: string active: type: boolean createdAt: type: string format: date-time required: - id - code - type - value - startsAt - endsAt - maxUses - usedCount - minPurchase - active - createdAt CouponList: type: object properties: items: type: array items: $ref: "#/components/schemas/Coupon" total: type: integer page: type: integer limit: type: integer required: - items - total - page - limit CreateCouponInput: type: object properties: code: type: string minLength: 1 type: type: string enum: [percent, fixed] value: type: string startsAt: type: [string, "null"] format: date-time endsAt: type: [string, "null"] format: date-time maxUses: type: [integer, "null"] minimum: 1 minPurchase: type: string default: "0" active: type: boolean default: true required: - code - type - value UpdateCouponInput: type: object properties: code: type: string minLength: 1 type: type: string enum: [percent, fixed] value: type: string startsAt: type: [string, "null"] format: date-time endsAt: type: [string, "null"] format: date-time maxUses: type: [integer, "null"] minimum: 1 minPurchase: type: string active: type: boolean ReturnTicket: type: object properties: id: type: string format: uuid ticketNumber: type: integer orderId: type: string format: uuid userId: type: string format: uuid reason: type: [string, "null"] currentSize: type: [string, "null"] desiredSize: type: [string, "null"] photoPath: type: [string, "null"] status: type: string enum: [nueva, en_proceso, resuelta, cerrada] createdAt: type: string format: date-time required: - id - ticketNumber - orderId - userId - reason - currentSize - desiredSize - photoPath - status - createdAt AdminReturn: type: object properties: id: type: string format: uuid ticketNumber: type: integer orderId: type: string format: uuid orderNumber: type: integer customerName: type: [string, "null"] customerEmail: type: string customerPhone: type: [string, "null"] reason: type: [string, "null"] currentSize: type: [string, "null"] desiredSize: type: [string, "null"] photoPath: type: [string, "null"] status: type: string enum: [nueva, en_proceso, resuelta, cerrada] createdAt: type: string format: date-time required: - id - ticketNumber - orderId - orderNumber - customerName - customerEmail - customerPhone - reason - currentSize - desiredSize - photoPath - status - createdAt AdminReturnList: type: object properties: items: type: array items: $ref: "#/components/schemas/AdminReturn" total: type: integer page: type: integer limit: type: integer required: - items - total - page - limit CreateReturnInput: type: object properties: orderId: type: string format: uuid reason: type: [string, "null"] currentSize: type: [string, "null"] desiredSize: type: [string, "null"] photoPath: type: [string, "null"] required: - orderId UpdateReturnStatusInput: type: object properties: status: type: string enum: [nueva, en_proceso, resuelta, cerrada] required: - status AdminUser: type: object properties: id: type: string format: uuid email: type: string fullName: type: [string, "null"] phone: type: [string, "null"] role: type: string enum: [customer, employee, admin] blocked: type: boolean createdAt: type: string format: date-time required: - id - email - fullName - phone - role - blocked - createdAt AdminUserList: type: object properties: items: type: array items: $ref: "#/components/schemas/AdminUser" total: type: integer page: type: integer limit: type: integer required: - items - total - page - limit CreateEmployeeInput: type: object properties: email: type: string format: email fullName: type: [string, "null"] phone: type: [string, "null"] required: - email UpdateUserInput: type: object properties: fullName: type: [string, "null"] phone: type: [string, "null"] role: type: string enum: [customer, employee, admin] blocked: type: boolean PickupPoint: type: object properties: id: type: string format: uuid name: type: string address: type: string active: type: boolean createdAt: type: string format: date-time required: - id - name - address - active - createdAt PickupPointList: type: object properties: items: type: array items: $ref: "#/components/schemas/PickupPoint" required: - items CreatePickupPointInput: type: object properties: name: type: string minLength: 1 address: type: string minLength: 1 active: type: boolean default: true required: - name - address UpdatePickupPointInput: type: object properties: name: type: string minLength: 1 address: type: string minLength: 1 active: type: boolean Banner: type: object properties: path: type: string active: type: boolean required: - path - active PublicBanner: type: object properties: imageUrl: type: string required: - imageUrl HeroText: type: object properties: title: type: [string, "null"] subtitle: type: [string, "null"] required: - title - subtitle EditorialContent: type: object properties: tag: type: [string, "null"] title: type: [string, "null"] imagePath: type: [string, "null"] description: Storage object path of the editorial image required: - tag - title - imagePath PublicEditorialContent: type: object properties: tag: type: [string, "null"] title: type: [string, "null"] imageUrl: type: [string, "null"] description: Public URL of the editorial image required: - tag - title - imageUrl AdminConfig: type: object properties: deliveryFee: type: string description: Flat delivery fee for the store's coverage area, decimal string (e.g. "12.00") freeShippingThreshold: type: [string, "null"] description: Subtotal (decimal string) from which delivery is free; null disables it yapeNumber: type: [string, "null"] yapeQrPath: type: [string, "null"] description: Storage object path of the Yape QR image banners: type: array items: $ref: "#/components/schemas/Banner" hero: $ref: "#/components/schemas/HeroText" promoText: type: [string, "null"] description: Promo strip text shown under the hero; null hides nothing (store falls back) editorial: $ref: "#/components/schemas/EditorialContent" announcementText: type: [string, "null"] description: Top navbar announcement banner; null hides the banner contact: $ref: "#/components/schemas/ContactInfo" faq: type: array description: FAQ entries in render order; empty = store shows its defaults items: $ref: "#/components/schemas/FaqEntry" returnsPolicy: type: [string, "null"] description: Returns-policy page text; null = store shows its default legal: $ref: "#/components/schemas/LegalTexts" business: $ref: "#/components/schemas/BusinessIdentity" required: - deliveryFee - freeShippingThreshold - yapeNumber - yapeQrPath - banners - hero - promoText - editorial - announcementText - contact - faq - returnsPolicy - legal - business PublicConfig: type: object properties: deliveryFee: type: string freeShippingThreshold: type: [string, "null"] description: Subtotal (decimal string) from which delivery is free; null disables it yapeNumber: type: [string, "null"] yapeQrUrl: type: [string, "null"] description: Public URL of the Yape QR image banners: type: array items: $ref: "#/components/schemas/PublicBanner" hero: $ref: "#/components/schemas/HeroText" promoText: type: [string, "null"] editorial: $ref: "#/components/schemas/PublicEditorialContent" announcementText: type: [string, "null"] contact: $ref: "#/components/schemas/ContactInfo" faq: type: array items: $ref: "#/components/schemas/FaqEntry" returnsPolicy: type: [string, "null"] legal: $ref: "#/components/schemas/LegalTexts" business: $ref: "#/components/schemas/BusinessIdentity" required: - deliveryFee - freeShippingThreshold - yapeNumber - yapeQrUrl - banners - hero - promoText - editorial - announcementText - contact - faq - returnsPolicy - legal - business UpdateConfigInput: type: object properties: deliveryFee: type: string freeShippingThreshold: type: [string, "null"] yapeNumber: type: [string, "null"] yapeQrPath: type: [string, "null"] banners: type: array items: $ref: "#/components/schemas/Banner" hero: $ref: "#/components/schemas/HeroText" promoText: type: [string, "null"] editorial: $ref: "#/components/schemas/EditorialContent" announcementText: type: [string, "null"] contact: $ref: "#/components/schemas/ContactInfo" faq: type: array items: $ref: "#/components/schemas/FaqEntry" returnsPolicy: type: [string, "null"] legal: $ref: "#/components/schemas/LegalTexts" business: $ref: "#/components/schemas/BusinessIdentity" CreateComplaintInput: type: object description: Fields required on a Hoja de Reclamación by D.S. 011-2011-PCM. properties: type: type: string enum: [reclamo, queja] description: reclamo = disputes the product/service; queja = about how the customer was treated consumerName: type: string minLength: 1 consumerDocumentType: type: string enum: [dni, ce, pasaporte, ruc] consumerDocumentNumber: type: string minLength: 1 consumerEmail: type: string format: email consumerPhone: type: [string, "null"] consumerAddress: type: [string, "null"] isMinor: type: boolean default: false guardianName: type: [string, "null"] description: Required when isMinor is true — a minor cannot file on their own behalf itemType: type: string enum: [producto, servicio] itemDescription: type: string minLength: 1 itemAmount: type: [string, "null"] description: Amount claimed, decimal string (e.g. "150.00") orderId: type: [string, "null"] format: uuid detail: type: string minLength: 1 description: Detalle de la reclamación request: type: string minLength: 1 description: Pedido del consumidor — what they are asking the business to do required: - type - consumerName - consumerDocumentType - consumerDocumentNumber - consumerEmail - itemType - itemDescription - detail - request ComplaintReceipt: type: object description: Proof of filing handed back to the consumer, with the legal deadline. properties: id: type: string format: uuid code: type: string description: Human-facing correlativo, e.g. "LR-000001" complaintNumber: type: integer type: type: string enum: [reclamo, queja] status: type: string enum: [pendiente, en_proceso, resuelto, cerrado] consumerEmail: type: string dueAt: type: string format: date-time description: Legal deadline to respond (end of the 15th business day after filing, Lima time) createdAt: type: string format: date-time required: - id - code - complaintNumber - type - status - consumerEmail - dueAt - createdAt AdminComplaint: type: object properties: id: type: string format: uuid code: type: string complaintNumber: type: integer type: type: string enum: [reclamo, queja] consumerName: type: string consumerDocumentType: type: string enum: [dni, ce, pasaporte, ruc] consumerDocumentNumber: type: string consumerEmail: type: string consumerPhone: type: [string, "null"] consumerAddress: type: [string, "null"] isMinor: type: boolean guardianName: type: [string, "null"] itemType: type: string enum: [producto, servicio] itemDescription: type: string itemAmount: type: [string, "null"] orderId: type: [string, "null"] orderNumber: type: [integer, "null"] detail: type: string request: type: string status: type: string enum: [pendiente, en_proceso, resuelto, cerrado] response: type: [string, "null"] respondedAt: type: [string, "null"] format: date-time dueAt: type: string format: date-time daysRemaining: type: integer description: Business days left after today (0 on the due day); negative once the legal deadline has passed createdAt: type: string format: date-time required: - id - code - complaintNumber - type - consumerName - consumerDocumentType - consumerDocumentNumber - consumerEmail - consumerPhone - consumerAddress - isMinor - guardianName - itemType - itemDescription - itemAmount - orderId - orderNumber - detail - request - status - response - respondedAt - dueAt - daysRemaining - createdAt AdminComplaintList: type: object properties: items: type: array items: $ref: "#/components/schemas/AdminComplaint" total: type: integer page: type: integer limit: type: integer required: - items - total - page - limit UpdateComplaintInput: type: object properties: status: type: string enum: [pendiente, en_proceso, resuelto, cerrado] response: type: [string, "null"] description: Acciones adoptadas por el proveedor, sent to the consumer by email required: - status RecordConsentInput: type: object properties: purpose: type: string enum: [pedido, marketing, cookies_analytics, cookies_marketing] granted: type: boolean policyVersion: type: string minLength: 1 description: Which version of the text was shown; pins what was actually agreed to email: type: [string, "null"] required: - purpose - granted - policyVersion LegalTexts: type: object description: Editable legal copy. Kept as configuration so a rebrand is not a code change. properties: privacyPolicy: type: [string, "null"] termsOfService: type: [string, "null"] cookiePolicy: type: [string, "null"] policyVersion: type: string description: Bumped whenever the texts change; stamped onto every consent record required: - privacyPolicy - termsOfService - cookiePolicy - policyVersion BusinessIdentity: type: object description: > Provider identity. Required to be visible to consumers, and stamped onto every Hoja de Reclamación as the "identificación del proveedor". properties: legalName: type: [string, "null"] description: Razón social tradeName: type: [string, "null"] description: Nombre comercial ruc: type: [string, "null"] fiscalAddress: type: [string, "null"] description: Domicilio fiscal required: - legalName - tradeName - ruc - fiscalAddress ContactInfo: type: object description: Store contact channels; null/empty link hides that channel in the UI properties: whatsappNumber: type: [string, "null"] description: Digits only, international format without "+" (e.g. "51999999999") instagramUrl: type: [string, "null"] tiktokUrl: type: [string, "null"] required: - whatsappNumber - instagramUrl - tiktokUrl FaqEntry: type: object properties: question: type: string answer: type: string required: - question - answer TopProduct: type: object properties: productName: type: string quantity: type: integer revenue: type: [string, "null"] description: >- Total revenue for this product in the period (money). Null on the dashboard of a caller without the admin role: employees see what sells, not how much it brings in. required: - productName - quantity - revenue DashboardKpi: type: object properties: salesToday: type: string description: Revenue from orders approved today (money) salesTodayDeltaPct: type: [number, "null"] description: Percent change vs yesterday; null when yesterday had no sales ordersToday: type: integer ordersTodayDelta: type: integer description: Change in order count vs yesterday avgTicket: type: string description: Average paid-order value in the last 30 days (money) required: - salesToday - salesTodayDeltaPct - ordersToday - ordersTodayDelta - avgTicket DashboardAlerts: type: object properties: pendingPayments: type: integer abandonedCarts: type: integer description: Carts with items untouched for > 24h and never converted lowStock: type: integer description: Active variants with stock below the low-stock threshold newReturns: type: integer required: - pendingPayments - abandonedCarts - lowStock - newReturns DashboardSummary: type: object properties: kpis: description: >- Sales figures for the day. Null for a caller without the admin role: the role matrix keeps financial figures from employees, and hiding them in the panel would not stop them from travelling in the response. oneOf: - $ref: "#/components/schemas/DashboardKpi" - type: "null" alerts: $ref: "#/components/schemas/DashboardAlerts" topProducts: type: array description: Best sellers over the last 7 days items: $ref: "#/components/schemas/TopProduct" required: - kpis - alerts - topProducts SalesByDay: type: object properties: date: type: string description: ISO date YYYY-MM-DD revenue: type: string orders: type: integer required: - date - revenue - orders AbandonedCarts: type: object properties: count: type: integer value: type: string description: Total cart value at risk (money) recoverable: type: integer description: Abandoned carts whose owner has an email on file required: - count - value - recoverable SalesReport: type: object properties: from: type: string description: ISO date YYYY-MM-DD to: type: string description: ISO date YYYY-MM-DD orders: type: integer revenue: type: string avgTicket: type: string unitsSold: type: integer cartConversionRate: type: [number, "null"] description: >- Funnel proxy = paid orders / distinct carts that held items in the period. Web traffic/visits are not tracked yet, so this is not a visit-based conversion rate. salesByDay: type: array items: $ref: "#/components/schemas/SalesByDay" topProducts: type: array items: $ref: "#/components/schemas/TopProduct" abandonedCarts: $ref: "#/components/schemas/AbandonedCarts" required: - from - to - orders - revenue - avgTicket - unitsSold - cartConversionRate - salesByDay - topProducts - abandonedCarts CreateStockAlertInput: type: object properties: variantId: type: string format: uuid email: type: [string, "null"] format: email description: Required for guests; authenticated callers default to their profile email required: - variantId ConfigMediaUploadInput: type: object properties: contentType: type: string description: MIME type of the file to upload (informational) ConfigMediaUploadUrl: type: object properties: uploadUrl: type: string description: PUT the file to this URL (direct to public Storage) path: type: string description: Storage object path; send back in yapeQrPath or a banner token: type: string publicUrl: type: string description: Public read URL for the uploaded object required: - uploadUrl - path - token - publicUrl NotificationDelivery: type: object description: > One outbox record. `bodyHtml` is deliberately NOT exposed: the rendered message holds the customer's name, address and order contents, and the backoffice list does not need it to answer "did this go out". properties: id: type: string format: uuid channel: type: string enum: [email] kind: type: string description: Which notification this is (payment_approved, complaint_filed, ...) recipient: type: string subject: type: string relatedType: type: string nullable: true relatedId: type: string format: uuid nullable: true status: type: string enum: [pendiente, enviado, fallido] attempts: type: integer lastError: type: string nullable: true nextAttemptAt: type: string format: date-time nullable: true sentAt: type: string format: date-time nullable: true createdAt: type: string format: date-time required: - id - channel - kind - recipient - subject - status - attempts - createdAt NotificationDeliveryList: type: object properties: items: type: array items: $ref: "#/components/schemas/NotificationDelivery" required: - items OpsSnapshot: type: object properties: verificationQueue: type: object description: The manual payment queue. Waiting time here is what customers feel. properties: pending: type: integer oldestWaitingHours: type: number nullable: true description: Null when the queue is empty — not zero, which would read as "instant" required: - pending - oldestWaitingHours payments7d: type: object description: Resolved payments over the last 7 days, from the payment_events history. properties: approved: type: integer rejected: type: integer expired: type: integer approvalRatePct: type: number nullable: true description: Null when nothing was resolved; no honest ratio exists over zero required: - approved - rejected - expired - approvalRatePct notifications: type: object properties: pending: type: integer failed: type: integer oldestPendingMinutes: type: number nullable: true required: - pending - failed - oldestPendingMinutes database: type: object description: > Connection pool of THIS instance only. Behind a load balancer each instance has its own pool, so these numbers describe the process that answered the request, not the deployment. Useful for spotting exhaustion; not a cluster-wide metric. properties: poolTotal: type: integer poolIdle: type: integer poolWaiting: type: integer required: - poolTotal - poolIdle - poolWaiting required: - verificationQueue - payments7d - notifications - database