LBLetBuyy DevelopersAPI reference
HomeAPIOAuthWebhooksSDKsDashboard

API reference

Current source-backed gateway, commerce, app marketplace, theme package, and webhook surfaces. Missing OpenAPI generation remains explicitly skipped.

Gateway Rules

Current gateway behavior from services/api-gateway/src/index.ts.

  • The public gateway mounts API routes under /v1 and exposes /health plus /v1/health.
  • Global middleware sets security headers, request IDs, input validation, sanitized errors, observability, CORS, API versioning, query-cost rate limits, auth middleware, CSRF protection, and standard rate limits.
  • Public /v1 routes currently include auth, contacts, storefront, themes, app-store, and internal console. Most commerce mutations remain protected by merchant auth and CSRF.
  • CORS exposes X-Request-ID, X-Trace-ID, X-RateLimit-* headers, X-LetBuyy-API-Version, and X-Response-Time.

Gateway Response Contracts

Common success, pagination, error, and correlation header behavior from the current gateway helpers.

Response caseCurrent shapeDeveloper handlingSource
Standard success envelope{ success: true, data, ...meta }Use data as the payload. Extra top-level metadata can appear when a route passes helper metadata.services/api-gateway/src/lib/supabase.ts:32
Paginated success envelope{ success: true, data, meta: { page, per_page, total, total_pages, has_next, has_prev } }Read list navigation from meta; page and limit come from route query validation where present.services/api-gateway/src/lib/supabase.ts:39
Helper error envelope{ success: false, error: { code, message, status } }Use HTTP status as authority and read error.code for programmatic branching.services/api-gateway/src/lib/supabase.ts:58
Compatibility error bodies{ error: { code, message } } or { success: false, error: { code, message } }Some helpers omit success, so clients should branch on the error object and status instead of relying only on success=false.services/api-gateway/src/lib/supabase.ts:70
Typed application errors{ error: { code, message, details? } } with the AppError status codeKnown validation, not-found, forbidden, conflict, and stock errors are sanitized by the global handler.services/api-gateway/src/lib/errors.ts:66 + services/api-gateway/src/index.ts:233
Unexpected internal errors{ error: { code: "INTERNAL_ERROR", message: "An internal error occurred", request_id } }Full details stay server-side; use request_id for support and trace correlation.services/api-gateway/src/index.ts:238
Request correlation headersX-Request-ID, X-Trace-ID, X-RateLimit-*, X-LetBuyy-API-Version, X-Response-TimeSend X-Request-ID for deterministic tracing; the gateway creates one if absent and exposes it through CORS.services/api-gateway/src/index.ts:149 + services/api-gateway/src/middleware/security.ts:282

Gateway Route Groups

Mounted /v1 route groups and Hono route counts from the current worker source. Counts are router declarations, not generated OpenAPI operations.

SurfaceMountAccessRoutesCurrent scopeSource
Auth/v1/authPublic mount with auth rate limit23Custom session, signup/signin, OTP, password, trusted device, and token helpers.services/api-gateway/src/index.ts:178 + routes/auth.ts
Contacts/v1/contactsPublic2Public contact submission and retrieval helpers.services/api-gateway/src/index.ts:179 + routes/contacts.ts
Storefront/v1/storefrontPublic57Tenant lookup, public catalog, checkout payment starts/verifications, customer account, reviews, pages, policies, blog, and contact flows.services/api-gateway/src/index.ts:180 + routes/storefront.ts
Themes/v1/themesPublic mount with merchant flows18Catalog, theme schema, editor draft/publish, preview sessions, package upload, and install flows.services/api-gateway/src/index.ts:181 + routes/themes.ts
App marketplace/v1/app-storePublic mount with merchant/app token flows22Marketplace listing, OAuth, installs, bridge fetch, developer registration, submissions, charges, and partner dashboard surfaces.services/api-gateway/src/index.ts:182 + routes/app-store.ts
Internal console/v1/internal/consoleInternal token9Internal console bootstrap and platform-console helper endpoints.services/api-gateway/src/index.ts:183 + routes/internal-console.ts
Stores/v1/storesProtected merchant session + CSRF10Store listing, handle lookup, create/update/publish/delete, and payment config.services/api-gateway/src/index.ts:191 + routes/stores.ts
Products/v1/productsProtected merchant session + CSRF10Products, collections, gift cards, create/update/delete, and bulk product actions.services/api-gateway/src/index.ts:192 + routes/products.ts
Orders/v1/ordersProtected merchant session + CSRF7Order list/detail, status updates, creation, fulfillment, refund request, and refund completion.services/api-gateway/src/index.ts:193 + routes/orders.ts
Payments/v1/paymentsProtected merchant session + CSRF9Plans, subscription state/history, subscription order/verify/cancel, Razorpay, and Stripe checkout.services/api-gateway/src/index.ts:194 + routes/payments.ts
Uploads/v1/uploadProtected merchant session + CSRF2Upload helpers for merchant runtime assets.services/api-gateway/src/index.ts:195 + routes/upload.ts
Portfolio/v1/portfolioProtected merchant session + CSRF; legacy site types only4Legacy portfolio content for existing sites. New portfolio acquisition is gated by LETBUYY_ENABLE_LEGACY_SITE_TYPES.services/api-gateway/src/index.ts:196 + routes/portfolio.ts
Resume/v1/resumeProtected merchant session + CSRF; legacy site types only10Legacy resume profile, experience, education, skills, projects, and related page data for existing sites. New resume acquisition is gated by LETBUYY_ENABLE_LEGACY_SITE_TYPES.services/api-gateway/src/index.ts:197 + routes/resume.ts
Employees/v1/employeesProtected merchant session + CSRF10Employee records, invitations, permissions, and team management.services/api-gateway/src/index.ts:198 + routes/employee.ts
Admin/v1/adminProtected merchant session + CSRF12Admin dashboard, metrics, and operational merchant helper endpoints.services/api-gateway/src/index.ts:199 + routes/admin.ts
Blog/v1/blogProtected merchant session + CSRF13Blog posts, categories, tags, publishing, and content management.services/api-gateway/src/index.ts:200 + routes/blog.ts
Customers/v1/customersProtected merchant session + CSRF6Customer list/detail and customer address CRUD by email.services/api-gateway/src/index.ts:201 + routes/customers.ts
Notifications/v1/notificationsProtected merchant session + CSRF9Notification preferences, templates, sending, and inbox-style state.services/api-gateway/src/index.ts:202 + routes/notifications.ts
Media/v1/mediaProtected merchant session + CSRF4Media list, create, update, and delete operations.services/api-gateway/src/index.ts:203 + routes/media.ts
AI/v1/aiProtected merchant session + CSRF5Merchant AI helper endpoints.services/api-gateway/src/index.ts:204 + routes/ai.ts
Export/v1/exportProtected merchant session + CSRF3Export job helpers.services/api-gateway/src/index.ts:205 + routes/export.ts
Shipping and tax/v1/shipping-taxProtected merchant session + CSRF12Shipping zones, shipping rates, and tax rates.services/api-gateway/src/index.ts:206 + routes/shipping-tax.ts
Onboarding/v1/onboardingProtected merchant session + CSRF6Merchant onboarding progress and setup steps.services/api-gateway/src/index.ts:207 + routes/onboarding.ts
Inventory/v1/inventoryProtected merchant session + CSRF15Locations, suppliers, purchase orders, transfers, levels, adjustments, bulk adjustments, and history.services/api-gateway/src/index.ts:208 + routes/inventory.ts
Coupons/v1/couponsProtected merchant session + CSRF6Coupon list/create/detail/update/delete and validation.services/api-gateway/src/index.ts:209 + routes/coupons.ts
Categories/v1/categoriesProtected merchant session + CSRF5Category list/create/detail/update/delete.services/api-gateway/src/index.ts:210 + routes/categories.ts
Analytics/v1/analyticsProtected merchant session + CSRF4Dashboard, revenue, top products, and order analytics.services/api-gateway/src/index.ts:211 + routes/analytics.ts
Reviews/v1/reviewsProtected merchant session + CSRF3Product review list, moderation update, and delete operations.services/api-gateway/src/index.ts:212 + routes/reviews.ts
Form submissions/v1/form-submissionsProtected merchant session + CSRF3Form submission list, status update, and delete operations.services/api-gateway/src/index.ts:213 + routes/form-submissions.ts
Pages/v1/pagesProtected merchant session + CSRF10Pages, policies, navigation replacement, page updates, and deletes.services/api-gateway/src/index.ts:214 + routes/pages.ts
Operations/v1/operationsProtected merchant session + CSRF44Platform operations workflows and support tooling.services/api-gateway/src/index.ts:215 + routes/operations.ts

Schema Facades

Gateway schema modules and their canonical package sources. These are source exports, not generated OpenAPI definitions.

FacadeRoute surfaceCanonical sourceCurrent exportsPortal guidanceSource
auth.schema.ts/v1/auth@letbuyy/auth-coreSignUp, SignIn, OTP request/verify, password reset/update, auth token helpers, and customer federation token helpers.Auth request validation is centralized in auth-core and exposed through the gateway facade; the developer portal should not invent extra login/session fields.services/api-gateway/src/schemas/auth.schema.ts:1
store.schema.ts/v1/stores@letbuyy/shared-types + @letbuyy/tenant-coreStore contract, site type/status, reserved subdomains, subdomain validation, create/update store, and payment config schemas.Store-facing docs should say store in UI but keep source truth tied to site ownership and tenant-core validation.services/api-gateway/src/schemas/store.schema.ts:1
product.schema.ts/v1/products@letbuyy/shared-types + @letbuyy/commerce-coreProduct, collection, option, variant contracts plus create, update, list query, and bulk action schemas.Product endpoint docs can cite real create/update/list/bulk validators, but field-level generated OpenAPI is not present.services/api-gateway/src/schemas/product.schema.ts:1
customer.schema.ts/v1/customers@letbuyy/shared-types + @letbuyy/commerce-coreCustomer and address contracts plus create, update, create address, and list query schemas.Customer docs should stay store-scoped and use the commerce-core customer/address request contracts.services/api-gateway/src/schemas/customer.schema.ts:1
order.schema.ts/v1/orders, /v1/payments, /v1/storefront@letbuyy/shared-types + @letbuyy/checkout-coreCart, line item, order, payment contracts plus storefront checkout, provider payment, fulfillment, refund, order status, and list schemas.Checkout and payment examples must reflect server-side order/payment schemas and provider verification contracts, not client-submitted totals.services/api-gateway/src/schemas/order.schema.ts:1
coupon.schema.ts/v1/coupons and storefront coupon validation@letbuyy/shared-types + @letbuyy/checkout-coreCoupon contract plus create, validate, and list query schemas.Coupon docs can cover create/list/validate shape at a high level, while generated request examples remain skipped until tooling exists.services/api-gateway/src/schemas/coupon.schema.ts:1
theme.schema.ts/v1/themes@letbuyy/shared-types + @letbuyy/theme-engineTheme, bundle, section, block, template contracts plus slug, store query, install, draft, publish, preview, rollback, upload, and purchase schemas.Theme SDK docs should treat the JSON-contract bundle and upload route as real; npm SDK and CLI remain planned.services/api-gateway/src/schemas/theme.schema.ts:1
operations.schema.ts/v1/operations@letbuyy/event-coreOutbox, webhook delivery dispatch, queue jobs, review decisions, webhook subscriptions, usage, runtime replay/recovery, incident, readiness, and certification schemas.Operational webhook subscription schemas exist, but public developer webhook management UI and sender tooling are still skipped.services/api-gateway/src/schemas/operations.schema.ts:1

Commerce Endpoint Highlights

Protected merchant-session commerce, inventory, customer, order, and payment routes.

MethodRouteAuthStatusCurrent behaviorSource
GET/v1/productsmerchant sessionAVAILABLELists products for owned stores with pagination, store_id, category, status, search, sort, and order filters.services/api-gateway/src/routes/products.ts:119
POST/v1/productsmerchant sessionAVAILABLECreates a product through ProductExecutionAdapter after resolving the merchant profile and owned store context.services/api-gateway/src/routes/products.ts:387
PATCH/v1/products/:idmerchant sessionAVAILABLEUpdates an owned product and emits product.updated.services/api-gateway/src/routes/products.ts:411
POST/v1/products/bulkmerchant sessionAVAILABLERuns bulk activate, deactivate, or delete actions for product IDs in an owned store.services/api-gateway/src/routes/products.ts:435
GET/v1/ordersmerchant sessionAVAILABLELists orders for owned stores with pagination, status, payment_status, search, sort, and order filters.services/api-gateway/src/routes/orders.ts:230
POST/v1/ordersmerchant sessionAVAILABLECreates a merchant-side order with server-side price calculation and idempotency.services/api-gateway/src/routes/orders.ts:389
PATCH/v1/orders/:idmerchant sessionAVAILABLETransitions order status through the order execution adapter with an idempotency claim.services/api-gateway/src/routes/orders.ts:340
POST/v1/orders/:id/fulfillmerchant sessionAVAILABLECreates fulfillment records and emits order.fulfilled for an owned order.services/api-gateway/src/routes/orders.ts:449
POST/v1/orders/:id/refundmerchant sessionAVAILABLECreates a return and refund intent instead of marking provider success directly.services/api-gateway/src/routes/orders.ts:540
GET/v1/customersmerchant sessionAVAILABLEBuilds store-scoped customer summaries from store customer rows and order rows.services/api-gateway/src/routes/customers.ts:113
POST/v1/customers/:email/addressesmerchant sessionAVAILABLEAdds a saved customer address after verifying store ownership.services/api-gateway/src/routes/customers.ts:231
GET/v1/inventory/levelsmerchant sessionAVAILABLELists inventory levels for owned stores with product_id, low_stock, page, and limit filters.services/api-gateway/src/routes/inventory.ts:557
POST/v1/inventory/adjustmerchant sessionAVAILABLEAdjusts inventory for an owned product through the inventory ledger RPC.services/api-gateway/src/routes/inventory.ts:645
GET/v1/payments/plansmerchant sessionAVAILABLEReturns active subscription plans filtered by site_type and optional slug.services/api-gateway/src/routes/payments.ts:263
POST/v1/payments/razorpay/ordermerchant sessionAVAILABLECreates a Razorpay order for an owned payable order after amount verification and idempotency.services/api-gateway/src/routes/payments.ts:651
POST/v1/payments/razorpay/verifymerchant sessionAVAILABLEVerifies Razorpay signature, prevents double-payment, confirms payment, and emits order paid state.services/api-gateway/src/routes/payments.ts:750
POST/v1/payments/stripe/checkoutmerchant sessionAVAILABLECreates a Stripe checkout session for an owned payable order and records the Stripe session reference.services/api-gateway/src/routes/payments.ts:843

Storefront Endpoint Highlights

Public storefront lookup, catalog, checkout, payment, content, and review routes.

MethodRouteAuthStatusCurrent behaviorSource
GET/v1/storefront/lookuppublicAVAILABLELooks up a store by handle or subdomain for routing and search surfaces.services/api-gateway/src/routes/storefront.ts:1195
GET/v1/storefront/directorypublicAVAILABLEReturns public discovery stores and aggregate counts for stores, themes, products, and orders.services/api-gateway/src/routes/storefront.ts:1256
GET/v1/storefront/store/:storeIdpublicAVAILABLELoads published store data by immutable store ID and includes current theme release plus public app blocks.services/api-gateway/src/routes/storefront.ts:1299
GET/v1/storefront/:subdomainpublicAVAILABLELoads published store data by subdomain and includes current theme release plus public app blocks.services/api-gateway/src/routes/storefront.ts:1529
GET/v1/storefront/:subdomain/statuspublicAVAILABLEReturns limited status data for draft, published, suspended, or coming-soon routing.services/api-gateway/src/routes/storefront.ts:1545
POST/v1/storefront/:subdomain/orderspublicAVAILABLECreates a storefront checkout order after resolving tenant ownership by subdomain; client store IDs and totals are ignored.services/api-gateway/src/routes/storefront.ts:1566
POST/v1/storefront/:subdomain/payments/razorpay/orderpublicAVAILABLECreates a Razorpay payment order for a storefront order after reloading the payable order amount.services/api-gateway/src/routes/storefront.ts:1664
POST/v1/storefront/:subdomain/payments/razorpay/verifypublicAVAILABLEVerifies Razorpay storefront payment signature before confirming payment state.services/api-gateway/src/routes/storefront.ts:1784
GET/v1/storefront/:subdomain/productspublicAVAILABLELists public products for a published store with page, limit, category, and search filters.services/api-gateway/src/routes/storefront.ts:2474
GET/v1/storefront/:subdomain/products/:slugpublicAVAILABLELoads a single active product by slug or UUID and records a storefront view.services/api-gateway/src/routes/storefront.ts:2510
GET/v1/storefront/:subdomain/coupons/validatepublicAVAILABLEValidates an active coupon against a storefront subtotal and minimum-order rules.services/api-gateway/src/routes/storefront.ts:2531
GET/v1/storefront/:subdomain/categoriespublicAVAILABLELists visible product categories for a published store.services/api-gateway/src/routes/storefront.ts:2587
GET/v1/storefront/:subdomain/navigationpublicAVAILABLELoads a public navigation menu by normalized location token.services/api-gateway/src/routes/storefront.ts:2596
GET/v1/storefront/:subdomain/pagespublicAVAILABLELists published storefront pages for the resolved store.services/api-gateway/src/routes/storefront.ts:2617
GET/v1/storefront/:subdomain/policiespublicAVAILABLELists storefront policy pages for the resolved store.services/api-gateway/src/routes/storefront.ts:2633
GET/v1/storefront/reviewspublicAVAILABLELists public approved product reviews through the storefront review query schema.services/api-gateway/src/routes/storefront.ts:1382

Payment and Idempotency Contracts

Implemented order, payment, amount verification, provider verification, and retry behavior from the current gateway.

SurfaceCurrent contractDeveloper handlingSource
Protected order mutationsPATCH /v1/orders/:id plus order create, fulfill, refund, and refund-complete routes begin an IdempotencyExecutionAdapter claim with idempotency_key and replay stored responses.Send a stable idempotency_key for each retryable mutation. Keys are validated at 8-200 characters by checkout-core schemas.services/api-gateway/src/routes/orders.ts:345 + packages/checkout-core/src/index.ts:26
Protected order creation price authorityPOST /v1/orders accepts product/variant IDs, quantity, shipping, coupon, gift-card, and payment method fields; the route delegates creation to the order execution adapter instead of accepting client totals.Do not send totals as authority. The gateway/service path owns order pricing and emits order.created after creation.services/api-gateway/src/routes/orders.ts:387 + packages/checkout-core/src/index.ts:26
Protected Razorpay order startPOST /v1/payments/razorpay/order loads the payable order, computes minor units from order.total, rejects AMOUNT_MISMATCH when a client amount hint differs, and stores an idempotent payment order response.Treat amount and amount_minor_units as optional consistency hints only; refresh checkout on AMOUNT_MISMATCH.services/api-gateway/src/routes/payments.ts:673
Protected Razorpay verificationPOST /v1/payments/razorpay/verify checks order ownership, blocks already-paid orders, validates the HMAC payload razorpay_order_id|razorpay_payment_id, and confirms payment with idempotency_key.Submit provider IDs, signature, order_id, and idempotency_key; handle CONFLICT when the payment is already verified or the reference mismatches.services/api-gateway/src/routes/payments.ts:773
Protected Stripe checkoutPOST /v1/payments/stripe/checkout loads the payable order, derives the Stripe amount from order.total, passes idempotency_key to the Stripe adapter, and stores the payment reference.Use the returned session URL/ID and do not derive payable totals in the client.services/api-gateway/src/routes/payments.ts:842
Storefront provider startsStorefront Razorpay, Cashfree, Stripe, and PayPal start routes load the published store order, require supported INR amounts, create provider intents, and complete idempotency claims.Pass idempotencyKey and orderId. Provider-specific response fields are real, but public SDK wrappers are still [SKIP — NEEDS BACKEND/SDK].services/api-gateway/src/routes/storefront.ts:1663 + :1901 + :2145 + :2250
Storefront amount mismatchStorefront Razorpay and Cashfree starts accept optional amount hints and reject mismatches against the server-computed amount with AMOUNT_MISMATCH.Use amount hints for stale-checking only; rebuild the checkout from the latest order payload when the gateway rejects a mismatch.services/api-gateway/src/routes/storefront.ts:1697 + :1936
Storefront provider verification and captureStorefront Razorpay verification, Cashfree verification, and PayPal capture use idempotencyKey, check provider references, confirm payment, emit order paid, and replay completed responses.Keep provider reference IDs bound to the order and retry verification/capture with the same idempotencyKey after transient provider failures.services/api-gateway/src/routes/storefront.ts:1816 + :2063 + :2394
Checkout schema key casingProtected merchant order/payment schemas use idempotency_key; storefront schemas use idempotencyKey for order, provider start, verify, checkout, and capture flows.Match the exact route casing. The portal should not normalize casing for developers until an SDK layer exists.packages/checkout-core/src/index.ts:26 + :69 + :84 + :92 + :105

App Platform Endpoints

Marketplace, install, OAuth, app bridge, developer, and dashboard routes.

MethodRouteAuthStatusCurrent behaviorSource
GET/v1/app-store/categoriespublicAVAILABLELists active app categories.services/api-gateway/src/routes/app-store.ts:460
GET/v1/app-store/appspublicAVAILABLELists published marketplace apps with category, search, pricing, site_type, sort, page, and limit filters.services/api-gateway/src/routes/app-store.ts:475
GET/v1/app-store/apps/:idpublicAVAILABLEGets a published app by UUID or slug with developer, category, and extension records.services/api-gateway/src/routes/app-store.ts:524
POST/v1/app-store/apps/:id/oauth/authorizemerchant sessionAVAILABLEInstalls or authorizes a published app, validates requested scopes and redirect_uri, creates webhook subscriptions, emits app.installed, and returns a 15-minute authorization code.services/api-gateway/src/routes/app-store.ts:1140
POST/v1/app-store/oauth/tokenpublicAVAILABLEExchanges grant_type=authorization_code with PKCE code_verifier, or grant_type=refresh_token with a rotated refresh token, for a scoped Bearer token.services/api-gateway/src/routes/app-store.ts:1312
POST/v1/app-store/oauth/token-exchangemerchant sessionAVAILABLEExchanges an authenticated merchant session and installation_id for a 15-minute embedded app token.services/api-gateway/src/routes/app-store.ts:1400
POST/v1/app-store/installations/:id/embed-sessionmerchant sessionAVAILABLEMints a 15-minute app bridge session for an installed admin embed surface.services/api-gateway/src/routes/app-store.ts:682
POST/v1/app-store/bridge/fetchapp bearerPARTIALProxies scoped GET reads for embedded apps. Allowed first segments map to read_products, read_orders, read_customers, read_themes, and read_storefront.services/api-gateway/src/routes/app-store.ts:781
GET/v1/app/productsapp bearer: read_productsAVAILABLELists products for the installed app token's store. A mismatched store_id is rejected instead of broadening access.services/api-gateway/src/routes/app-api.ts:152
GET/v1/app/ordersapp bearer: read_ordersAVAILABLELists orders for the installed app token's store. A mismatched store_id is rejected instead of broadening access.services/api-gateway/src/routes/app-api.ts:209
PATCH/v1/app/installation/metadataapp bearer: write_app_metadataAVAILABLEUpdates non-secret metadata owned by the active app installation without mutating merchant product, order, customer, or theme records.services/api-gateway/src/routes/app-api.ts:271
POST/v1/app-store/apps/:id/installmerchant sessionAVAILABLEInstalls an app directly, mints an app token, subscribes webhooks, and dispatches app.installed.services/api-gateway/src/routes/app-store.ts:1477
DELETE/v1/app-store/apps/:id/installmerchant sessionAVAILABLEUninstalls an app, revokes stored OAuth config, disables app webhook subscriptions, and dispatches app.uninstalled.services/api-gateway/src/routes/app-store.ts:1648
GET/v1/app-store/developers/memerchant sessionAVAILABLEReturns the current user's developer profile if registered.services/api-gateway/src/routes/app-store.ts:1758
POST/v1/app-store/developers/registermerchant sessionAVAILABLERegisters the current user as an app developer with company_name and support_email.services/api-gateway/src/routes/app-store.ts:1781
GET/v1/app-store/developers/appsmerchant sessionAVAILABLELists current developer profile, submitted apps, and review records.services/api-gateway/src/routes/app-store.ts:1813
POST/v1/app-store/developers/apps/manifest/validatemerchant sessionAVAILABLEValidates a LetBuyy app manifest against app-engine, returning normalized extension and function registration plans without creating an app.services/api-gateway/src/routes/app-store/developer-routes.ts
POST/v1/app-store/developers/appsmerchant sessionAVAILABLESubmits a marketplace app for review after developer registration, optional Built-for-LetBuyy quality gate checks, optional manifest persistence, and show-once hash-only credential issuance.services/api-gateway/src/routes/app-store.ts:2085
POST/v1/app-store/developers/apps/:id/api-keymerchant sessionAVAILABLERotates a show-once developer API key for an app owned by the current developer profile; plaintext is returned once and only hashes are persisted.services/api-gateway/src/routes/app-store/developer-routes.ts

Theme Platform Endpoints

Theme catalog, editor, package upload, preview, and install routes.

MethodRouteAuthStatusCurrent behaviorSource
GET/v1/themespublicAVAILABLELists active themes with category, site_type, pricing, industry, search, sort, page, and limit filters.services/api-gateway/src/routes/themes.ts:119
GET/v1/themes/:slug/schemapublicAVAILABLEReturns editable schemas for a theme.services/api-gateway/src/routes/themes.ts:330
GET/v1/themes/:slug/editormerchant sessionAVAILABLELoads store-scoped theme editor state using store_id.services/api-gateway/src/routes/themes.ts:338
PUT/v1/themes/:slug/editor/draftmerchant sessionAVAILABLESaves a store-scoped theme draft with Zod validation from @letbuyy/theme-engine.services/api-gateway/src/routes/themes.ts:362
POST/v1/themes/:slug/publishmerchant sessionAVAILABLEPublishes a saved draft to the live store theme config.services/api-gateway/src/routes/themes.ts:400
POST/v1/themes/:slug/preview-sessionmerchant sessionAVAILABLECreates a signed draft preview token.services/api-gateway/src/routes/themes.ts:414
POST/v1/themes/packages/uploadmerchant sessionAVAILABLEValidates and persists a portable JSON-contract theme bundle, then creates a marketplace review record unless private_install is requested.services/api-gateway/src/routes/themes.ts:467
POST/v1/themes/:slug/installmerchant sessionAVAILABLEInstalls or applies a theme to a store.services/api-gateway/src/routes/themes.ts:566

Webhook Service Endpoints

Developer-facing callback contract plus internal dispatch routes.

MethodRouteAuthStatusCurrent behaviorSource
POSThttps://webhooks.letbuyy.store/app-lifecycle/dispatchinternalAVAILABLEInternal gateway-to-webhook-service route that signs and dispatches app lifecycle callbacks.services/webhook-service/src/index.ts:748
POSThttps://webhooks.letbuyy.store/webhook-deliveries/dispatchinternalAVAILABLEInternal dispatcher for queued webhook delivery rows with retry scheduling.services/webhook-service/src/index.ts:842
POSTPartner HTTPS callback URLHMAC signatureAVAILABLELetBuyy sends app lifecycle and queued webhooks with X-LetBuyy-Hmac-SHA256, X-LetBuyy-Timestamp, event ID, event type, request ID, and trace ID headers.services/webhook-service/src/app-lifecycle-dispatch.ts:86
Validation Contracts

Request Shape Notes

Route helper and package schema facts that are currently implemented.

Developer registration request

packages/app-engine/src/index.ts:721
AVAILABLE
  • Required body fields: company_name and support_email.
  • Optional aliases/fields: contact_email, website_url or website, description or bio, and country.
  • company_name is slugified; the route returns 409 if the account or company already has a developer profile.
  • New developer profiles are created with status=pending, verified=false, and default country IN when country is absent.

Marketplace app submission request

packages/app-engine/src/index.ts:753
AVAILABLE
  • Required body fields: name, tagline, description, category_id, app_url, and privacy_url or privacy_policy_url.
  • slug is optional; when absent it is generated from name. save_as_draft=true creates draft, otherwise status becomes in_review.
  • pricing_model defaults to free. price_monthly is normalized into price_inr.
  • The route checks slug conflicts before inserting marketplace_apps and creates a marketplace review record for non-draft submissions.

Built-for-LetBuyy quality gate

packages/app-engine/src/index.ts:666
AVAILABLE
  • Quality evidence may arrive as quality_gate, built_for_letbuyy, or builtForLetBuyy.
  • Checks require performance score >= 70, at least one review with 4.0+ rating, at least one install, at least one storefront app block, and HTTPS app/privacy URLs.
  • Localhost HTTP is allowed only for local testing URL validation.
  • When quality evidence is present on a non-draft app and one or more checks fail, submission returns a validation error listing failed check keys.

OAuth and app token lifetimes

services/api-gateway/src/routes/app-store.ts:1225
AVAILABLE
  • Authorization codes expire after 15 minutes and are stored only as hashes in app_installations.config with the PKCE S256 code challenge.
  • POST /v1/app-store/oauth/token requires code_verifier, blocks replay by marking authorization_code.redeemed_at, and stores only token hashes.
  • POST /v1/app-store/oauth/token with grant_type=refresh_token rotates the stored refresh_token_hash and returns a new app Bearer token.
  • POST /v1/app-store/oauth/token-exchange mints a 15-minute embedded app token from a merchant session and installation_id.
  • Direct install currently returns a Bearer app token with a one-hour expires_at value.

App bridge fetch limits

services/api-gateway/src/routes/app-store.ts:262
PARTIAL
  • Only method=GET is accepted; mutation bridge calls are not implemented.
  • Absolute URLs, parent path traversal, double slashes, and mismatched store_id values are rejected.
  • Allowed first path segments are products, orders, customers, themes, and storefront.
  • Required scopes map to read_products, read_orders, read_customers, read_themes, and read_storefront.

Scoped app API

services/api-gateway/src/routes/app-api.ts:1
AVAILABLE
  • App bearer tokens are accepted only on /v1/app routes and do not satisfy merchant dashboard auth middleware.
  • GET /v1/app/products requires read_products and is pinned to the token installation store.
  • GET /v1/app/orders requires read_orders and is pinned to the token installation store.
  • PATCH /v1/app/installation/metadata requires write_app_metadata and can update non-secret app-owned metadata only.

Theme package upload body

packages/theme-engine/src/theme-bundle.ts:117
AVAILABLE
  • bundle.schema_version defaults to 2026-05-json-contract and package metadata requires slug, name, site_types, version, pricing fields, and release status.
  • Bundle areas are config.settings_schema, config.settings_data, templates, sections, blocks, locales, and renderer.
  • Section keys must match section.type, block keys must match block.type, and section block_types must reference existing block definitions.
  • POST /v1/themes/packages/upload accepts submission_mode=marketplace by default; private_install returns without a review record.

App Submission Quality Gate

Built-for-LetBuyy evidence rules, draft behavior, and review-record automation from the current app engine and gateway route.

CheckCurrent ruleEvidence fieldsSource
Submission contractRequired fields are name, tagline, description, category_id, app_url, and privacy_url or privacy_policy_url. slug is generated from slug or name.name, tagline, description, category_id, app_url, privacy_url, privacy_policy_url, slugpackages/app-engine/src/index.ts:753
Evidence aliasesBuilt-for-LetBuyy evidence is parsed from quality_gate, built_for_letbuyy, or builtForLetBuyy. The gate runs only when evidence exists and save_as_draft is not true.quality_gate, built_for_letbuyy, builtForLetBuyy, save_as_draftpackages/app-engine/src/index.ts:779
PerformanceLighthouse performance score must be at least 70 before listing.performance_score, performanceScore, lighthouse_performancepackages/app-engine/src/index.ts:666
ReviewsAt least one qualifying published review and rating average of 4.0 or higher are required for the badge gate.review_count, reviews_count, rating_avg, average_rating, avg_ratingpackages/app-engine/src/index.ts:669 + services/api-gateway/src/routes/app-store.ts:623
InstallsAt least one successful install signal is required for the badge gate.install_count, installspackages/app-engine/src/index.ts:671 + services/api-gateway/src/routes/app-store.ts:1617
Storefront app blockAt least one extension must be typed storefront_block, app-block, or app_block.app_extensions, extensions, app_blockspackages/app-engine/src/index.ts:654
Privacy and app URLsApp and privacy URLs must be HTTPS. localhost and 127.0.0.1 HTTP are accepted only for local testing.privacy_policy_url, privacy_url, app_url, embedded_url, website_urlpackages/app-engine/src/index.ts:640 + :673
Failure behaviorA non-draft submission with failed evidence returns a validation error naming the failed check keys. Draft submissions store as draft and skip the gate.failed check keys, save_as_draftpackages/app-engine/src/index.ts:789 + :808
Review recordNon-draft submissions create a marketplace review record with schema_validation, developer_profile, and built_for_letbuyy_quality_gate automated checks, then emit app.submitted.marketplace_review_records, automated_checks, app.submittedservices/api-gateway/src/routes/app-store.ts:2130
OpenAPI export is not present in this branch.OAuth docs