Crossly Storefront shop
Latest: v1.0.0
Initial release
Run a seller's Crossly storefront
Every Crossly store has two public faces, edited separately:
| Shop profile | Website | |
|---|---|---|
| What | The store's page inside the Crossly Shop (/shop/s/<slug>) with Crossly's header | A standalone site at /site/<slug> and the store's custom domain, with no Crossly chrome |
| Shape | ShopProfile: banner, logo, tagline, bio, accent, announcement, shelves, blocks | SiteDesign: theme, header, footer, popup, SEO, pages of sections |
| Saving | Saved at once | Draft → publish, with versions |
| API | GET/PUT /v1/storefront/profile | /v1/storefront/site… |
Every call acts on the store named by the X-Storefront-Id header, else the token owner's default store (multi-store setup: crossly-team-stores). Auth: crossly-api-setup. Errors, idempotency, paging: crossly-api-conventions.
import { createClient } from '@crossly/sdk';
const crossly = createClient({ pat: process.env.CROSSLY_PAT! });
Setup
- Create a free Crossly account: https://crossly.net/register
- Create a personal access token at https://crossly.net/settings/api/tokens/new (guide: https://crossly.net/guides/personal-access-tokens). Use a
crossly_pat_test_token against the sandbox while building. - Export it as
CROSSLY_PATand send it asAuthorization: Bearer $CROSSLY_PATtohttps://crossly.net/api/v1/*. Full docs: https://crossly.net/docs
Website: draft, publish, switch on
Scopes: storefronts:read for GET /v1/storefront/site, versions, merch, preview, resolve and suggest; storefronts:write for draft, publish, restore, enabled and starter.
| Call | Body | SDK (crossly.storefrontSite) |
|---|---|---|
GET /v1/storefront/site | get(): draft, live design, when each changed, enabled, the custom domain | |
PUT /v1/storefront/site/draft | { design } (a complete SiteDesign) | saveDraft(design) |
POST /v1/storefront/site/publish | { label? } (≤ 80 chars) | publish({ label }) |
GET /v1/storefront/site/versions | listVersions() (publish, restore and template points; last 30 kept) | |
POST /v1/storefront/site/versions/{id}/restore | restoreVersion(id): that version → the draft (publish to make it live) | |
PUT /v1/storefront/site/enabled | { enabled } | setEnabled(true): needs a publish first; off makes /site/<slug> 404 and the domain show the shop profile |
POST /v1/storefront/site/starter | { starterId } | applyStarter(id): vintage, sneakers, streetwear, collectibles, boutique, home, minimal, drop, general; the current draft is kept as a version first |
POST /v1/storefront/site/preview | { design, pageSlug } | preview(design, ''): resolve an unsaved page as buyers would see it |
POST /v1/storefront/site/suggest | suggestSections(): sections proposed from the store's top tags and categories (not saved) |
The draft is validated strictly: a bad field is a 400 naming its path. SiteDesign needs version, theme, header, announcement, footer, popup, seo, templates and pages (at least one; the home page, slug "", comes first; slugs unique). Don't hand-build one from nothing: read get(), change what you need, save it back.
const { data: site } = await crossly.storefrontSite.get() as { data: { draft: Record<string, unknown> } };
await crossly.storefrontSite.saveDraft({ ...site.draft /* edited */ }, { idempotencyKey: crypto.randomUUID() });
await crossly.storefrontSite.publish({ label: 'Spring refresh' }, { idempotencyKey: crypto.randomUUID() });
await crossly.storefrontSite.setEnabled(true);
Product rails: ListingSource
Rails, grids and shelves fill themselves from the store's live Crossly listings. A source is { mode, sort, limit, … }:
mode | Selects |
|---|---|
manual | listingIds, in order (these are platform-listing ids) |
tags | listings with any/all of tags (tagMatch: any | all) |
category | category: { main, sub?, sub2? } |
smart | smart: newest, price drops, best sellers, most viewed, most saved, on sale, under a price, back in stock, ending soon |
all | everything live |
Every mode but manual also narrows by priceMinCents / priceMaxCents (integer cents), conditions and excludeTags, then sorts and caps (limit). Test one with POST /v1/storefront/site/resolve { source } (resolveSource): the matching listings and total. GET /v1/storefront/merch (merch()) lists the store's tags, categories, conditions, brands and price range, so you can pick values that exist. Tag listings in bulk to drive rails (see crossly-inventory and crossly-bulk-operations).
Shop profile
GET /v1/storefront/profile (storefronts:read) and PUT /v1/storefront/profile { profile } (storefronts:write; a complete ShopProfile, saved at once). POST /v1/storefront/profile/suggest-shelves proposes shelves. SDK: getProfile(), updateProfile(profile), suggestShelves().
Older builder. GET/PUT /v1/storefront (design: banner, logo, theme, SEO, social links, published) and /v1/storefront/sections (scopes listings:read / listings:write, SDK crossly.storefront) are the pre-website builder. A store's website and profile are built from it once, on first read; later writes there don't change the live site. Use the website and profile endpoints for new work.
Store go-live requirements
GET /v1/storefronts/{id}/requirements (storefronts:read) lists what a store still needs before a new Crossly listing can publish into it: ship_from, shipping_policy, return_policy, payouts, with where to fix each. POST /v1/storefronts/{id}/publish (storefronts:write) flips a store live and fails with storefront_requirements_missing (and the missing list) until they are set. A live store shows only once it has a live listing. Checkout refuses buyers until payouts are active (crossly-payouts-billing). Shipping policy and ship-from: GET/PUT /v1/storefront/shipping (see crossly-shipping-labels).
The custom domain appears read-only in GET /v1/storefront/site and GET /v1/storefronts/{id}/settings; it is connected in the dashboard (Hub → Storefront → Custom domain), not over the API.
Discount codes
Scopes: listings:read (list, get, share, redemptions), listings:write (create, update, status, pause-all, generate). SDK: crossly.discountCodes.
POST /v1/discount-codes { code, kind, name?, rules? }:
code: 2-40 ofA-Z 0-9 - _, upper-cased. It can be renamed only until first used.kind:percent,fixed,free_shipping,bxgy,spend_tiers,fixed_price_set.rules.value:percentBps(basis points: 1500 = 15%),amountCents,maxDiscountCents,rounding.rules.bxgy:buyQty,getQty(1-50),rewardfree|percent.rules.spendTiers(≤ 10):{ minSubtotalCents, offCents }.rules.fixedPriceSet:{ qty (2-50), priceCents }.rules.requirements:minSubtotalCents,minItemCount,firstOrderOnly,returningOnly,mustFollowStore,channel(any,retail,wholesale)…rules.limits:totalUses,usesPerBuyer,usesPerDay,budgetCents,onePerOrder(default true),regions(allow/block countries, states, postal prefixes, per-region caps).rules.schedule,rules.stacking(withAutomatic,withLoyalty,withOtherCodes,priority),rules.appliesTo/exclusions(item scope),rules.delivery(code,auto_apply,unique_bulk),rules.channels(storefront,live,marketplace,rentals,world,website,pos).
const { data: code } = await crossly.discountCodes.create({
code: 'SPRING15', kind: 'percent',
rules: { value: { percentBps: 1500, maxDiscountCents: 5000 }, requirements: { minSubtotalCents: 4000 },
limits: { totalUses: 500, usesPerBuyer: 1 } },
}) as { data: { id: string } };
await crossly.discountCodes.generate(code.id, { count: 200, prefix: 'VIP', length: 8 }); // ≤ 5,000 single-use codes
Then: POST /v1/discount-codes/{id}/status { status: active | paused | archived } (setStatus), POST /v1/discount-codes/pause-all { paused } (pauseAll), GET /v1/discount-codes/{id}/share (a link that pre-applies the code, plus a QR PNG data URL), GET /v1/discount-codes/{id}/redemptions?limit=&offset= (limit ≤ 500; orders, masked buyers, amount given). Listed statuses: active, scheduled, paused, expired, exhausted, archived.
Automatic discounts (buy more, save more; no code): GET/POST /v1/automatic-discounts, PUT/DELETE /v1/automatic-discounts/{id} (crossly.automaticDiscounts: list, create, replace, delete). Body { name, kind: quantity | mix, tiers: [{ minQty, percentBps }], appliesTo?, exclusions?, channels?, schedule?, stacking?, active? }. POST /v1/automatic-discounts/preview (listings:read) prices a cart (cart: [{ platformListingId, quantity, unitPriceCents? }], 1-50 lines) against your rules or an unsaved draft.
Collection-holder deals (/v1/discounts/holders) and the loyalty club (/v1/loyalty/program) also exist; loyalty is covered by crossly-customers-integrations. Timed sales across marketplaces are sale.start workflow nodes (crossly-workflows).
Product feeds
Hosted feed URLs that ad and shopping channels fetch. Scopes listings:read / listings:write; per store (X-Storefront-Id, or storefrontId in the SDK options). SDK: crossly.productFeeds.
const feed = await crossly.productFeeds.create({
channel: 'google', name: 'Google Merchant Center',
filters: { minPrice: 10, includeOutOfStock: false },
settings: { currency: 'USD', targetCountry: 'US', language: 'en' },
}, { idempotencyKey: crypto.randomUUID() }) as { id: string; url: string };
// Paste feed.url into Merchant Center as a scheduled fetch.
channel:google,meta,tiktok,pinterest,bing,snapchat,rss,json,csv;format:xml,csv,tsv,json,atom.filters: include/exclude categories, brands, tags, listing ids;minPrice/maxPrice(in the price's major unit, dollars, not cents);includeOutOfStock,minQuantity,statuses,conditions,onPlatforms/notOnPlatforms,listedWithinDays.settings:fieldMap,defaultGoogleCategory,fallbackBrand,idPrefix,currency,targetCountry,language,shipping,images,utm,refresh,rotationGraceHours(≤ 168).- The response carries the secret
url. Treat it like a credential.POST /v1/product-feeds/{id}/rotate{ graceHours? }issues a new one (the old keeps answering for the grace window;0stops it at once);POST /v1/product-feeds/{id}/revoke-previousends the grace now. - Check before submitting:
GET /v1/product-feeds/{id}/report(report: counts per issue; items with errors are held back, warnings are sent with limited reach),/issues(paged byafter=nextCursor),/preview(the document as the channel reads it),/fetches(who fetched it, 90 days). - Fix one item for one feed without touching the listing:
PUT /v1/product-feeds/{id}/items/{listingId}(setOverride: title, GTIN, category, custom labels…); all fields empty removes it. - Also:
PATCH/DELETE /v1/product-feeds/{id},POST …/refresh(drop the cached copy),POST …/copy(to other stores, each with its own URL).
Google only shows products whose links are on a website you've claimed, so a Google feed needs the store's custom domain verified in Merchant Center.
Related
- Lookbooks, story highlights and lookbook email campaigns:
/v1/lookbooks,/v1/storefront/highlights,/v1/lookbook-campaigns(crossly.lookbooks). - Brand drops and events:
/v1/branding/drops,/v1/branding/events(crossly.branding). - Putting the store's listings on the seller's own site with a script tag: crossly-embed-storefront.
- The trade (wholesale) site at
/site/<slug>/trade: crossly-wholesale.
Rules
- Send
X-Storefront-Idon every call when the seller has more than one store; without it you edit the default store. - Website changes are drafts until
POST /v1/storefront/site/publish; read the draft, edit it, save it whole. - Don't build new pages on
PUT /v1/storefrontor/v1/storefront/sections; they don't reach the live site. - Discount values are basis points (
percentBps) and integer cents (…Cents); feed price filters are dollars. - Give every repeating or public code a
totalUses,usesPerBuyerorbudgetCentslimit. - Keep feed URLs secret; rotate one that leaked.
- Check
GET /v1/storefronts/{id}/requirementsbefore publishing listings into a new store.
Docs: https://crossly.net/docs/storefront · https://crossly.net/docs/crossly-shop · https://crossly.net/docs/discounts-and-loyalty · https://crossly.net/docs/product-feeds · https://crossly.net/docs/google-shopping
