360 Secure SkillHub
360 安全技能中心

Crossly Bulk operations

该 Skill 是 Crossly 批量操作 API 参考,指导用 SDK/HTTP 批量创建、更新、下架、重新上架、跨平台发布、归档和删除商品刊登,并批量处理库存数量、标签、商品集与照片批次。涵盖幂等键、结果校验、计划限制、删除风险和限流分批策略。

分类:开发
crossly
热度 9.17
最近更新 2026-11-30 11:07:08

安装

发给 Agent
帮我安装这个技能:npx secure-skills-cli add crossly/crossly-bulk-operations
兼容性
通用兼容
联网要求
需要联网
数据出网
必须出网
Metadata
name
crossly-bulk-operations
description
Run Crossly actions on many listings or inventory items in one call. Bulk create listings (POST /v1/listings/bulk, 50 per call, per-item results by clientReferenceId), bulk update titles, descriptions and prices, bulk delist, relist, crosspost, archive and delete, bulk check-status, bulk tags, inventory bulk-quantity, bulk-labels, bulk-archive, bulk-restore and bulk-delete, product sets with their bulk action, and photo bulk-batches. Covers bulkJobId, verifying outcomes, item limits, plan gates and rate-limit-friendly batching. Use when code must change, publish or take down more than a handful of listings or items.

Bulk operations on Crossly

Bulk endpoints exist so you never loop a single-item route hundreds of times. Two kinds:

  • Per-item synchronous: POST /v1/listings/bulk answers with one result per item.
  • Queued: the other listing bulk verbs (and inventory label, archive, quantity pushes) validate the selection, write one bulk job and return a bulkJobId straight away. The marketplace work runs in the background.

Scopes: listings:write for every listing bulk route below, inventory:write for the inventory ones, product-sets:read / product-sets:write for product sets. Auth: crossly-api-setup. Errors, idempotency and rate limits: crossly-api-conventions.

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

Bulk create listings

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

const res = await crossly.listings.bulkCreate(                // POST /v1/listings/bulk, body { items }
  rows.slice(0, 50).map((r) => ({
    clientReferenceId: r.sku,                                // required, 1-100 chars, your id for the item
    inventoryItemId: r.inventoryItemId,
    platforms: ['ebay', 'poshmark'],
    data: { title: r.title, price: r.price, weightLb: r.weightLb },   // a POST /v1/listings body
  })),
  { idempotencyKey: crypto.randomUUID() }) as {
  data: { index: number; clientReferenceId?: string; status: 'created' | 'existing' | 'error';
          httpStatus: number; listingId?: string; jobs?: unknown[]; skipped?: unknown[];
          error?: { code: string; message: string } }[];
  meta: { created: number; existing: number; failed: number };
};
  • 1-50 items per call. Items run in order and independently.
  • created: the listing exists; platforms it could not be sent to are in that item's skipped (for example weight_required).
  • existing: that clientReferenceId was already used, the existing listing is returned and nothing is created. This is what makes retrying a whole batch safe: only what is missing gets created.
  • error: no listing exists for the item; error.code is what POST /v1/listings would have answered (validation_error, plan_limit_reached, …).

The listing body itself is described in crossly-crosspost.

Queued listing actions

All take listingIds (UUIDs of your listings) and an optional filters object that narrows the selection server-side: listedMoreThanDays, noSaleDays, priceMin, priceMax, viewsLessThan, favoritesLessThan, quantityAvailableLessThanOrEqual, listedOnLessThan, listedOnAtLeast, brandContains, hasAnyLabels, hasNoneLabels, condition. If nothing matches, the answer is 200 with bulkJobId: null.

Endpoint SDK What it does
POST /v1/listings/bulk-update bulkUpdate Title / description / price edits (below). Pushes only the changed fields to every marketplace each listing is live on.
POST /v1/listings/bulk-delist bulkDelist Takes the listings down on their marketplaces.
POST /v1/listings/bulk-relist bulkRelist Ends and relists to refresh them. platforms optional.
POST /v1/listings/bulk-crosspost bulkCrosspost Publishes to more marketplaces, no delist phase. platforms required (400 invalid_request without).
POST /v1/listings/bulk-delete bulkDelete Archives and delists.
POST /v1/listings/bulk-hard-delete bulkHardDelete Permanently deletes. Live listings need allowLive: true (they stay up on the marketplaces and Crossly stops tracking them), otherwise 409 listings_live with the counts. dryRun: true returns the counts only.
POST /v1/listings/bulk-check-status bulkCheckStatus Re-checks each listing's status on its marketplaces.
POST /v1/listings/bulk-delist-preview bulkDelistPreview Read-only: per marketplace, how many active listings a delist would touch and whether that account needs_reauth. Run it before a big delist.
POST /v1/listings/tags/bulk crossly.listingTags.bulk { listingIds (≤5000), add, remove, dryRun }. Max 30 tags a listing, 40 chars a tag. Returns matched, changed, capped.
POST /v1/listings/by-ids byIds Fetch up to 200 hydrated listings (with platformListings) in one call.

The listingIds cap is 50,000 on update, delist, delete, hard-delete, check-status and delist-preview. A listing you don't own is 404 not_found; one another app manages is 403 listing_managed_elsewhere.

Bulk update body

await crossly.listings.bulkUpdate({
  listingIds,
  updates: {
    title: { action: 'insert_start', value: 'NWT ' },             // set | insert_start | insert_end | find_replace | remove
    description: { action: 'find_replace', find: 'Addidas', replace: 'Adidas' },
    price: { action: 'drop_percent', value: 10, rounding: 'down' }, // set | drop_percent | drop_amount | raise_percent | raise_amount
  },
}, { idempotencyKey: crypto.randomUUID() });                       // -> { success, updated, bulkJobId }

Prices are dollars. Marketplace rules still apply after the edit: Poshmark rounds to whole dollars (minimum $3) and Grailed refuses a price increase after a drop. There is no undo; apply the reverse edit.

Relist and crosspost guards

Both check the plan's monthly crosspost allowance first: listings that no longer fit are left out and named in refused, and none fitting is 402 plan_limit_reached. Each marketplace's preflight can also refuse the batch up-front: eBay 409 selling_cap_reached (hard cap) or 402 free_quota_exceeded (past the free listings; resend with confirmOverFreeQuota: true once the seller accepts the per-listing fee), the Crossly shop 409 shop_selling_limit_reached or 422 storefront_requirements_missing.

Bulk inventory

Endpoint Body Returns
POST /v1/inventory/bulk-quantity { ids, mode: set|increase|decrease, value } or { mode: "set", items: [{ id, quantity }] } (1-5000), syncMarketplaces? { affected, skipped, bulkJobId? }. Stock changes at once; live listings are pushed against bulkJobId, and 0 delists.
POST /v1/inventory/bulk-labels { ids, addLabels, removeLabels } (labels ≤100 chars) { updated, bulkJobId }; neither list is 400 no_changes.
POST /v1/inventory/bulk-archive { ids } { archived, bulkJobId } (soft).
POST /v1/inventory/bulk-restore { ids } { restored, restoredIds }.
POST /v1/inventory/bulk-delete { ids, force?, deleteListings? } { deleted, deletedIds, refused, bulkJobId }; linked items are 409 inventory_linked_to_listings until you resend with force: true.
POST /v1/inventory/labels/rename { from, to } { updated } across every item.

ids takes up to 50,000 UUIDs on labels, archive, restore and delete. Get them from GET /v1/inventory/ids with the same filters you would list with. Item fields and the quantity model: crossly-inventory.

Plan gate

On the Free plan, value-generating bulk work on two or more items is 403 forbidden: bulk create, update, crosspost, relist, labels and quantity. One item is just the normal action. Cleanup and safety verbs are open on every plan: delist, delete, hard-delete, archive, check-status and delist-preview. The gate reads the plan of the store in X-Storefront-Id (else the default store).

Product sets: a saved selection

A product set is a named selection of listings by filters (search, statuses, categories, brands, tags + tagsMatch, minPrice/maxPrice, listedOn/notListedOn, stock, minQuantity/maxQuantity, minAgeDays/maxAgeDays), explicit picks, or both. Members are evaluated when used, so new matching listings join automatically.

const set = await crossly.productSets.create({                      // POST /v1/product-sets
  name: 'Stale denim',
  filters: { categories: ['Bottoms'], minAgeDays: 60, stock: 'in_stock' },
}, { idempotencyKey: crypto.randomUUID() }) as { id: string; memberCount: number };

await crossly.productSets.editMembers(set.id, { add: [], exclude: [pinnedId], remove: [] });  // POST /v1/product-sets/{id}/members
const run = await crossly.productSets.bulk(set.id, { action: 'relist', platforms: ['poshmark'] },
  { idempotencyKey: crypto.randomUUID() }) as { bulkJobId?: string; listingCount: number; refused?: unknown };

POST /v1/product-sets/{id}/bulk runs delist, relist or check-status on the current members (confirmOverFreeQuota as above). GET /v1/product-sets/{id}/members pages the members (limit ≤200). Deleting a set (DELETE /v1/product-sets/{id}) also drops it from channel exclusion lists. Sets can be excluded from quantity sync per account (excludedSetIds, see crossly-inventory).

Bulk list from photos (bulk batches)

/v1/bulk-batches (scope listings:read / listings:write) is the photo-capture flow behind the dashboard's bulk market listing: POST /v1/bulk-batches opens a batch, POST /v1/bulk-batches/{id}/items appends an item's photos, POST /v1/bulk-batches/{id}/identify matches items in the background (route: magic, market or auto), PATCH /v1/bulk-batches/items/{id} or POST /v1/bulk-batches/{id}/items/bulk corrects price (priceCents), quantity, cost or condition, and POST /v1/bulk-batches/{id}/publish creates drafts (default) or publishes live to destinations with live: true, merging duplicates into an existing matching listing. Poll GET /v1/bulk-batches/{id} for item status. SDK: crossly.bulkBatches.*.

Following a bulk job

There is no /v1 endpoint that returns a bulk job by its bulkJobId. Keep the id for support and the Activity Log (a bulk job is one event with per-item children: crossly-activity-log), and verify the outcome on the records themselves:

// After a bulk relist/delist/update: read the listings back in pages of 200.
for (let i = 0; i < listingIds.length; i += 200) {
  const { items } = await crossly.listings.byIds(listingIds.slice(i, i + 200)) as {
    items: { id: string; platformListings: { platform: string; status: string; errorMessage?: string | null }[] }[];
  };
  for (const l of items) for (const pl of l.platformListings)
    if (pl.status === 'failed') console.warn(l.id, pl.platform, pl.errorMessage);
}

For ongoing sync, poll GET /v1/listings?updatedSince=<last seen> or use webhooks (crossly-webhooks) instead of re-reading everything. Give background work a few minutes on large selections; marketplaces are called at their own pace.

Batching and rate limits

  • Writes per token per minute: Free 15, Starter 60, Pro 240, Unlimited 1,000 (reads 1,200). One bulk call is one write, however many ids it carries; 500 single PATCHes is 500.
  • Send the whole selection in one queued call rather than splitting it, up to the cap. For POST /v1/listings/bulk, send consecutive chunks of 50 and wait for each response.
  • On 429 rate_limited, wait Retry-After seconds and resend with the same Idempotency-Key.

Rules

  • Always send an Idempotency-Key; for bulk create also give every item a stable clientReferenceId.
  • Preview before destroying: bulk-delist-preview, bulk-hard-delete with dryRun, bulk-delete without force.
  • A queued 200 means accepted, not done. Check platformListings before reporting success, per platform.
  • Never use bulk delist after a sale: the sale cascade already delists the other copies.
  • On Free, expect 403 forbidden for multi-item value actions and fall back to single-item calls.

Docs: https://crossly.net/docs/bulk-edits · https://crossly.net/docs/managing-listings · https://crossly.net/docs/api-listings · https://crossly.net/docs/api-rate-limits