Secure your API requests with industry-standard authentication
OAuth 2.0
Industry standard
TLS 1.3
Encrypted transport
HMAC SHA-256
Request signing
The simplest method for server-to-server communication:
Navigate to Settings → API Keys in your dashboard
API Key: sk_live_1234567890abcdefghijklmnop Secret: sk_secret_abcdefghijklmnopqrstuvwxyz123456
Authorization: Bearer sk_live_1234567890abcdefghijklmnop
Security: Never expose API keys in client-side code. Use environment variables.
For applications that can securely store secrets:
Step 1: Redirect to Authorization
https://auth.cognexiaai.com/oauth/authorize? client_id=YOUR_CLIENT_ID& redirect_uri=https://yourapp.com/callback& response_type=code& scope=crm:read crm:write hr:read
Step 2: Exchange Code for Token
curl -X POST https://auth.cognexiaai.com/oauth/token \
-H "Content-Type: application/json" \
-d '{
"grant_type": "authorization_code",
"code": "AUTH_CODE",
"client_id": "YOUR_CLIENT_ID",
"client_secret": "YOUR_CLIENT_SECRET",
"redirect_uri": "https://yourapp.com/callback"
}'Response:
{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"token_type": "Bearer",
"expires_in": 3600,
"refresh_token": "refresh_1234567890",
"scope": "crm:read crm:write hr:read"
}curl -X POST https://auth.cognexiaai.com/oauth/token \
-H "Content-Type: application/json" \
-d '{
"grant_type": "refresh_token",
"refresh_token": "refresh_1234567890",
"client_id": "YOUR_CLIENT_ID",
"client_secret": "YOUR_CLIENT_SECRET"
}'crm:readRead CRM contacts and dealscrm:writeCreate and update CRM datahr:readRead employee datahr:writeManage employees and attendancefinance:readView financial recordsfinance:writeCreate invoices and transactionsadminFull administrative accessVerify webhook authenticity using HMAC signatures:
const crypto = require('crypto');
function verifyWebhook(payload, signature, secret) {
const hmac = crypto
.createHmac('sha256', secret)
.update(payload)
.digest('hex');
return crypto.timingSafeEqual(
Buffer.from(signature),
Buffer.from(hmac)
);
}
// Usage
const isValid = verifyWebhook(
req.body,
req.headers['x-cognexia-signature'],
process.env.WEBHOOK_SECRET
);Rotate API Keys Regularly
Change keys every 90 days or after team member changes
Use Environment Variables
Never hardcode keys in source code or commit to version control
Principle of Least Privilege
Request only the scopes you need