How to store Seller API credentials, separate sandbox from production, and rotate keys without downtime.
What this covers#
Secret storage, environment variables, webhook secrets, and a zero-downtime rotation sequence. Complements Authentication and Security.
What you store#
| Secret | Used for |
|---|---|
AVRIX_API_KEY | Bearer token on Seller API requests |
AVRIX_BASE_URL | API host (usually https://api.avrix.io) |
AVRIX_WEBHOOK_SECRET | HMAC verification of webhook bodies |
Avrix shows the raw API key once at creation. Store it immediately in your secret manager; you cannot retrieve the plaintext later.
Environment separation#
Sandbox and production share the same host. The key selects the environment.
- Sandbox keys see the shared sandbox catalog and magic SKUs.
- Production keys see only your live commercial catalog.
- Mixing a production key with sandbox expectations (or the reverse) fails with environment mismatch errors — see Environments.
Inject different secret values per deploy stage (development, pre-production, production). Never paste a production key into a shared chat or CI log.
Client config from env#
Load secrets at process start; fail fast if the key is missing.
# Prefer env vars — never hardcode secrets in source control
export AVRIX_API_KEY="avrix_sk_sbx_your_key_here"
export AVRIX_BASE_URL="https://api.avrix.io"Rotation without downtime#
Both the old and new keys remain valid until you revoke the old one.
Checklist#
- Create a second key with the same scopes and environment.
- Copy optional IP allowlist entries onto the new key.
- Deploy the new
AVRIX_API_KEYto your pre-production stack first. - Verify with GET /whoami, a catalog read, and a dry-run preview.
- Revoke the old key after traffic moves off it.
Webhook secrets rotate the same way: register the new secret with overlap, verify signatures against either secret during the window, then drop the old one.
Least privilege#
Mint keys with only the scopes your integration needs. A catalog-sync worker does not need refund write scopes. Confirm effective scopes on GET /whoami after every create or rotate — see Scope matrix.
Logging hygiene#
- Never log the full API key or webhook secret.
- Prefer
requestId, key id (if shown in console), andorderReferencein support tickets. - Redact
Authorizationheaders from HTTP debug dumps in non-production.
Common mistakes#
- Committing
.envfiles that contain live keys. - Rotating by deleting the only key before the deploy finishes.
- Using one key for both sandbox experiments and production traffic.
- Sharing a production key in a group chat “just for a quick test”.
Next steps#
- Authentication — scopes and key lifecycle
- IP allowlist — optional egress restrictions
- Go-live — production cutover