360 Secure SkillHub
360 安全技能中心

Crossly CLI

提供 Crossly 卖家与买家命令行工具的安装、登录与使用参考,覆盖订单、库存、上架、日志、webhook 转发、MCP 安装,以及 JSON/NDJSON、dry-run、幂等键和退出码,便于在 shell、CI 或 agent 中调用 Crossly API。

分类:营销
crossly
热度 9.19
最近更新 2026-11-30 11:08:59

安装

发给 Agent
帮我安装这个技能:npx secure-skills-cli add crossly/crossly-cli
兼容性
通用兼容
联网要求
需要联网
数据出网
必须出网
Metadata
name
crossly-cli
description
Drive Crossly from the terminal and from scripts or agents with @crossly/cli (bin crossly, 0.3.0). Install, sign in (crossly login with browser PKCE loopback, --device code flow; CROSSLY_PAT takes precedence over ~/.crossly/auth.json), run any of the 2,917 generated commands (crossly GROUP VERB, or crossly api TOOL with the MCP registry names, crossly api --list --json for schemas), the hand-written workflows (listings publish --to, orders ship --yes, inventory import/export, logs -f, dev --forward, mcp install), the --json/--ndjson/--dry-run/--idempotency-key flags, exit codes 0/1/2/4/5, and CROSSLY_API_BASE_URL for the sandbox; plus the shopper CLI crossly-buyer (@crossly/buyer-cli, CROSSLY_BUYER_TOKEN). Use when scripting Crossly in shell or CI, wiring the CLI into an agent, forwarding webhooks to localhost, or decoding a crossly exit code.

The Crossly CLI

crossly is every seller API endpoint as a command, plus a handful of multi-call workflows. Its commands are generated from the same tool registry the MCP server serves (crossly-mcp-server), so flags and validation match the MCP tools exactly. For tokens and scopes see crossly-api-setup.

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

Install and sign in

npm i -g @crossly/cli          # published on npm (0.3.0); Node 18+
crossly login                  # opens the browser: Atlas OAuth, PKCE, loopback redirect
crossly login --device         # short code flow: SSH, containers, agent sandboxes
crossly whoami                 # GET /v1/me
crossly logout
crossly --version
  • The device flow is picked automatically when no browser is likely (SSH_CONNECTION/SSH_TTY, no DISPLAY/WAYLAND_DISPLAY, CI).
  • crossly login asks for openid offline_access plus a fixed set of 44 API scopes (inventory, listings, orders, sales, accounts, analytics, inbox, messages, automation, customers, webhooks, integrations, …). It does not include storefronts:*, team:* or apps:*: for those commands use a PAT that holds them via CROSSLY_PAT.
  • The session is refreshed automatically; a revoked or expired one exits 4 with session_expired.

Credential precedence:

  1. CROSSLY_PAT (env): CI, containers, secret managers. Never written to disk, never refreshed.
  2. ~/.crossly/auth.json, written by crossly login, mode 0600 (not the OS keychain). CROSSLY_CONFIG_DIR moves it (tests, a second account).

On a shared machine prefer CROSSLY_PAT from your own secret manager: the file is readable by anything running as you.

Base URL and the sandbox

The CLI talks to CROSSLY_API_BASE_URL, else the API the stored login was made for, else https://crossly.net/api. It does not switch on the token's environment word, so for the sandbox (see crossly-sandbox-testing) set both:

export CROSSLY_API_BASE_URL=https://sandbox.crossly.net/api
export CROSSLY_PAT=crossly_pat_test_…
crossly whoami

A test token against production (or the reverse) fails with 401 credential_environment_mismatch (exit 4). CROSSLY_WEB_BASE_URL overrides the web origin used by login (default: the API base without /api).

Generated commands

crossly orders list --status pending
crossly orders submit-tracking --id <uuid> --carrier usps --tracking-number 9205500000000000000000
crossly api submit_tracking --id <uuid> --carrier usps --tracking-number 9205500000000000000000
  • Group = the registry file the tool lives in (tools/orders.ts → crossly orders). Verb = the tool name with the group noun removed (get_order_shipments → orders shipments, list_stores → storefronts list-stores). Some groups: listings, inventory, orders, webhooks, storefronts, team, team-stores, sandbox, open-platform, account, detected-events.
  • crossly api <tool> runs the same thing by the exact MCP tool name, which stays stable if a verb is renamed. Prefer it in scripts and agents.
  • Discovery: crossly --help, crossly <group> --help, crossly <group> <verb> --help (never touches the network or needs a token). crossly api --list prints every tool; crossly api --list --json prints each with its JSON Schema inputSchema.
  • Flags are kebab-case of the schema's camelCase properties (--tracking-number → trackingNumber). An unknown flag is an error (exit 2) and the message lists the accepted flags; a missing required flag is also exit 2. Positional arguments are refused with a hint (Did you mean --id abc?).
  • Store-scoped tools take --storefront-id (sent as X-Storefront-Id; see crossly-team-stores) and write tools take --idempotency-key where their schema declares them; check --help.

Hand-written workflows

Command What it does
crossly listings publish <inventoryItemId> --to poshmark,depop Crossposts and waits (up to 3 minutes), reporting per platform. Exit 1 if any platform failed or is still pending. --no-wait queues and returns; --idempotency-key
crossly orders ship <orderId> Shows rates, buys nothing
crossly orders ship <orderId> --yes [--rate <rateId>] Buys the cheapest (or the named) label and submits tracking. --idempotency-key
crossly inventory import items.csv Validates only, writes nothing
crossly inventory import items.csv --yes Writes. --idempotency-key
crossly inventory export [items.csv] [--ids a,b] CSV to a file or stdout
crossly logs [-f] The activity log (last 50, then follow). Filters --platform, --action, --status success|failure|pending, --category, --source, --targetType, --targetId (camelCase here), --since <ISO>, --limit
crossly dev --forward http://localhost:3000/webhooks (alias crossly listen) Streams webhook events over an outbound connection and re-POSTs each as a real signed delivery. No tunnel. --events a,b, --secret (else CROSSLY_WEBHOOK_SECRET, else a printed whsec_dev_…), -q. Non-localhost targets need CROSSLY_DEV_ALLOW_REMOTE=1
crossly mcp install [--client claude|cursor|claude-code] [--token <t>] [--print] Mints a PAT and writes the npx -y @crossly/mcp server entry into the client's config (--print writes nothing)

--yes gates anything that spends money or writes in bulk (orders ship, inventory import). Without it nothing is purchased or written. Never add --yes in an agent without the user's explicit go-ahead for that purchase or import.

crossly dev needs a credential with webhooks:read (the stream is GET /v1/webhooks/stream). Forwards carry Crossly-Signature, Crossly-Event, Crossly-Delivery-Id: dev_<eventId> and x-crossly-forwarded-by: crossly-cli, so the verifier in crossly-webhooks runs unchanged.

Flags for scripts and agents

Flag Effect
--json JSON output (default when stdout is piped; table on a terminal)
--ndjson one object per line on lists
--dry-run validate and print what would be sent; no request
--idempotency-key <key> on writes that accept it: the server replays the first response for 24 h
-q, --quiet less chatter on stderr
--yes, -y confirm a spending or bulk-writing workflow

stdout is only ever the result; progress and warnings go to stderr, so | jq always works. With --json, errors go to stderr as {"error":{"code","message","correlationId"}}.

Exit codes:

Code Meaning Remedy
0 ok
1 the request failed (API error, network, a publish that failed or stayed pending) read error.code
2 usage: nothing was sent fix the command
4 not authenticated (401, no credential, session expired) crossly login or set CROSSLY_PAT
5 authenticated but 403 insufficient_scope a token with that scope, not the same login again
set -euo pipefail
crossly api list_orders --status pending --json | jq -r '.data[].id' | while read -r id; do
  crossly orders ship "$id" --json                     # rates only
done
crossly api crosspost_listing --help                   # the flags this tool takes

Other environment variables: CROSSLY_NO_BANNER=1 (no welcome animation on bare crossly), NO_COLOR.

The buyer CLI: crossly-buyer

@crossly/buyer-cli (bin crossly-buyer) is a separate binary for a shopper's own account on the buyer API (crossly-buyer-api): 114 commands across profile, orders, cashback, cart, wishlists, activity, offers, agent, vault.

npm i -g @crossly/buyer-cli
crossly-buyer login --token <buyer access token>   # stored 0600 at ~/.crossly/buyer-auth.json
crossly-buyer cart get
crossly-buyer offers make --listingSlug vintage-levis-501 --amountCents 4500
  • Credential: an Atlas access token with buyer:* scopes. CROSSLY_BUYER_TOKEN takes precedence over the file; CROSSLY_API_BASE_URL overrides the base. A seller CROSSLY_PAT is not used, and the CLI says so.
  • Nothing spends money: cart quote prices a basket, offers make proposes one; paying happens on Crossly with the person present.
  • Same --json, --ndjson, --dry-run and exit codes (5 = missing scope: re-consent).

Rules

  • In CI, set CROSSLY_PAT from the secret store; never ship ~/.crossly/auth.json in an image.
  • Use crossly api <tool> with --json in scripts; branch on the exit code first, then error.code.
  • Pass --idempotency-key on writes you might retry; use --dry-run to check a payload.
  • Point the sandbox explicitly with CROSSLY_API_BASE_URL.
  • Treat exit 5 as "needs a different token", never as a reason to loop on crossly login.

Docs: https://crossly.net/docs/api-cli · https://crossly.net/docs/api-sandbox · https://crossly.net/docs/api-webhooks