Environments
HalvorAI has two environments. They are separate deployments with separate databases, so test and live data never mix.
| Sandbox | Production | |
|---|---|---|
| API base URL | https://api.sandbox.halvorai.com | https://api.halvorai.com |
| Key prefix | hk_test_ | hk_live_ |
Event environment | test | live |
| Purpose | Building and testing your integration | Real payments |
| Test data retention | 30 days, then purged | 7 years by default |
Keys and environments
Section titled “Keys and environments”Every API key belongs to one environment, and its prefix tells you which. A key only works against its own
environment’s API. If you send a test key to production, or a live key to the sandbox, the API answers
401 with the error code key_environment_mismatch and a message naming both. Nothing is stored.
The SDK picks the right base URL from the key prefix, so you rarely set it yourself.
Events must match the key
Section titled “Events must match the key”Each event carries an environment field. It has to match the key that sends it. An event that says live
sent with a test key is rejected with environment_mismatch, and the rest of the batch is unaffected.
Moving to production
Section titled “Moving to production”- Create a live key in the production dashboard. Live keys can be created by admins and owners.
- Run
npx @halvorai/ingest initagain with the live key. It registers a new source for production, with its own signing key. - Set
HALVOR_API_KEYandHALVOR_SOURCE_KEYin your production secrets. - Send one real event and confirm it in the production dashboard.
Sources are per environment. A source registered in the sandbox cannot send production events.
Test data
Section titled “Test data”Sandbox is safe to fill with traffic. You can use the validate endpoint to check events without storing them at all.