Integrate the Crossly API
Crossly has two APIs on one host with two different principals. Decide which one before writing any code:
| Seller API | Buyer API | |
|---|---|---|
| Acts on | a seller's store: inventory, listings, crossposting, orders, sales, webhooks, automations | a shopper's own cart, orders, wishlists, offers, cashback |
| Paths | /v1/* (e.g. GET /v1/listings) |
/v1/buyer/* (e.g. GET /v1/buyer/orders) |
| Spec | https://crossly.net/openapi/seller.json | https://crossly.net/openapi/buyer.json |
| Credential | a personal access token, or an OAuth access token with seller scopes (<domain>:<read|write>) |
an OAuth access token with buyer:* scopes only. There is no buyer PAT |
| TypeScript | @crossly/sdk |
@crossly/buyer-sdk |
| Python | crossly (seller) |
crossly-buyer |
The Python clients are generated from the specs and live at https://github.com/crossly-dev/crossly-python. They are not on PyPI yet: install from GitHub with pip install "git+https://github.com/crossly-dev/crossly-python#subdirectory=seller" (buyer: subdirectory=buyer); switch to pip install crossly / crossly-buyer once those names resolve.
A seller token is refused by every buyer endpoint and the reverse, even for the same Crossly account. A 401 on a call that looks right usually means the other API's token.
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
Base URLs and environments
- Production:
https://crossly.net/api+ the spec path, e.g.https://crossly.net/api/v1/me. - Sandbox:
https://sandbox.crossly.net/api(a separate account, seeded data, Stripe test mode). - The environment word in a credential is enforced:
crossly_pat_live_…works only on crossly.net andcrossly_pat_test_…only in the sandbox. The wrong one is401 credential_environment_mismatch. Every response names its environment in theCrossly-Environmentheader.
Credentials
From https://crossly.net/docs/api-authentication:
| Credential | Shape | Where it may be used |
|---|---|---|
| Personal access token (PAT) | crossly_pat_<live|test>_<8 hex prefix>_<32 char secret> |
Server-side only: your scripts, CI, agents. Acts as the user who minted it, with the scopes ticked. Never in a browser bundle |
| OAuth access token | a JWT (eyJ…) from https://crossly.net/atlas/oauth2/token, aud = https://crossly.net/api/v1, lives 8 h, refreshable |
A third-party app acting for a seller (seller scopes) or a shopper (buyer:* scopes). Stored server-side |
| Publishable key | crossly_pk_<live|test>_<hex> |
Public web pages only (@crossly/embed). Reads one storefront's active listings and starts a checkout, nothing else |
| Experience key | crossly_ek_<live|test>_… |
Creator back-ends only (worlds, items, game packages), from the key's IP allowlist |
| Webhook signing secret | 64 hex characters, shown once | Verifying deliveries. Never sent back to Crossly |
The PAT's 8-hex prefix segment is safe to log; the secret segment never is. Read tokens from the environment (CROSSLY_PAT), never commit them, and never put a PAT or an OAuth token in frontend code: a browser only ever gets a crossly_pk_… key.
OAuth token shapes. OAuth access tokens from Atlas are JWTs (eyJ…). @crossly/sdk 0.3.0 accepts crossly_pat_…, a JWT access token, a legacy crossly_oat_… or a cbx_… token in the pat option; @crossly/buyer-sdk 0.2.0 accepts a JWT or a legacy crossly_oat_… and refuses crossly_pat_… on purpose. Upgrade older SDK versions: 0.2.0 / 0.1.0 refused JWTs in the constructor.
First call
Seller, TypeScript (npm install @crossly/sdk):
import { createClient, CrosslyAPIError } from '@crossly/sdk';
const crossly = createClient({ pat: process.env.CROSSLY_PAT! }); // crossly_pat_… or an OAuth JWT
const me = await crossly.profile.me(); // GET /v1/me: who you are, the PAT's scopes, account state
const page = await crossly.listings.list({ page: 1, limit: 100, status: 'active' });
The SDK picks the base URL from the token (_test_ → https://sandbox.crossly.net/api); override with baseUrl. On a multi-store account pass storefrontId to createClient (or per request) to send X-Storefront-Id; without it calls act on the default store (see crossly-team-stores).
Seller, Python (installed as above):
import os
import crossly
from crossly.api import listings_api
config = crossly.Configuration(access_token=os.environ["CROSSLY_TOKEN"]) # crossly_pat_…
with crossly.ApiClient(config) as client:
page = listings_api.ListingsApi(client).list_listings(page=1, limit=25)
for item in page.data:
print(item.id, item.title, item.status)
Plain HTTP:
curl -sS https://crossly.net/api/v1/me -H "Authorization: Bearer $CROSSLY_PAT"
Buyer, TypeScript (npm install @crossly/buyer-sdk): createBuyerClient({ token }), then crossly.cart.get(), crossly.orders.list(), crossly.offers.make(…). It refuses a crossly_pat_ token at construction on purpose. Buyer money is always integer cents (amountCents, totalCents), and paying normally happens on Crossly with the shopper present. The one exception is buyer:checkout:write, which completes a purchase with a saved card only up to a spending limit the shopper sets on that key and only if they switch it on (see crossly-buyer-api).
Scopes
Scopes are checked per endpoint. Use least privilege:
- a crossposter:
inventory:read+listings:write - fulfilment or shipping:
orders:read+fulfillment:write(orders:writealso refunds and cancels) - reporting:
sales:read,analytics:read - webhooks:
webhooks:read,webhooks:write
* is only for your own whole-store agent. Third-party apps can never request *, billing:write, team:read, team:manage, payouts:write, funding:write, funding:approve, apps:read, apps:write or the per-game key scopes, and the world*/session:handoff first-party scopes are reserved for Crossly's own apps. inbox:* covers messages and offers; messages:* covers messages only. The full list is at https://crossly.net/docs/api-scopes and GET /v1/pat/scopes.
OAuth apps (third-party integrations)
Issuer https://crossly.net/atlas; discovery at https://crossly.net/atlas/.well-known/openid-configuration. Authorization code flow, PKCE S256 required.
- Send the user to
https://crossly.net/atlas/oauth2/authorizewithresponse_type=code,client_id,redirect_uri,resource=https://crossly.net/api/v1, ascopethat includesopenid(addoffline_accessfor a refresh token),state,code_challenge,code_challenge_method=S256. - Exchange the code at
POST https://crossly.net/atlas/oauth2/tokenwithgrant_type=authorization_code,code,code_verifier,redirect_uri,resource. A confidential app authenticates with HTTP Basic; a public app sends onlyclient_id. - Refresh with
grant_type=refresh_token. Refresh tokens rotate: always store the new one, and never refresh the same token from two processes. - Revoke at
https://crossly.net/atlas/oauth2/revoke.
Register apps under Settings → API & webhooks → OAuth apps. Registration, consent, review, per-app webhooks and app-managed listings are in the crossly-oauth-apps skill.
Responses you must handle
The full rules (both paging styles, every common error code, idempotency details, quotas, deprecation headers) are in crossly-api-conventions. The short version:
- Lists return
{ data: [...], pagination: { page, limit, total?, totalPages? } }.pageis 1-based;limitdefaults to 25, max 100. Many lists omittotal: stop whendata.length < limit. Newer lists page bycursor(pagination.nextCursor,nullon the last page). - Errors: every 4xx and 5xx is
{ "error": { "code", "message", "details"? }, "correlationId"? }. Branch onerror.code(stable), showmessage, and logcorrelationId(quote it to Crossly support). The SDK throwsCrosslyAPIErrorwith.status,.codeand.details. - 401 vs 403:
401(missing_authorization,invalid_token,credential_environment_mismatch) means fix the credential.403 insufficient_scopecarrieserror.requiredanderror.have: get a token with the missing scope instead of retrying.503 atlas_unavailableis not a verdict on the token: retry after a short wait. - 429 (
rate_limitedorretry_storm): wait at leastRetry-Afterseconds (the SDK error hasretryAfterSeconds). Every response carriesX-Quota-Limit,X-Quota-RemainingandX-Quota-Reset. Writes per minute per token depend on the plan (Free 15, Starter 60, Pro 240, Business 1,000, Scale 2,000); reads are 1,200 a minute. The SDK does not retry for you. - 402 (
plan_limit_reached,overage_consent_required): nothing was written; tell the seller. - Idempotency: send
Idempotency-Key: <key>on every POST or PATCH you might retry (SDK:{ idempotencyKey }as the last argument). The first response is replayed for 24 h withIdempotent-Replayed: true; the same key with a different body is422 idempotency_key_reused. Endpoints that spend money refuse a request without one (400 idempotency_key_required).
Money
Read the field name. Fields named …Cents are integer cents, and the buyer API is all cents. The seller listing price and the order and sale fields salePrice, platformFee and netProfit are dollars (decimal strings or JSON numbers depending on the endpoint), and POST /v1/listings takes data.price in dollars. Don't do arithmetic on money in floats: convert to integer cents at the edge.
Before you finish
- The credential matches the API (seller or buyer) and lives only server-side; only
crossly_pk_…appears in client code. - List calls page to the end, 429s honour
Retry-After, and retried writes carry anIdempotency-Key. - Errors log
error.codeandcorrelationId.
Docs: https://crossly.net/docs · Scopes: https://crossly.net/docs/api-scopes · Errors: https://crossly.net/docs/api-errors · Rate limits: https://crossly.net/docs/api-rate-limits
