Environments

Truthlock provides separate environments for development and production. Understanding the differences is crucial for proper integration.

Base URLs

EnvironmentAPI Base URLConsole URL
Sandboxhttps://sandbox-api.truthlocks.comhttps://console.truthlocks.com
Productionhttps://api.truthlocks.comhttps://console.truthlocks.com
Important: API keys are environment-specific. A development API key (prefix tl_dev_) will not work in production, and vice versa.

Environment Differences

FeatureSandboxProduction
API Key Prefixtl_dev_tl_live_
Issuer Auto-Approval✅ Issuers are auto-approved❌ Requires governance approval
Rate Limits1,000 req/minBased on tier (60-unlimited)
Daily Quota10,000 attestationsBased on tier
Data Retention30 daysPermanent
SLABest effort99.9% uptime
Transparency LogEphemeral (reset weekly)Permanent, append-only

API Key Structure

API keys include environment identifiers for easy recognition:

// Sandbox key
tl_dev_abc123def456gh789ijklmnopqrstuv

// Production key  
tl_live_xyz789abc123def456gh789ijklmno

Programmatic Detection

function getEnvironment(apiKey: string): 'development' | 'production' {
  if (apiKey.startsWith('tl_dev_')) return 'development';
  if (apiKey.startsWith('tl_live_')) return 'production';
  throw new Error('Invalid API key format');
}

function getBaseUrl(apiKey: string): string {
  const env = getEnvironment(apiKey);
  return env === 'development' 
    ? 'https://sandbox-api.truthlocks.com'
    : 'https://api.truthlocks.com';
}

Environment Configuration

Recommended environment variable setup for your application:

Sandbox (.env.local)

TRUTHLOCK_API_KEY=tl_dev_your_development_key
TRUTHLOCK_BASE_URL=https://sandbox-api.truthlocks.com
TRUTHLOCK_ENV=development

Production (.env.production)

TRUTHLOCK_API_KEY=tl_live_your_production_key
TRUTHLOCK_BASE_URL=https://api.truthlocks.com
TRUTHLOCK_ENV=production
Security: Never commit API keys to version control. Use secrets management (AWS Secrets Manager, HashiCorp Vault, Doppler) for production deployments.

Testing Best Practices

Integration Tests

Always run integration tests against the development environment. Never test with production credentials in CI/CD.

Mock Responses

For unit tests, use our SDK's built-in mock mode to avoid hitting the API entirely.

Data Cleanup

Sandbox data is reset weekly. Don't rely on persistent data in development for long-running tests.

Rate Limit Testing

Sandbox has generous rate limits. Ensure your app handles 429 responses gracefully for production.

Sandbox to Production

Follow this checklist when moving from development to production:

  1. Create production API keys in console.truthlocks.com
  2. Update environment variables with production credentials
  3. Re-register your issuers (development issuers don't carry over)
  4. Register production signing keys (use separate keys from development)
  5. Request governance approval for your issuers
  6. Configure webhook endpoints for production URLs
  7. Set up monitoring and alerting
  8. Test verification flow end-to-end

Next Steps