Authentication
Secure your API calls with API keys. Learn how to generate, manage, and use authentication tokens.
Getting Your API Key
To get your API key:
- Sign up at app.cognitivex.ai
- Navigate to Settings → API Keys
- Click “Generate New Key”
- Copy your key (it will only be shown once)
- Store it securely in your environment variables
Security Warning: Never commit your API key to version control. Always use environment variables or secret management services.
Using API Keys in the SDK
Initialize the SDK with your API key:
client.tstypescript
import { CognitiveXClient } from '@cognitivex/sdk';
const client = new CognitiveXClient({
apiKey: process.env.COGNITIVEX_API_KEY
});Environment Variables
Create a .env file in your project root:
.envbash
COGNITIVEX_API_KEY=your_api_key_hereAdd .env to your .gitignore:
.gitignorebash
.env
.env.local
.env.*.localREST API Authentication
Include your API key in the Authorization header:
bash
curl -X POST https://api.cognitivex.ai/v1/memory/store \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"content": "Your content here"}'Security Best Practices
- ✓Use environment variables - Never hardcode API keys
- ✓Rotate keys regularly - Generate new keys every 90 days
- ✓Use different keys - Separate keys for dev, staging, production
- ✓Monitor usage - Set up alerts for unusual activity
- ✓Revoke immediately - If a key is compromised, revoke it immediately
Rate Limits
API rate limits vary by plan:
- • Starter: 100 requests/minute
- • Professional: 1,000 requests/minute
- • Enterprise: Custom limits
Rate limit headers are included in every response. See the API Reference for details.