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
- 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
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, noDISPLAY/WAYLAND_DISPLAY,CI). crossly loginasks foropenid offline_accessplus a fixed set of 44 API scopes (inventory, listings, orders, sales, accounts, analytics, inbox, messages, automation, customers, webhooks, integrations, …). It does not includestorefronts:*,team:*orapps:*: for those commands use a PAT that holds them viaCROSSLY_PAT.- The session is refreshed automatically; a revoked or expired one exits
4withsession_expired.
Credential precedence:
CROSSLY_PAT(env): CI, containers, secret managers. Never written to disk, never refreshed.~/.crossly/auth.json, written bycrossly login, mode 0600 (not the OS keychain).CROSSLY_CONFIG_DIRmoves 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 --listprints every tool;crossly api --list --jsonprints each with its JSON SchemainputSchema. - Flags are kebab-case of the schema's camelCase properties (
--tracking-number→trackingNumber). An unknown flag is an error (exit2) and the message lists the accepted flags; a missing required flag is also exit2. Positional arguments are refused with a hint (Did you mean --id abc?). - Store-scoped tools take
--storefront-id(sent asX-Storefront-Id; see crossly-team-stores) and write tools take--idempotency-keywhere 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_TOKENtakes precedence over the file;CROSSLY_API_BASE_URLoverrides the base. A sellerCROSSLY_PATis not used, and the CLI says so. - Nothing spends money:
cart quoteprices a basket,offers makeproposes one; paying happens on Crossly with the person present. - Same
--json,--ndjson,--dry-runand exit codes (5= missing scope: re-consent).
Rules
- In CI, set
CROSSLY_PATfrom the secret store; never ship~/.crossly/auth.jsonin an image. - Use
crossly api <tool>with--jsonin scripts; branch on the exit code first, thenerror.code. - Pass
--idempotency-keyon writes you might retry; use--dry-runto check a payload. - Point the sandbox explicitly with
CROSSLY_API_BASE_URL. - Treat exit
5as "needs a different token", never as a reason to loop oncrossly login.
Docs: https://crossly.net/docs/api-cli · https://crossly.net/docs/api-sandbox · https://crossly.net/docs/api-webhooks
