DocIntell is currently invite-only. Contact your account manager to get started.
Overview
DocIntell uses API keys for programmatic access to the platform. Each API key:- Is scoped to a single tenant (your organization)
- Can be either
live(production) ortest(development) - Is hashed before storage (we never store plaintext keys)
- Can be rotated with zero downtime using grace periods
- Can be revoked immediately if compromised
Key Environments
DocIntell supports two key environments:| Environment | Prefix | Purpose | Billing |
|---|---|---|---|
| Test | dk_test_ | Development and testing | Free (no billing) |
| Live | dk_live_ | Production workloads | Billable usage |
Creating an API Key
Create a new API key by callingPOST /v1/keys:
Listing Your API Keys
View all API keys in your account withGET /v1/keys:
For security, the full API key is never shown after creation. Only the prefix (
dk_live_) and last 4 characters are displayed for identification.Response Fields
| Field | Description |
|---|---|
key_prefix | First 8 characters (e.g., dk_live_) |
key_suffix | Last 4 characters for identification |
status | active, deprecated, or revoked |
is_active | Whether the key can still be used for authentication |
deprecated_at | When key rotation began (if status is deprecated) |
grace_period_ends_at | When the deprecated key will stop working |
grace_period_days_remaining | Days left before deprecated key expires |
Rotating API Keys
Key rotation is the recommended way to update your API keys without service disruption. When you rotate a key:- A new key is created
- The old key is marked as deprecated (but still works)
- You have 7 days to migrate your systems
- After 7 days, the old key automatically expires
Why Rotate Keys?
Security Best Practice
Regular rotation limits the window of exposure if a key is compromised.
Zero Downtime
Grace period allows gradual migration without service interruption.
Compliance
Many compliance frameworks require periodic credential rotation.
Incident Response
Quick response to suspected key compromise without breaking production.
Step-by-Step Rotation
Update Your Applications
During the 7-day grace period, update your applications to use the new key:
- Update environment variables
- Redeploy services with the new key
- Update CI/CD pipelines
- Update secrets in your secrets manager (AWS Secrets Manager, GCP Secret Manager, etc.)
Both the old and new keys work during the grace period. There’s no rush to migrate everything at once.
Monitor Usage
Track which systems are still using the old key by checking the If the deprecated key’s
last_used_at timestamp:last_used_at timestamp is recent, some systems are still using it.Grace Period Details
| Timeline | Old Key | New Key |
|---|---|---|
| Day 0 (rotation) | deprecated (still works) | active |
| Days 1-7 | Both keys work | Both keys work |
| Day 8+ | Automatically expires | Active |
The 7-day grace period is fixed and cannot be extended. Plan your migration accordingly.
Revoking API Keys
If a key is compromised or no longer needed, revoke it immediately withDELETE /v1/keys/{key_id}:
204 No Content
When to Revoke vs Rotate
| Scenario | Action |
|---|---|
| Suspected key compromise | Revoke immediately, then create a new key |
| Routine security hygiene | Rotate (7-day grace period) |
| Decommissioning a service | Revoke once the service is shut down |
| Employee offboarding | Revoke keys associated with that employee |
Revoked keys are retained in the database for audit purposes but cannot be used for authentication.
Monitoring Your API Keys
Effective API key monitoring helps you maintain security, track usage, and prevent service disruptions during key rotation. TheGET /v1/keys endpoint provides comprehensive visibility into your key inventory.
List All Keys
Retrieve all API keys in your account with their metadata:Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
include_deprecated | boolean | true | Include keys in grace period (deprecated but still active) |
Response Fields
Each key in the response includes the following fields:| Field | Type | Description |
|---|---|---|
key_id | UUID | Unique identifier for the key |
name | string | Descriptive name (e.g., “Production Server”) |
key_prefix | string | First 8 characters (e.g., dk_live_) |
key_suffix | string | Last 4 characters for identification |
environment | string | live or test |
is_active | boolean | Whether the key can still be used for authentication |
status | string | Key lifecycle status: active, deprecated, or expired |
created_at | timestamp | When the key was created |
last_used_at | timestamp | Most recent successful authentication (null if never used) |
deprecated_at | timestamp | When rotation began (null if not deprecated) |
grace_period_ends_at | timestamp | When deprecated key expires (null if not deprecated) |
grace_period_days_remaining | integer | Days left before deprecated key expires (null if not deprecated) |
For security, the full API key is never shown after creation. Only the prefix (
dk_live_) and last 4 characters are displayed for identification.Key Status Lifecycle
API keys transition through three lifecycle states:Active
Normal operation
- Key is working and valid
status: "active"is_active: true- Can authenticate API requests
- No expiration date
Deprecated
Grace period after rotation
- Key was replaced via rotation
status: "deprecated"is_active: true(still works!)- Can still authenticate for 7 days
- Monitor
grace_period_days_remaining - Automatically expires after grace period
Monitoring Best Practices
Track Unused Keys
Identify keys that haven’t been used in 30+ days for security audits.
Monitor Grace Periods
Track keys nearing expiration during rotation.
Verify Active Keys
Ensure production services use active (non-deprecated) keys.
Set Up Alerts
Create automated alerts for key expiration.Example cron job (daily check):
Example: Automated Key Health Check
Here’s a complete script that monitors API key health and warns about potential issues:Best Practices
Store Keys Securely
Environment Variables
Store keys in environment variables, never in code:Access in your application:
Secrets Managers
Use a secrets manager for production:
- AWS Secrets Manager
- GCP Secret Manager
- HashiCorp Vault
- Azure Key Vault
Use Separate Keys per Environment
| Environment | Key Type | Storage | Purpose |
|---|---|---|---|
| Development | dk_test_ | .env.local | Local development |
| Staging | dk_test_ | Secrets manager | Integration testing |
| Production | dk_live_ | Secrets manager | Customer-facing workloads |
Test keys (
dk_test_) are free and never billed. Use them liberally for development and testing.Rotate Keys Regularly
Set a Rotation Schedule
Rotate keys every 90 days as a security best practice.Set calendar reminders or use automation:
Monitor Grace Periods
Track upcoming key expirations to avoid service disruptions.Check
grace_period_days_remaining in the API response.Minimize Key Scope
One Key per Service
Create separate API keys for each service or application.This limits the blast radius if one key is compromised.
Descriptive Names
Use clear, descriptive names:
- “Production API Server - us-east-1”
- “CI/CD Pipeline - GitHub Actions”
“My Key”“Test”
Monitor for Suspicious Activity
Checklast_used_at timestamps regularly:
Error Handling
Missing Authorization Header
401 Unauthorized
Fix: Include the Authorization: Bearer header in all requests.
Invalid API Key
401 Unauthorized
Possible Causes:
- Key was revoked
- Key expired after grace period
- Typo in the key value
- Wrong environment (using test key on production URL or vice versa)
Malformed Authorization Header
401 Unauthorized
Fix: Ensure the header format is exactly: Authorization: Bearer dk_live_...