Key Types Overview
Developer Keys
Authenticate developer console access and manage projects
API Keys (Project Keys)
Authenticate end-user access to specific projects
Developer Keys
Developer Keys authenticate developers accessing the Cloud Admin console and performing administrative operations.Developer Keys changed from
dk_ prefix to ak_ prefix in v1.5.0. The new format improves consistency across key types.Format Specification
Prefix:ak_ (API Key)
Structure: ak_ + 32 URL-safe characters
Character set: Alphanumeric (a-z, A-Z, 0-9) plus hyphen (-) and underscore (_)
Example: ak_abc123XYZ-_789def456ghi012jkl345
Total length: 35 characters
- 3 characters: prefix (
ak_) - 32 characters: random URL-safe string
Properties
| Property | Value |
|---|---|
| Prefix | ak_ |
| Length | 35 characters total |
| Character set | a-zA-Z0-9-_ |
| Encoding | URL-safe |
| Hashing | SHA-256 |
| Storage | Hash + 8-char prefix |
| Display format | ak_abc12... |
| Scope | Developer account |
| Limit | 10 active keys per developer |
Usage
Environment variable:- Required for console mode deployment
- Used to create and manage projects
- Grants access to developer-scoped resources
- Can be used alongside project keys for elevated operations
Generation
Developer Keys are generated:- Automatically during developer registration (operator-initiated)
- Manually via Cloud Admin console
- Via API:
POST /api/v1/auth/developer-keys
Security
API Keys (Project Keys)
API Keys authenticate end-user access to specific projects. They are also referred to as “Project Keys” in environment variables and some documentation.Format Specification
Prefix:ak_ (API Key)
Structure: ak_ + 32 URL-safe characters
Character set: Alphanumeric (a-z, A-Z, 0-9) plus hyphen (-) and underscore (_)
Example: ak_def456ABC-_012ghi789jkl345mno678
Total length: 35 characters
- 3 characters: prefix (
ak_) - 32 characters: random URL-safe string
Properties
| Property | Value |
|---|---|
| Prefix | ak_ |
| Length | 35 characters total |
| Character set | a-zA-Z0-9-_ |
| Encoding | URL-safe |
| Hashing | SHA-256 |
| Storage | Hash + 8-char prefix |
| Display format | ak_def45... |
| Scope | Specific project |
| Limit | Unlimited per project |
Usage
Environment variable:The environment variable name uses
PROJECT_KEY for clarity. Both Developer Keys and Project Keys use the ak_ prefix as of v1.5.0, distinguished only by their scope.- Required for project mode deployment (Starter Kit)
- Scopes all API requests to a specific project
- Used by end-users accessing project resources
- Validated against
project_idin requests
Generation
API Keys are generated:- Automatically during project creation (default key)
- Manually via Cloud Admin console
- Via API:
POST /api/v1/projects/{project_id}/api-keys
Security
Key Comparison
| Feature | Developer Key (ak_) | API Key (ak_) |
|---|---|---|
| Purpose | Developer console access | End-user project access |
| Prefix | ak_ | ak_ |
| Character set | Alphanumeric + - + _ | Alphanumeric + - + _ |
| Length | 35 characters | 35 characters |
| Scope | Developer account | Specific project |
| Limit | 10 per developer | Unlimited per project |
| Header | X-Developer-Key | X-API-Key |
| Env var | DEVKIT4AI_DEVELOPER_KEY | DEVKIT4AI_PROJECT_KEY |
| Used in | Console mode, operator mode | Project mode |
Both key types now use identical format (
ak_ prefix + 32 URL-safe characters). The distinction is in their scope and usage, not their format.Validation Rules
Length Validation
Both key types must:- Be exactly 35 characters long
- Start with correct prefix (
dk_orak_) - Contain 32 random characters after prefix
Character Set Validation
Developer Keys (ak_):
ak_):
Both key types use identical validation regex as of v1.5.0. The system distinguishes key types by their database associations (developer_id vs project_id), not by format differences.
Backend Validation
The backend performs these checks:- Minimum length: At least 16 characters (during validation)
- Prefix check: Correct prefix for key type
- Hash lookup: SHA-256 hash exists in database
- Active status: Key is marked as active
- Scope validation: Key matches required scope (developer/project)
Display Format
Keys are displayed in truncated format for security: Full key (shown once):key_prefix field and shown in user interfaces.
Storage Architecture
Database Schema
Both key types follow the same storage pattern: DeveloperKey Table:Security Implementation
- Generation: Random cryptographically secure string
- Display: Full key shown once in API response
- Hashing: SHA-256 hash computed immediately
- Storage: Only hash and prefix persisted to database
- Validation: Incoming keys hashed and compared against stored hash
Best Practices
Key Management
Key Management
- Generate separate keys for each environment (dev, staging, production)
- Use descriptive names when creating keys
- Document which keys are used where
- Maintain an inventory of active keys
Security
Security
- Store keys in environment variables, never in code
- Use hosting provider secrets management for production
- Rotate keys every 90 days as a best practice
- Revoke compromised keys immediately
- Never log full keys, only prefixes
Deployment
Deployment
- Set
DEVKIT4AI_DEVELOPER_KEYfor console mode - Set both
DEVKIT4AI_DEVELOPER_KEYandDEVKIT4AI_PROJECT_KEYfor project mode - Validate key format before deployment
- Test with new keys before revoking old ones
Troubleshooting
Troubleshooting
- Verify correct prefix (
dk_vsak_) - Check key length (must be 35 characters)
- Confirm key is marked as active in Cloud Admin
- Ensure environment variables are loaded correctly
- Check that key matches the required scope
Code Examples
Validating Key Format (TypeScript)
Since v1.5.0, both Developer Keys and Project Keys use the same format validation. Scope differentiation happens at the database level, not format level.
Environment Configuration
.env.local

