360 Secure SkillHub
360 安全技能中心

Crossly Imports sync

指导调用 Crossly API 把已上架商品、CSV 表格或自有网店库存导入并持续同步:创建导入任务并轮询结果,CSV 先 dry-run 再写入,配置 Shopify 等来源店铺的字段同步与自动刊登。

分类:营销
crossly
热度 13.13
最近更新 2026-11-30 11:10:02

安装

发给 Agent
帮我安装这个技能:npx secure-skills-cli add crossly/crossly-imports-sync
兼容性
通用兼容
联网要求
需要联网
数据出网
必须出网
Metadata
name
crossly-imports-sync
description
Bring existing stock into Crossly and keep it in step. Start a marketplace import job (POST /v1/imports, poll GET /v1/imports/{id}, eBay sites via /v1/imports/sites), import and export inventory as CSV (POST /v1/inventory/csv/import with dryRun, /v1/inventory/csv/export, crossly inventory import/export in the CLI), understand dedup by platformListingId and SKU, stock on import and merging duplicates, and configure continuous source-store sync from Shopify, WooCommerce, BigCommerce, Wix, Squarespace, Lightspeed or Square (/v1/source-sync). Use when onboarding a seller's existing listings, migrating from a spreadsheet or another tool, or making an own web store the source of truth.

Imports and store sync

Three ways stock gets into Crossly without retyping:

Way Use it when Endpoint
Marketplace import The items are already live on a connected marketplace. Links each item to its live listing, so sales are detected and the other copies delisted from day one. /v1/imports
CSV import Stock that isn't listed anywhere, a move off another tool, or offline edits of item details. /v1/inventory/csv/import
Source sync The seller's own store (Shopify, WooCommerce…) stays in charge and every change should flow out to the marketplaces. /v1/source-sync

Scopes: inventory:read / inventory:write for imports and CSV, source-sync:read / source-sync:write for store sync. Auth: crossly-api-setup. Errors and idempotency: crossly-api-conventions. The account must already be connected (crossly-marketplace-connections).

Setup

  1. Create a free Crossly account: https://crossly.net/register
  2. 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.
  3. Export it as CROSSLY_PAT and send it as Authorization: Bearer $CROSSLY_PAT to https://crossly.net/api/v1/*. Full docs: https://crossly.net/docs

Marketplace import

import { createClient } from '@crossly/sdk';
const crossly = createClient({ pat: process.env.CROSSLY_PAT! });

const { jobId } = await crossly.imports.start(               // POST /v1/imports -> 202
  { platform: 'ebay', marketplaces: ['EBAY_US', 'EBAY_GB'] },
  { idempotencyKey: crypto.randomUUID() },
) as { jobId: string; platform: string; status: 'queued' };

for (;;) {
  const job = await crossly.imports.get(jobId) as {          // GET /v1/imports/{id}
    status: 'queued' | 'running' | 'completed' | 'failed';
    totalCount: number; importedCount: number; skippedCount: number; errorCount: number;
    lastError: string | null;
  };
  if (job.status === 'completed') break;
  if (job.status === 'failed') throw new Error(`Import failed: ${job.lastError}`);
  await new Promise((r) => setTimeout(r, 10_000));
}
curl -X POST https://crossly.net/api/v1/imports \
  -H "Authorization: Bearer $CROSSLY_PAT" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"platform":"poshmark"}'

Body:

Field Notes
platform Required platform id (poshmark, ebay, mercari, depop, etsy, shopify…). An unknown id is 400 import_failed.
marketplaces eBay only: up to 25 site ids matching EBAY_* (EBAY_US, EBAY_GB). Omit for every site. GET /v1/imports/sites?platform=ebay lists the sites the account's listings are on, with counts.
listOnCrossly Also list what the import brings in on Crossly's own marketplace once each item's details are filled in.

Every /v1 import runs in both mode (inventory items and linked listings) and pulls active listings only. Inventory-only, listings-only, sold-and-delisted history and the date or price filters are dashboard options.

The job: status (queued, running, completed, failed), totalCount (set once the fetch completes), importedCount (grows while it runs), skippedCount, errorCount, lastError, startedAt, finishedAt. Problems found while running (an expired marketplace session, say) end as failed with lastError naming the next step. GET /v1/imports lists the 50 most recent jobs, newest first, as { data, pagination }.

Poll every 5-10 seconds. There is no import-finished webhook.

Dedup, merges and stock

  • Already tracked: a listing whose (platform, platformListingId) Crossly already has is skipped, so re-running an import is safe and only brings in what is new. A re-import never overwrites details edited in Crossly.
  • Same item on two marketplaces: items are matched to an existing inventory item only on an identifier (SKU) or a conclusive photo match, never on a similar title, so two "Nike Tee" shirts stay two items. Uncertain pairs are left for the seller to decide in the dashboard. Merge leftovers yourself with POST /v1/inventory/merge { keepItemId, mergeItemIds }; stock is not summed (see crossly-inventory).
  • Stock: only marketplaces that show a real count (eBay, Etsy, Shopify, Poshmark, Whatnot, Depop) decide an item's quantity. When two disagree, Crossly takes the lower number and flags it. One-at-a-time marketplaces (Mercari, Grailed, Vinted…) always say 1 and don't count. Raise stock afterwards with POST /v1/inventory/bulk-quantity if the shelf holds more.
  • Plan limit: each new inventory item counts toward the monthly allowance (Free 25, Starter 150, Pro 500, Business 10,000, Scale 100,000). Past it, the rest are skipped, not failed, and the job still completes. Listings attached to items you already have don't count.
  • Nothing is crossposted. An import only mirrors existing listings. Crosspost afterwards (crossly-crosspost, crossly-bulk-operations).

CSV import and export

The CSV is sent as a JSON string, up to 8 MB and 5,000 rows (rows past that are reported as skippedOverLimit).

import { readFileSync } from 'node:fs';
const csv = readFileSync('items.csv', 'utf8');

const preview = await crossly.inventory.importCsv({ csv, dryRun: true }) as {   // POST /v1/inventory/csv/import
  totalRows: number; usable: number; created: number; updated: number;
  problems: { line: number }[]; problemCount: number; skippedOverLimit: number; maxRows: number;
};
if (preview.problemCount === 0) {
  await crossly.inventory.importCsv({ csv }, { idempotencyKey: crypto.randomUUID() });
}

const out = await crossly.inventory.exportCsv({});            // POST /v1/inventory/csv/export -> text/csv
  • Always dry-run first. dryRun: true validates and counts without writing. problems[].line is 1-based and counts the header row, so it matches the spreadsheet.
  • SKU decides add vs update: a row whose sku exactly matches an item updates it; a row with no usable SKU (N/A, none, - count as none) adds a new item. Titles are never used to match.
  • Columns: title and price are required (missing or non-numeric is a skipped row), then quantity (blank = 1, 0 = none), condition, brand, size, color, sku, cost_of_goods (your cost, not a "was" price), description, images, category_main, category_sub, tags, notes, warehouse_location, storage_bin. Headers match loosely (Cost of Goods works). Separate several values in one cell with ;. Prices like $12.50, 12,50 and 1.299,00 parse.
  • Price, description and category make a draft listing for a new row (listingsCreated counts them). On an update row they are ignored; reprice existing listings with bulk update. A CSV import never publishes to a marketplace.
  • Updates overwrite: on an update, a blank quantity sets stock to 1, and blank images, tags or color clear those fields. Keep those columns filled, or drop the rows you aren't changing.
  • Image links must be public; Crossly copies each photo into the seller's storage.
  • An empty or headerless file is 400 no_rows.
  • Export takes optional itemIds (up to 20,000) and returns text/csv with exactly the columns import reads, so export → edit → import round-trips.

CLI (@crossly/cli), which reads the file itself instead of passing it through argv:

crossly inventory import items.csv          # validates only, writes nothing
crossly inventory import items.csv --yes    # writes
crossly inventory export items.csv          # or no file for stdout; --ids a,b,c for a selection

Continuous source-store sync

Make the seller's own store the source of truth: new products, edits, stock and removals there flow into Crossly and out to every marketplace. Shopify, WooCommerce, BigCommerce and Lightspeed X-Series push changes instantly; Wix, Squarespace and Lightspeed R-Series are checked every 30 minutes, and every store is fully re-checked every 30 minutes.

const { data } = await crossly.sourceSync.list() as {          // GET /v1/source-sync
  data: { platform: string; connected: boolean; webhooks: boolean; lastEventAt?: string | null;
          lastReconciledAt?: string | null; lastError?: string | null; linkedProducts: number }[];
};

await crossly.sourceSync.update('shopify', {                    // PATCH /v1/source-sync/{platform}
  enabled: true,
  sourceOwnedFields: ['title', 'description', 'price', 'images', 'quantity'],
  importNewProducts: true,
  onSourceDelete: 'delist_everywhere',                          // or source_only
  autoExportEnabled: true,
  autoExportPlatforms: ['ebay', 'poshmark'],
}, { idempotencyKey: crypto.randomUUID() });

await crossly.sourceSync.syncNow('shopify');                    // POST /v1/source-sync/{platform}/sync -> 202
Setting Meaning
sourceOwnedFields Fields that always follow the store: title, description, price, images, quantity, sku, brand, tags. Unticked fields keep Crossly's value; a sync never overwrites with a blank.
importNewProducts Create a Crossly listing when a product is added to the store.
onSourceDelete delist_everywhere ends it on every channel when the product is removed or unpublished; source_only marks only the store copy removed.
autoExportEnabled + autoExportPlatforms Crosspost each newly imported product to those connected marketplaces automatically.
  • Platforms: shopify, woocommerce, bigcommerce, wix, squarespace, lightspeed_r, lightspeed_x, square.
  • POST /v1/source-sync/{platform}/sync re-reads the whole catalogue in the background; with sync off it is 400 sync_off.
  • GET /v1/source-sync/events?platform=shopify&limit=200 shows each webhook delivery and reconcile change with its outcome, fields and error. Read it before telling a seller a change "didn't sync".
  • Registers (lightspeed_r, lightspeed_x, square): stock is per location. GET /v1/source-sync/{platform}/locations lists them; PUT /v1/source-sync/{platform}/location { locationId } picks the one Crossly syncs. Register sales arrive as sales and counted stock as changes, so quantity isn't a source-owned field there.
  • Sales are not part of store sync: a sale anywhere lowers stock and delists elsewhere as usual.

Rules

  • Connect the account before importing; poll the job until completed or failed, never assume.
  • Send an Idempotency-Key on POST /v1/imports and on CSV writes; a retried import without one starts a second job.
  • Dry-run every CSV and show problems before writing; keep the sku column so a re-import updates instead of duplicating.
  • Don't pass prices or descriptions through CSV to change live listings; use bulk update.
  • With source sync on, edit source-owned fields in the store, not in Crossly, or the next sync puts them back.

Docs: https://crossly.net/docs/api-imports · https://crossly.net/docs/inventory-bulk-import · https://crossly.net/docs/store-sync · https://crossly.net/docs/api-cli