API Keys Overview
API keys are the foundation of CHRT’s authentication system. They grant access to specific features and operations while maintaining security through scopes, restrictions, and rate limits.Key Architecture
CHRT uses a dual-key system designed for both security and developer experience:Public Keys
chrt_pk_[env][team][random]
- Browser and mobile safe
- Origin domain restrictions
- Limited to read-only scopes
- CORS preflight support
Secret Keys
chrt_sk_[env][team][random]
- Server-to-server only
- Full administrative access
- One-time reveal security
- IP whitelist support
Key Lifecycle
Understanding the complete lifecycle helps you manage keys effectively:States Explained
- Active: Key is operational and can authenticate requests
- Transition: During regeneration, both old and new keys work
- Paused: Temporarily disabled but can be resumed
- Revoked: Permanently disabled and cannot be restored
Security Model
Scope-Based Permissions
Every API key has specific scopes that determine what operations it can perform:| Scope Category | Description | Example Scopes |
|---|---|---|
| ENC Charts | Electronic Navigational Chart access | enc.tiles:read, enc.mbtiles:download |
| Interactions | Chart feature identification | interact.identify:read |
| Features | Chart metadata and search | features.search:read |
| Queries | Spatial and attribute queries | query.spatial:read |
| Management | Key and team administration | keys.manage, team.manage |
Restriction Types
Enhance security with multiple restriction layers:Domain Restrictions (Public Keys)
Domain Restrictions (Public Keys)
Control which websites can use your public keys:
IP Allowlists
IP Allowlists
Restrict usage to specific IP addresses or ranges:
Time-Based Expiration
Time-Based Expiration
Set automatic expiration for temporary access:
Rate Limiting
All API keys include built-in rate limiting to prevent abuse and ensure fair usage:Rate Limit Tiers
| Plan | Requests/Hour | Burst Limit | Overage |
|---|---|---|---|
| Free | 1,000 | 100 | Blocked |
| Starter | 10,000 | 500 | Blocked |
| Pro | 100,000 | 2,000 | $0.01/req |
| Enterprise | Custom | Custom | Custom |
Rate Limit Headers
Every API response includes rate limit information:Usage Analytics
Track key usage with comprehensive analytics:Request Metrics
- Total requests
- Success/error rates
- Response times
- Geographic distribution
Feature Usage
- Tiles served
- Features identified
- Queries executed
- Bytes transferred
Security Events
- Failed authentications
- Domain violations
- IP restrictions
- Rate limit hits
Best Practices
1
Principle of Least Privilege
Grant only the minimum scopes required for each use case
2
Environment Separation
Use separate keys for development, staging, and production
3
Regular Rotation
Rotate keys every 90 days or after security incidents
4
Monitor Usage
Set up alerts for unusual patterns or rate limit approaches
5
Secure Storage
Store secret keys in environment variables or secure vaults
