Authentication
Learn how to authenticate your requests with the Sakneen API.
API Key Authentication
Sakneen API uses API key authentication. You need to include your API key in every request header.
Getting Your API Key
- Contact Sakneen support team
- Provide your company details and use case
- Receive your unique API key and assigned domain
Using Your API Key
Include the API key in your request headers:
curl -X POST "https://your-domain/external/apis/v1.0/leads" \
-H "api-key: your-api-key-here" \
-H "Content-Type: application/json"
Note: Replace your-domain with the actual domain provided by Sakneen support.
Security Best Practices
- Never expose your API key in client-side code
- Store API keys securely using environment variables
- Rotate your API keys regularly
- Use HTTPS in production environments
Example Implementation
JavaScript/Node.js
const apiKey = process.env.SAKNEEN_API_KEY;
const baseDomain = process.env.SAKNEEN_DOMAIN; // e.g., "your-domain"
const response = await fetch(`https://${baseDomain}/external/apis/v1.0/leads`, {
method: 'POST',
headers: {
'api-key': apiKey,
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'John Doe',
phoneNumber: '+1234567890',
project: 'Downtown Tower',
email: '[email protected]'
})
});
Python
import os
import requests
api_key = os.getenv('SAKNEEN_API_KEY')
base_domain = os.getenv('SAKNEEN_DOMAIN') # e.g., "your-domain"
headers = {
'api-key': api_key,
'Content-Type': 'application/json'
}
data = {
'name': 'John Doe',
'phoneNumber': '+1234567890',
'project': 'Downtown Tower',
'email': '[email protected]'
}
````markdown
}
response = requests.post(
f'https://{base_domain}/external/apis/v1.0/leads',
json=data,
headers=headers
)