Choose an environment
The SDK accepts an optionalenvironment field on construction:
The SDK routes each resource client to the correct service hosts for the selected environment. You do not pass base URLs or per-service overrides.
Staging and production may use different
authKey values. Confirm which key belongs to which environment with your Lomadee contact—do not assume one key works in both.Store the authKey as a secret
YourauthKey is equivalent to a long-lived API credential. Treat it like a database password:
- Load from environment variables (or your platform’s secret manager) at process startup.
- Never commit the key to git,
.envfiles checked into the repo, Docker image layers intended for public registries, or client-side bundles. - Restrict access in CI/CD and production to the roles that need it.
- Rotate on compromise—contact Lomadee support if a key may have leaked.
Recommended pattern
@thelomadee/sdk is published on the public npm registry. Installing it does not require a GitHub token or a custom .npmrc. Keep authKey as the only runtime secret.
Keep the SDK server-side
The SDK attachesauthKey as the x-auth-key header on every outbound request. Any process that loads the SDK therefore holds full partner access.
Local development checklist
-
LOMADEE_AUTH_KEYis set in your shell or local.env(gitignored) - Quickstart script runs successfully with
sdk.terms.latest() -
environment: 'staging'is used only when intentionally testing against staging
Related guides
- Quickstart — first install and verified request
- Error handling — surface failures without leaking secrets in logs
- How the SDK works — shared client, timeout, and resource layout