Environments
There are two environments. They share no data and no keys.
| Base URL | Gifts | |
|---|---|---|
| Production | https://api.1up.gift |
Real. Real money, real codes, real emails. |
| Staging | https://api.staging.1up.gift |
Test. Codes are issued but never billable. |
Keys are environment-scoped
Section titled “Keys are environment-scoped”A key is minted for one environment and authenticates only there. Pointing a staging key at
production returns 401 Unauthorized — the key is not “wrong”, it simply does not exist in that
environment.
This is deliberate: it means a misconfigured base URL fails loudly at the first call, rather than quietly sending real gift cards from a test harness.
GET /me echoes the environment back, so a startup check can assert it:
{ "customerId": 412, "environment": "staging"}Building against staging
Section titled “Building against staging”Staging is a full copy of the API backed by test suppliers. Orders are placed, codes are issued and emails are queued exactly as in production, but no gift card is ever purchased and no money moves.
Codes issued in staging are not redeemable for anything.
Configuring your client
Section titled “Configuring your client”Keep the base URL and the key together, as a pair, and switch them as one:
const config = { production: { baseUrl: 'https://api.1up.gift', key: process.env.LIVE_KEY }, staging: { baseUrl: 'https://api.staging.1up.gift', key: process.env.TEST_KEY },}[process.env.NODE_ENV === 'production' ? 'production' : 'staging']