Expys has two environments, sandbox and live. They share one API host:
the environment is a property of the credential, not the URL. Routing is enforced
server-side from the token, so you never switch base URLs to change environments.
| Environment | Catalog | Use |
|---|
sandbox | A seeded demo catalog (offers, points currency, redeemable drops) | Build and test without real data |
live | Your real program data | Production |
How the environment is selected
- You create a sandbox or live Org-API-Key in the portal.
- Your backend exchanges that key for a member token. The token carries the
environment.
- The SDK’s
environment option is declarative - it labels the credential (and
appears in the User-Agent) but does not change the host. Set it to match the
key you used so the two never disagree.
A sandbox key cannot read live data and vice versa. If you see empty results or
403s, confirm the key’s environment matches the environment you configured.
Configuring the environment
import { type Environment, initialize } from "@expys/sdk";
const token = process.env.EXPYS_MEMBER_TOKEN;
if (!token) {
throw new Error(
"Set EXPYS_MEMBER_TOKEN (a member token from your backend's /v1/auth/exchange)",
);
}
// Default to sandbox for safe experimentation; pass EXPYS_ENV=live to go live.
const environment: Environment =
process.env.EXPYS_ENV === "live" ? "live" : "sandbox";
const expys = initialize({
baseUrl: process.env.EXPYS_BASE_URL,
environment,
// orgId is optional and only surfaces in the User-Agent for attribution.
orgId: process.env.EXPYS_ORG_ID,
token,
// Identify your app in the User-Agent alongside the SDK and environment.
userAgentSuffix: "examples/environments",
});
async function main(): Promise<void> {
console.log(`using the ${environment} environment`);
const { data } = await expys.listOffers({ limit: 5 });
console.log(`fetched ${data.length} offers`);
}
Base URL
The canonical host is https://api.expys.com - the default in all three SDKs.
You can point at a different deployment with the baseUrl option. See the
configuration reference.