Authentication
Important: Keep your API credentials secure. Never expose them in client-side code or public repositories.
Authentication Methods
VardaCal API supports two authentication methods depending on your use case:
API Key Authentication (Recommended)
For server-to-server communication and platform integrations. Use your API key and secret in the request headers.
Required Headers:
X-API-Key: your_api_key_here
X-API-Secret: your_api_secret_here
Example Request:
curl -X GET https://api.vardacal.com/api/v1/platform/bookings \
-H "X-API-Key: vck_1234567890abcdef" \
-H "X-API-Secret: vcs_abcdef1234567890"
JWT Token Authentication
For user-specific actions and frontend applications. Obtain a JWT token through the login endpoint.
1. Obtain Token:
curl -X POST https://api.vardacal.com/api/v1/login \
-H "Content-Type: application/json" \
-d '{
"email": "user@example.com",
"password": "your_password"
}'
2. Use Token in Requests:
curl -X GET https://api.vardacal.com/api/v1/me \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
API Scopes
API tokens can be configured with specific scopes to limit access:
| Scope | Description | Available In |
|---|---|---|
| read:self | Read your own data | All plans |
| write:self | Modify your own data | All plans |
| read:org | Read organization data | Team plans |
| write:org | Modify organization data | Team plans |
| manage:webhooks | Manage webhook configurations | Pro plans |
| impersonate:users | Act on behalf of other users | Platform only |
Generating API Keys
-
1.
Log in to your VardaCal dashboard
-
2.
Navigate to Settings → API Keys
-
3.
Click Generate New API Key
-
4.
Select the required scopes for your integration
-
5.
Copy and securely store your API key and secret
Warning: Your API secret will only be displayed once. Store it securely and never commit it to version control.
Security Best Practices
Use environment variables
Store API credentials in environment variables, not in code
Rotate keys regularly
Regenerate API keys periodically for enhanced security
Use HTTPS only
Always use HTTPS when making API requests
Limit scope access
Only grant the minimum required scopes for each integration
Monitor usage
Regularly review API usage logs for suspicious activity
Example Implementations
// Using Fetch API
const apiKey = process.env.VARDACAL_API_KEY;
const apiSecret = process.env.VARDACAL_API_SECRET;
const response = await fetch('https://api.vardacal.com/api/v1/bookings', {
headers: {
'X-API-Key': apiKey,
'X-API-Secret': apiSecret,
'Content-Type': 'application/json'
}
});
const data = await response.json();
console.log(data);