Skip to main content

Security Best Practices

Security is critical when working with AI platforms. This guide covers best practices for protecting your Claro API keys, managing access, and maintaining a secure integration.

API Key Management

Creating Secure API Keys

1

Use Descriptive Names

Name API keys by environment and purpose:
2

Create Environment-Specific Keys

Never share API keys across environments:
  • Development - Local testing only
  • Staging - Pre-production validation
  • Production - Live applications only
3

Document Key Purpose

Keep a record of what each key is used for:
4

Save Keys Immediately

API keys are only shown once during creation. Save them securely immediately.
If you lose an API key, you must delete it and create a new one. There is no way to retrieve a lost key.

Storing API Keys Securely

Never commit API keys to version control or share them publicly:
Local Development
Load in your application:
Always add .env to .gitignore:

Key Rotation

Regular key rotation reduces the risk of compromised keys:

Rotation Schedule

Development

Every 6 months Lower risk, less frequent rotation

Staging

Every 3 months Regular rotation for testing

Production

Every 90 days Highest security standard

Safe Rotation Process

1

Create New Key

Generate a new API key in the Claro dashboard
2

Deploy New Key

Update your application with the new key:
  • Update environment variables
  • Deploy to staging first
  • Test thoroughly
  • Deploy to production
3

Monitor for Issues

Watch for errors over 24-48 hours:
  • Check error rates
  • Monitor authentication failures
  • Verify all services updated
4

Delete Old Key

Once confirmed the new key works everywhere, delete the old key
Never delete the old key before deploying the new one. This will break your production application.

Emergency Key Rotation

If you suspect a key is compromised:
1

Immediately Create New Key

Don’t wait - create a replacement key right away
2

Quick Deploy

Deploy the new key as quickly as possible, even if it means brief downtime
3

Delete Compromised Key

Delete the compromised key immediately to prevent unauthorized access
4

Audit Access

Review API access logs to understand the extent of unauthorized use
5

Notify Team

Alert your security team and stakeholders

Access Control

Workspace Permissions

Limit who can create and manage API keys:
Only Owners and Admins should manage API keys.

Service Accounts

For production systems, use service accounts instead of personal accounts:
1

Create Service Account

Create a dedicated account for your application (e.g., api-production@company.com)
2

Add to Workspace

Invite the service account to your workspace with appropriate permissions
3

Generate API Keys

Create API keys from the service account
4

Document Ownership

Document which team owns each service account
Service accounts ensure API keys aren’t tied to individual employees who may leave the organization.

Audit Logging

Monitoring API Usage

Track API key usage in the Claro dashboard:
1

Navigate to API Keys

Go to Settings → API Keys in the Claro dashboard
2

View Usage Statistics

For each key, review:
  • Last used timestamp
  • Total requests
  • Error rates
  • Usage patterns
3

Identify Anomalies

Look for suspicious activity:
  • Unexpected spikes in usage
  • Requests from unusual locations
  • High error rates
  • Usage of supposedly inactive keys

Automated Monitoring

Set up alerts for suspicious activity:

Secrets Management

Environment-Specific Secrets

Never mix secrets across environments:

Secrets in Configuration Files

Never commit secrets to git:
Load secrets at runtime:

OWASP Considerations

Preventing Common Vulnerabilities

Risk: User input injected into prompts could manipulate LLM behaviorPrevention:
Risk: Sensitive data leaked through prompts or API responsesPrevention:
  • Never include PII in prompts
  • Redact sensitive data before logging
  • Use environment-specific prompts
  • Implement data classification
Risk: Unable to detect or investigate security incidentsPrevention:
Risk: Unauthorized access to your application’s AI featuresPrevention: Always validate users before allowing prompt access:
Risk: API abuse or DoS attacksPrevention: Implement rate limiting on your endpoints:

Compliance

Data Privacy Regulations

General Data Protection Regulation (EU)Key requirements:
  • Data minimization - collect only necessary data
  • Right to deletion - allow users to delete their data
  • Data portability - export user data on request
  • Consent management - explicit user consent required
Implementation:

Security Checklist

  • API keys stored in environment variables, never in code
  • .env files added to .gitignore
  • No hardcoded secrets in configuration files
  • Sensitive data redacted in logs
  • Code review process includes security checks
  • Production API keys different from dev/staging
  • Keys stored in secrets manager (AWS/GCP/Azure)
  • Regular key rotation schedule (every 90 days)
  • Service accounts used instead of personal accounts
  • HTTPS enforced for all API calls
  • Rate limiting implemented
  • Authentication required for AI endpoints
  • API usage monitored for anomalies
  • Security events logged
  • Alerts configured for suspicious activity
  • Regular access reviews conducted
  • Unused API keys deleted
  • Audit trail maintained for compliance
  • Incident response plan documented
  • Emergency key rotation procedure tested
  • Security contact information current
  • Breach notification process defined
  • Regular security training for team

Incident Response

If an API Key is Compromised

1

Immediate Actions (0-15 minutes)

  1. Delete compromised key immediately
  2. Create new API key
  3. Deploy new key to production
  4. Alert security team
2

Investigation (15-60 minutes)

  1. Review audit logs for unauthorized access
  2. Identify what data was accessed
  3. Determine scope of breach
  4. Document timeline of events
3

Remediation (1-24 hours)

  1. Rotate all related credentials
  2. Update security procedures
  3. Implement additional monitoring
  4. Review and update access controls
4

Post-Incident (1-7 days)

  1. Conduct post-mortem analysis
  2. Update documentation
  3. Train team on lessons learned
  4. Implement preventive measures
  5. Notify affected parties if required

Next Steps

Error Handling

Handle authentication errors gracefully

Testing

Test with secure API key management

Performance

Optimize API usage to reduce exposure

Workspace Collaboration

Manage team access securely