Crossly API conventions
These apply to every seller endpoint under /v1 and, with the differences noted in the crossly-buyer-api skill, to the buyer endpoints under /v1/buyer/*. Credentials and base URLs are in 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
Lists
Collections answer { data: [...], pagination?: {...}, meta?: {...} }. data is always the array, never renamed to the noun. pagination is omitted (not null) when an endpoint returns everything; meta carries endpoint-specific extras (pendingCents, basis, note…). Facets, reports and single resources are not wrapped this way: read the endpoint's response schema in the spec.
Two paging styles. The OpenAPI entry says which one an endpoint takes: an endpoint accepts cursor exactly when its parameters list it.
| Style | Request | Response pagination |
Stop when |
|---|---|---|---|
| Page number (most lists) | ?page=1&limit=25 (page ≥ 1, limit 1-100, default 25) |
{ page, limit, total?, totalPages? } |
data.length < limit |
| Cursor (newer lists) | ?limit=50, then ?cursor=<nextCursor> |
{ limit, nextCursor, hasMore } |
nextCursor is null |
total/totalPages are optional: lighter lists skip the COUNT. Never loop on page < totalPages alone. A malformed cursor is a 400, never a silent restart. Cursors are stable under inserts; page numbers are not, so on a busy account sync with updatedSince (offered by GET /v1/listings, GET /v1/inventory, GET /v1/orders) rather than walking pages.
async function* pages<T>(fetchPage: (page: number) => Promise<{ data: T[] }>, limit = 100) {
for (let page = 1; ; page++) {
const { data } = await fetchPage(page);
yield* data;
if (data.length < limit) return;
}
}
for await (const l of pages((page) => crossly.listings.list({ page, limit: 100 }) as Promise<{ data: unknown[] }>)) { /* … */ }
Errors
Every non-2xx is the same envelope:
{ "error": { "code": "validation_error", "message": "Invalid input", "details": [{ "path": ["platforms"], "message": "Array must contain at least 1 element(s)" }] },
"correlationId": "…" }
Branch on error.code (stable, snake_case), show message (safe for end users), log correlationId and quote it to Crossly support. details varies by code. Tolerate unknown codes and unknown response fields.
| Code | HTTP | What to do |
|---|---|---|
missing_authorization, invalid_token, unauthenticated, unauthorized |
401 | Fix the credential. Don't retry |
credential_environment_mismatch |
401 | A test token on production or a live token on the sandbox |
insufficient_scope |
403 | error.required and error.have sit beside code (not under details). Get a token with that scope |
forbidden |
403 | The token is fine, the action isn't allowed (role, store permission, plan) |
not_found |
404 | Missing, or another account's resource (Crossly never answers 403 for cross-account ids) |
validation_error |
400 | details carries the zod path + message. Fix the body |
no_changes |
400 | A PATCH with no recognised field |
idempotency_key_required |
400 | A money-spending endpoint refuses a request without Idempotency-Key |
conflict, storefront_required, shop_selling_limit_reached |
409 | State conflict: re-read, then decide |
hard_cap_reached |
409 | A fixed ceiling (e.g. accounts per platform). Upgrading won't help |
gone |
410 | The resource or route was retired |
idempotency_key_reused |
422 | Same key, different body. Use a fresh key for a different intent |
storefront_requirements_missing |
422 | The store isn't set up enough for this action |
plan_limit_reached |
402 | A plan limit refused a new use. For monthly quotas details = { limitKey, limit, used, plan, resetsAt, upgradeTier, upgradeUrl } and Retry-After is the seconds to resetsAt. Nothing was written |
overage_consent_required |
402 | Would incur overage. Confirm with the seller, then resend with acceptOverage: true |
billing_failed |
402 | A Stripe charge declined; the action didn't complete |
plan_required, creator_limit_reached |
402 | Creator features need a higher plan (details.upgradeUrl) |
rate_limited |
429 | Wait Retry-After seconds |
retry_storm |
429 | The same request got the same non-retryable error more than 20 times in 10 minutes on one route. Fix the original error; any success on the route ends it |
external_service_error |
502 | A marketplace or provider failed. Retry later with the same idempotency key |
Domain endpoints add their own codes (refund_failed, dropship_not_allowed_on_platform, invalid_discount_code, …); each skill lists the ones for its area. The SDK throws CrosslyAPIError with .status, .code, .details; the CLI prints { error: { code, message, correlationId } } on stderr with --json.
Idempotency
Send Idempotency-Key: <key> on every POST and PATCH you might retry.
- The first response is stored for 24 h. A repeat with the same key and the same body replays it without running the handler, with
Idempotent-Replayed: trueon most routes. The same key with a different body is422 idempotency_key_reused. - Not stored (so a retry runs for real): 5xx, 401, 403, 409 and 429 responses.
- Keys are trimmed; a blank header is no key. Routes keep keys per token or per account; never share a key between two intents.
- Endpoints that spend money (purchases, labels, payouts and the like) refuse a request with no key (
400 idempotency_key_required). Derive that key from what is being bought (label-<orderId>), not a fresh UUID per attempt: a new random key on each retry passes the check and still double-buys after a timeout. - The automatic replay covers POST and PATCH. A
DELETEis replayed only where its route opts in, so re-read state before repeating one.
await crossly.listings.create(body, { idempotencyKey: `create-${sku}` }); // SDK: last argument
curl -X POST https://crossly.net/api/v1/listings -H "Authorization: Bearer $CROSSLY_PAT" \
-H "Content-Type: application/json" -H "Idempotency-Key: create-SKU-123" -d @listing.json
Rate limits
Per-minute quotas per token (one PAT, or one OAuth app's grant on one account, or one experience key). Two PATs on one account don't crowd each other.
| Plan | Writes / min | Reads / min |
|---|---|---|
| Free | 15 | 1,200 |
| Starter | 60 | 1,200 |
| Pro | 240 | 1,200 |
| Business | 1,000 | 1,200 |
| Scale | 2,000 | 1,200 |
Experience keys also share a per-experience bucket (600 writes, 6,000 reads a minute). The write tier follows the plan within about a minute of a change.
Every response carries the tightest bucket touched: X-Quota-Limit, X-Quota-Remaining, X-Quota-Reset (seconds until the window rolls). Over the limit: 429 rate_limited with Retry-After and details: { bucket, limit, window: "1m" }. Failed requests count too. The SDK does not retry for you, but its CrosslyAPIError exposes retryAfterSeconds from the header:
import { CrosslyAPIError } from '@crossly/sdk';
async function withRetry<T>(fn: () => Promise<T>, tries = 5): Promise<T> {
for (let i = 0; ; i++) {
try { return await fn(); }
catch (e) {
const retryable = e instanceof CrosslyAPIError && (e.status === 429 || e.status >= 500);
if (!retryable || i >= tries - 1) throw e;
const wait = (e as CrosslyAPIError & { retryAfterSeconds?: number }).retryAfterSeconds ?? 2 ** i;
await new Promise((r) => setTimeout(r, wait * 1000));
}
}
}
Never retry 400/402/403/404/409/422 unchanged: that is what trips retry_storm. Prefer bulk endpoints (see crossly-bulk-operations) over loops on low write tiers.
Deprecations and versioning
/v1is additive: new fields, optional parameters and endpoints appear at any time; renames and removals only ship under a new version. Ignore unknown fields; pin to field names.- A deprecated route answers with RFC 9745
Deprecation, RFC 8594Sunset(the last day it works) andLink: <successor>; rel="successor-version". Log them. Current examples:/v1/automation/rules/*→/v1/workflowsand/v1/orders/{id}/refund→/v1/orders/{id}/refunds, both working until 2027-03-01. Deprecated operations carrydeprecated: truein the OpenAPI spec.
Data conventions
- JSON, UTF-8. Timestamps are ISO 8601 UTC. Ids are UUIDs unless the spec says otherwise.
- Money follows the field name.
…Centsfields are integer cents. Older seller fields (priceon listings,salePrice,platformFee,netProfiton orders and sales) are dollars, as decimal strings or numbers depending on the endpoint. The buyer API is all cents. Convert to integer cents at the edge; never sum floats. - Multi-store accounts: send
X-Storefront-Id: <store id>to act on one store, else the default store is used (see crossly-team-stores). - Every response names its environment in
Crossly-Environment(productionorsandbox).
Specs and tools
- OpenAPI: https://crossly.net/openapi/seller.json and https://crossly.net/openapi/buyer.json, also served live at
https://crossly.net/api/v1/docs/json(Swagger UI at/api/v1/docs). - Generated SDKs exist for TypeScript, Python and other languages; see crossly-api-setup.
Before you finish
- List loops stop on a short page or a
nullcursor, never ontotalPagesalone. - Retries only on 429/5xx, honour
Retry-After, and reuse the sameIdempotency-Key. - Errors are matched on
error.code, withcorrelationIdlogged. - Money is converted to integer cents by field name.
Docs: https://crossly.net/docs/api-errors · https://crossly.net/docs/api-pagination · https://crossly.net/docs/api-rate-limits · https://crossly.net/docs/api-changelog
