Test keys vs. live keys
The key prefix is the only thing that selects an environment. Every store has both pairs.
The two never cross. A test key only ever reads and writes sandbox data; a live key only ever
touches production. There is no flag to flip and no header to set — the environment follows the key
automatically.
Every authenticated response carries a
Tybrite-Environment: production | sandbox header, so you
can always confirm which environment resolved for a request.What is isolated
Transactional data you create through the API is stamped with the environment of the key that created it. That includes:- Orders
- Customers
- Carts and wishlists
- Product reviews
- Messaging conversations
- Returns
404, never a hint that the record lives
elsewhere).
Discount instruments are isolated too. Promotions, gift cards, and campaigns each belong to one
environment: a test key resolves only sandbox instruments, and a live key only real ones. Because
these are normally created by the merchant in their admin — which always writes production — you
create your own with the seed endpoints rather than borrowing the
merchant’s.
Catalog data is shared. Products, categories, and collections are read-as-is in both
environments — a test key reads the merchant’s real catalog, so you can build and test a realistic
storefront against actual products. It just gets no production transactional data tied to those
reads: a test key sees only the orders, customers, and carts created in sandbox.
A test key never changes the merchant’s stock. A sandbox order goes through the full order
lifecycle — it is created, marked paid, and settles any stock it reserved at checkout — and reports
success as a live order does, but it never lowers the merchant’s real stock count. Reservations made
with a test key count only against other sandbox reservations, so sandbox checkouts never hold back
stock from real customers. By default a test key reads the merchant’s live stock; a
sandbox stock level gives a variant a sandbox-only count instead.
A test key sees every provider and integration the merchant has configured, including ones still on
test credentials. A sandbox checkout can therefore list providers labelled test or sandbox,
which is what makes an integration testable before it is live.
Live keys resolve the same configuration differently: a provider or integration holding test
credentials is not offered to a real customer and is refused if requested directly — see
Guardrails. The provider list a sandbox key returns is consequently a
superset of the one a live key returns for the same store.
Sandbox data is invisible in the merchant’s app
Sandbox rows exist only for API testing. They never appear in the merchant’s admin dashboard, the storefront, reports, or anywhere in the product — so your test traffic can’t pollute a merchant’s numbers or clutter their order list.Automatic cleanup
Sandbox data is automatically purged after 30 days, so a sandbox record is not a durable store — a test suite that needs particular data re-seeds it rather than assuming a previous run’s rows are still there. The purge can also be triggered on demand rather than waited for.API keys are never auto-deleted. Only the transactional sandbox data (orders, customers, carts,
reviews, messaging, etc.) is cleaned up. Your test keys remain valid until you remove them yourself.
Developer tools
These operations control sandbox state directly. All require a secret test key (tybrite_sk_test_*), only ever affect your sandbox data, and are available via client.sandbox in
the SDK (full reference: SandboxService).
Sandbox reset
Removes all sandbox test data in one call, ahead of the 30-day cleanup — a clean slate before a test run.Time travel
Advances your sandbox by N days, so time-dependent behaviour resolves without a real wait: Galactic Core back-dates your sandbox data, elapsing abandoned-cart windows, releasing reserved stock, and rolling analytics forward.not_shifted explains what is intentionally left alone. To test promotion or
gift-card expiry, seed one with a near-future end date using the endpoints below.
Sandbox stock levels
POST /v1/sandbox/stock gives a variant a sandbox-only stock count, so low-stock and sold-out
behaviour can be tested without touching the merchant’s inventory. A test key reads the level in
place of live stock wherever stock appears — product and priced-product reads, shoppable posts and
lookbooks, cart and wishlist stock checks, and checkout reservations — and paid sandbox orders take
from it. A level of 0 makes the variant sold out for test keys.
GET /v1/sandbox/stock lists the levels beside each variant’s live count, DELETE /v1/sandbox/stock/{variant_id} returns one variant to live stock, and DELETE /v1/sandbox/stock
or a sandbox reset removes them all. Live keys and the merchant’s admin always
read live stock.
Webhook replay
Re-sends a recorded sandbox webhook event to your sandbox endpoints (those created with a test key) without recreating the underlying order or customer, so a handler can be iterated on against the same payload.Seed discount instruments
A sandbox order with nothing to discount only exercises half a checkout. Promotions, gift cards, and campaigns are created by the merchant in their admin, which always writes production data — so these three endpoints are how each comes to exist in your sandbox. Every field is optional. The defaults produce a ready-to-use instrument, so an empty body is enough to get a working discount.Seed a dynamic-pricing rule
Dynamic pricing is the other thing that changes what a shopper is charged, and it is environment- scoped for the same reason: a test key resolves only the rules you seed, never the merchant’s real pricing strategy./v1/prices/* then returns the rule-adjusted price for your test key, and the unchanged price for a
live one. Seeding refreshes your sandbox pricing cache, so the rule applies on the next request.
Reach the B2B endpoints
The/v1/b2b/* endpoints resolve a B2B buyer account for the calling customer before doing
anything else, and refuse the request when there isn’t one. Buyer accounts are created by the
merchant in their admin, so a test key has none — which makes the whole B2B surface unreachable
until you seed one.
404 whether or not a buyer
account exists.
Seeded instruments are sandbox rows like any other: they never appear in the merchant’s admin, they
are cleared by a reset, and they are removed by the automatic 30-day cleanup. A
test run that needs a particular instrument seeds it rather than assuming a previous run’s is still
there.

