Test against the Crossly sandbox
Crossly has two test setups. Pick by what you are building:
| Sandbox environment | App sandbox | |
|---|---|---|
| For | your own scripts, agents, SDK and CLI code | a third-party OAuth app other sellers install |
| Where | a second Crossly: https://sandbox.crossly.net/api, its own database and accounts |
production Crossly, against sandbox sellers you create |
| Credential | crossly_pat_test_… minted in the sandbox |
your app's sandbox twin client (own client id, secret, redirect URIs), authorized as a sandbox seller |
| Marketplaces | connections disabled | simulated eBay, Poshmark, Mercari, Shopify, Crossly's shop, … |
| Money | Stripe test mode | none: no charges, payouts, labels or CBX |
Crossly-Environment response header |
sandbox |
sandbox |
Simulations (/v1/sandbox/*) |
no | yes |
For token basics see crossly-api-setup; for OAuth app registration see crossly-oauth-apps.
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
1. The sandbox environment
Sign in at sandbox.crossly.net (a separate account from production), open Settings → API & developers and mint a token: it is a test token, the only kind the sandbox accepts.
export CROSSLY_PAT=crossly_pat_test_…
curl -i https://sandbox.crossly.net/api/v1/me -H "Authorization: Bearer $CROSSLY_PAT"
# crossly-environment: sandbox
@crossly/sdk reads the environment word in the token and picks the base URL itself:
import { createClient } from '@crossly/sdk';
const crossly = createClient({ pat: process.env.CROSSLY_PAT! }); // _test_ → https://sandbox.crossly.net/api
The CLI does not switch on its own (it defaults to https://crossly.net/api): set CROSSLY_API_BASE_URL=https://sandbox.crossly.net/api. See crossly-cli.
- Environment enforcement. crossly.net accepts only
crossly_*_live_…credentials and the sandbox onlycrossly_*_test_…(PATs, OAuth tokens, publishable keys). The wrong one is401 credential_environment_mismatchbefore anything else runs. Never overridebaseUrlto point a test token at production or the reverse. - Seeded data. A market catalogue in three book shapes (sneakers by size, raw cards by condition, graded slabs by grade) with asks from a demo seller on a paid plan and bid ladders from seeded players.
- Payments. Stripe test mode:
4242 4242 4242 4242, any future expiry, any CVC; Stripe's documented test cards for declines, 3-D Secure and disputes. Payouts are simulated by Stripe. - Resets weekly (Sunday 05:00 UTC). Keep fixtures in code and re-create them, never depend on sandbox state surviving.
- Marketplace connections are disabled; rate limits and scopes are the same as production.
2. The app sandbox (OAuth apps)
- Sandbox credentials. Settings → API & developers → your app → Sandbox tab → Create sandbox credentials. A second OAuth client with its own client id, secret (shown once) and redirect URIs (empty = reuse the live ones;
http://localhostworks). Its scopes follow your live app. - Sandbox sellers. Same tab → Create sandbox seller. Up to ten; one idle for 30 days is deleted. A sandbox seller cannot sign in, gets no email and is never public. Seed: SKUs such as
SBX-LEVI-501-3230andSBX-NIKE-AM90-10live on simulated eBay, Poshmark, Mercari and Crossly's shop; a tee in S/M/L as a variation group; dropship items with asupplierandcostBasisCents(retail from Walmart and Amazon, one wholesale); an order waiting to ship on Crossly's shop and on eBay with full addresses; a delivered past sale. - Authorize with the sandbox client id through the normal Atlas flow. The consent screen shows a Sandbox banner and asks which sandbox seller the app acts on; the token acts on that seller only.
- Call the API exactly as in production (
GET /v1/inventory,POST /v1/listings,POST /v1/orders/{id}/tracking,POST /v1/webhooks).GET /v1/connectionslists every simulated channel as connected.
curl -s https://crossly.net/api/v1/sandbox -H "Authorization: Bearer $SANDBOX_TOKEN"
# { environment: "sandbox", seller: { id, label, seedVersion, seededAt, lastResetAt }, channels: [...],
# simulate: { header: "Crossly-Sandbox-Simulate", values: ["none","rate_limited","platform_error"] }, ttlDays }
Simulations
Each runs the real pipeline, so your webhooks get real, signed payloads.
| Call | Body | Scope (any of) | Webhooks |
|---|---|---|---|
GET /v1/sandbox |
orders:read, listings:read, inventory:read |
||
POST /v1/sandbox/simulate/order |
lines (1–20 of { listingId | sku, quantity 1–100, unitPrice }), platform, address (inline | delayed), buyer { username, email, address }, shippingCharged |
orders:write, orders:read |
order.created, sale.detected, stock and cross-channel updates |
POST /v1/sandbox/simulate/order.cancelled |
orderId, reason (≤ 300) |
same | order.cancelled |
POST /v1/sandbox/simulate/refund |
orderId, amount (dollars; omit = full), reason |
same | refund.issued |
POST /v1/sandbox/simulate/order.delivered |
orderId |
same | order.delivered |
POST /v1/sandbox/simulate/order.address |
orderId, optional address { name, line1, line2?, city, state, zip, country (2), phone? } |
same | order.address_available |
POST /v1/sandbox/simulate/listing.sold_out |
listingId, platform |
inventory:write, listings:write |
stock moves, other channels delist (listing.delisted) |
POST /v1/sandbox/simulate/inventory |
inventoryItemId or sku, mode (set | increase | decrease), value (0–1,000,000) |
same | quantity pushed to every channel |
POST /v1/sandbox/reset |
same | back to the seed; your grant and webhook subscriptions are kept | |
GET /v1/sandbox/events?limit= |
read | the simulated marketplaces' call log (verb, platform, outcome, latencyMs) |
Money in unitPrice, shippingCharged and amount is dollars.
const crossly = createClient({ pat: process.env.SANDBOX_TOKEN! }); // the sandbox client's access token
const order = await crossly.sandbox.simulateOrder(
{ lines: [{ sku: 'SBX-LEVI-501-3230', quantity: 1 }], platform: 'ebay', address: 'delayed' },
{ idempotencyKey: crypto.randomUUID() },
);
// { platform, platformOrderId, orderIds: [...], addressPending: true }
await crossly.sandbox.addressArrived({ orderId: order.orderIds[0] }); // order.address_available now
await crossly.sandbox.simulateRefund({ orderId: order.orderIds[0], amount: 5 });
await crossly.sandbox.reset();
SDK: crossly.sandbox.info, reset, simulateOrder, simulateCancellation, simulateRefund, simulateDelivery, addressArrived, simulateSoldOut, simulateInventory, events. MCP: sandbox_info, sandbox_reset, sandbox_simulate_order, sandbox_simulate_cancellation, sandbox_simulate_refund, sandbox_simulate_delivery, sandbox_simulate_address, sandbox_simulate_sold_out, sandbox_simulate_inventory, sandbox_events. CLI: crossly sandbox simulate-order, simulate-refund, reset, …
curl -X POST https://crossly.net/api/v1/sandbox/simulate/order \
-H "Authorization: Bearer $SANDBOX_TOKEN" -H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"lines":[{"sku":"SBX-NIKE-AM90-10","quantity":1}],"platform":"crossly","address":"delayed"}'
Pushing tracking with POST /v1/orders/{id}/tracking marks the order shipped (order.shipped) and the simulated carrier delivers about 15 seconds later (order.delivered).
Marketplace behaviour and failure injection
- Every simulated marketplace call takes 150–900 ms; publish, delist and quantity pushes complete in the background (
POST /v1/listingsreturns job ids,listing.createdfollows). - Send
Crossly-Sandbox-Simulate: rate_limitedorplatform_erroron any sandbox call and every marketplace call that request causes fails that way (429-shaped or 502-shaped). Ignored on live tokens. SDK:{ simulate: 'rate_limited' }on sandbox calls, orsandboxSimulateon a raw request. - Production dropship rules apply: crossposting a retail-sourced item to eBay, or any supplier item to Poshmark, is refused with
dropship_not_allowed_on_platform.
Isolation errors
| Status | error.code |
Cause |
|---|---|---|
| 403 | sandbox_only |
a live token on /v1/sandbox/* |
| 403 | sandbox_not_supported |
a sandbox token on a route outside the seller-app surface (buyer checkout, billing, payouts, label purchases, AI generation, …) |
| 401 | sandbox_environment_mismatch |
a live token on a sandbox seller or a sandbox token on a live one |
| 404 | not_found |
the sandbox seller was deleted (idle 30 days): create another and re-authorize |
3. Test webhooks
POST /v1/webhooks/{id}/test(webhooks:write) sendstest.ping; with body{ "event": "order.created" }it sends a sample of that event marked"test": true. Response{ ok, deliveryId, message }. SDKcrossly.webhooks.test(id, { event: 'order.created' }); the MCPtest_webhooktool (and socrossly webhooks test) only sendstest.ping.- In the app sandbox, the simulations above fire real events; each delivery is in
GET /v1/webhooks/{id}/deliveriesand on the app's Sandbox tab, with Redeliver. - Local development with no tunnel:
crossly dev --forward http://localhost:3000/webhooksholds an outbound stream (GET /v1/webhooks/stream,webhooks:read) and re-POSTs each event as a real delivery envelope signed with--secret, elseCROSSLY_WEBHOOK_SECRET, else a printedwhsec_dev_….--events a,bfilters. Non-localhost targets needCROSSLY_DEV_ALLOW_REMOTE=1. Forwards carryx-crossly-forwarded-by: crossly-cli.
curl -X POST https://crossly.net/api/v1/webhooks/$WEBHOOK_ID/test \
-H "Authorization: Bearer $CROSSLY_PAT" -H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" -d '{"event":"order.created"}'
Verification code is in crossly-webhooks.
Rules
- Keep live and test credentials in separate secrets; branch on the
Crossly-Environmentheader in logs and assertions, never on the base URL alone. - Re-create fixtures per run: the sandbox resets weekly and
POST /v1/sandbox/resetrestores the seed. - Exercise the async cases:
address: "delayed", partial refunds, cancellations, andCrossly-Sandbox-Simulatefailures, and make your handlers idempotent on the eventid. - Run your app end to end against a sandbox seller before listing it in the directory.
Docs: https://crossly.net/docs/api-sandbox · https://crossly.net/docs/api-app-sandbox · https://crossly.net/docs/api-webhooks · https://crossly.net/docs/api-authentication
