Test Environment
API Sandbox
Test your integration without affecting production data or incurring charges. Use mock scenarios to simulate edge cases and error conditions.
API Mode
Sandbox - Test data
jk_test_xxx...
Sandbox vs Live Mode
Sandbox Mode
jk_test_*- No charges incurred
- Mock data responses
- Simulate error scenarios
- Predictable test fixtures
- Higher rate limits
- Data cleared weekly
Live Mode
jk_live_*- Real valuations billed
- Live market data
- Production performance
- Full accuracy
- Data persisted permanently
- Standard rate limits
Mock Scenarios
Code Examples
Test vs Live API Keys
# Use test API keys for sandbox mode # Test keys start with jk_test_ instead of jk_live_ # Test key (sandbox - no charges, mock data) export JUSTKALM_API_KEY="jk_test_abc123xyz" # Live key (production - real valuations) export JUSTKALM_API_KEY="jk_live_xyz789abc"
Trigger Mock Scenarios
# Trigger specific test scenarios with headers
curl https://api.justkalm.com/v2/valuate \
-H "Authorization: Bearer jk_test_xxx" \
-H "X-Mock-Scenario: rate_limit" \
-d '{"url": "https://example.com/product"}'
# Response: 429 Too Many Requests
{
"error": {
"code": "rate_limit_exceeded",
"message": "Rate limit exceeded",
"retry_after": 60
}
}Test Fixtures
# Use test fixtures for predictable responses
curl https://api.justkalm.com/v2/valuate \
-H "Authorization: Bearer jk_test_xxx" \
-d '{"url": "https://test.justkalm.com/fixtures/lv-neverfull"}'
# Returns fixture: Louis Vuitton Neverfull
{
"id": "val_test_lv001",
"price_min": 1450,
"price_max": 1850,
"brand": "Louis Vuitton",
"model": "Neverfull MM",
"confidence": 95
}
# Available test fixtures:
# /fixtures/lv-neverfull - Louis Vuitton bag
# /fixtures/chanel-flap - Chanel Classic Flap
# /fixtures/rolex-submariner - Rolex watch
# /fixtures/hermes-birkin - Hermès Birkin
# /fixtures/unknown-item - Low confidence resultSDK Sandbox Mode
import { JustKalm } from '@justkalm/sdk';
// Initialize in test mode
const client = new JustKalm({
apiKey: process.env.JUSTKALM_TEST_KEY, // jk_test_xxx
sandbox: true, // Explicit sandbox mode
});
// Run test valuations (no charges)
const result = await client.valuate('https://example.com/product');
// Simulate specific scenarios
const rateLimitTest = await client.valuate(url, {
mockScenario: 'rate_limit',
});
// Use test fixtures
const fixture = await client.testFixtures.get('lv-neverfull');
console.log(fixture.priceRange); // "$1,450 - $1,850"Best Practices
Use Environment Variables
Store test and live keys in separate env vars. Your CI/CD should automatically use test keys.
Test Error Handling
Use mock scenarios to test rate limits, timeouts, and errors before they happen in production.
Sandbox Data Resets Weekly
Don't rely on sandbox data persistence. Use fixtures for consistent test data.
Never Mix Keys
Keep test and live keys separate. Never commit live keys to source control.