Documentation Index
Fetch the complete documentation index at: https://mintlify.com/workos/workos-node/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The API Keys API allows you to programmatically manage and validate API keys used by your organization. This is useful for building internal tools, implementing security workflows, or managing API key lifecycles.Methods
validateApiKey
Validates an API key and retrieves its details.Validation options
Validation response
Example - Valid Key
Response - Valid Key
Response - Invalid Key
deleteApiKey
Deletes an API key by its ID.The unique identifier of the API key to delete
Returns nothing on successful deletion
Example
Use Cases
Key Validation
Verify API keys before processing requests in your application
Key Rotation
Implement automated key rotation workflows for enhanced security
Audit Trail
Track API key usage and last access times for compliance
Access Control
Validate permissions before allowing access to sensitive operations
Security Best Practices
Store Keys Securely
Store Keys Securely
Never commit API keys to version control. Use environment variables or secret management services like AWS Secrets Manager, HashiCorp Vault, or Azure Key Vault.
Rotate Keys Regularly
Rotate Keys Regularly
Implement a key rotation schedule (e.g., every 90 days) to minimize the impact of potential key compromise.
Use Least Privilege
Use Least Privilege
Create API keys with only the permissions necessary for their intended use case.
Monitor Usage
Monitor Usage
Track
lastUsedAt timestamps to identify unused or suspicious API key activity.Revoke Compromised Keys
Revoke Compromised Keys
Immediately delete API keys that may have been exposed or compromised.
Example - Key Rotation Workflow
Related Resources
Authentication
Learn about WorkOS authentication concepts
Client Initialization
Initialize the WorkOS client with API keys
Organizations
Manage organization-scoped API keys
Audit Logs
Track API key usage in audit logs