API Keys
Manage your API credentials for submitting leads to Ledly.
Overview
API keys authenticate your lead submissions. Each key is associated with your vendor account and includes:
- Key ID - Public identifier
- API Key - Secret authentication token
- Permissions - What the key can access
- Rate Limits - Request limits per minute
Generating an API Key
Navigate to API Keys
Go to Settings → API Keys in the vendor portal
Click Generate
Click the Generate New Key button
Configure the Key
- Name: Descriptive label (e.g., “Production Server”)
- Environment: Production or Sandbox
- Rate Limit: Requests per minute (if configurable)
Copy Your Key
Copy the API key immediately - it won’t be shown again
Store Securely
Save the key in a password manager or secrets vault
Critical: Your API key is displayed only once. If you lose it, you must generate a new one.
Using Your API Key
Include the API key in the Authorization header:
curl -X POST https://api.ledly.io/api/leads/inbound \
-H "Authorization: Bearer vk_live_abc123xyz..." \
-H "Content-Type: application/json" \
-d '{"email": "[email protected]"}'Key Formats
| Environment | Prefix | Example |
|---|---|---|
| Production | vk_live_ | vk_live_abc123xyz... |
| Sandbox | vk_test_ | vk_test_abc123xyz... |
Managing Keys
Viewing Keys
Your active keys show:
- Key name
- Created date
- Last used
- Status (active/revoked)
Revoking a Key
If a key is compromised:
- Go to Settings → API Keys
- Find the compromised key
- Click Revoke
- Confirm revocation
Revocation is immediate. Any systems using that key will immediately fail authentication.
Regenerating a Key
To get a new key without revoking:
- Click Regenerate next to the key
- The old key remains active for 24 hours
- Update your systems with the new key
- Old key automatically expires
Multiple Keys
You can have multiple API keys for different purposes:
| Key Name | Purpose |
|---|---|
| Production Server | Main lead submission |
| Backup Server | Failover system |
| Development | Local testing |
| Partner Integration | Third-party system |
Best Practices
- Separate production and development - Never use production keys for testing
- Name keys descriptively - Know which system uses which key
- Rotate regularly - Replace keys every 6-12 months
- Revoke unused keys - Remove keys for decommissioned systems
Rate Limits
Each API key has rate limits:
| Plan | Limit | Window |
|---|---|---|
| Education | 1,000 requests | Per minute |
| Enterprise | Custom | Custom |
Rate Limit Headers
Response headers show your limit status:
X-RateLimit-Limit: 500
X-RateLimit-Remaining: 450
X-RateLimit-Reset: 1703505600When Rate Limited
{
"success": false,
"error": "Rate limit exceeded",
"retry_after": 30
}Solution: Wait retry_after seconds or implement backoff.
IP Whitelisting
Optionally restrict key usage to specific IPs:
- Go to Settings → API Keys
- Select a key → IP Whitelist
- Add allowed IP addresses/ranges
- Save
Whitelist Formats
Single IP: 203.0.113.50
Range (CIDR): 203.0.113.0/24
Multiple: 203.0.113.50, 203.0.113.51When IP whitelisting is enabled, requests from non-whitelisted IPs are rejected with a 403 error.
Key Usage Statistics
Monitor your API key usage:
Available Metrics
| Metric | Description |
|---|---|
| Total Requests | Lifetime request count |
| Today’s Requests | Requests in last 24 hours |
| Success Rate | Percentage of successful submissions |
| Avg Response Time | Average API response time |
| Last Used | Time of most recent request |
Viewing Stats
- Go to Settings → API Keys
- Click Stats next to any key
- View usage over time
Security Best Practices
Do:
- Store keys in environment variables
- Use secrets management (Vault, AWS Secrets Manager)
- Rotate keys regularly
- Use separate keys per environment
- Monitor for unusual activity
Don’t:
- Commit keys to version control
- Share keys via email or chat
- Use production keys for development
- Log keys in plain text
- Hardcode keys in source code
Secure Storage Examples
Environment Variable:
export LEDLY_API_KEY="vk_live_abc123xyz..."Node.js (.env file):
LEDLY_API_KEY=vk_live_abc123xyz...Python:
import os
api_key = os.environ.get('LEDLY_API_KEY')Troubleshooting
”Invalid API Key” Error
- Verify the key was copied correctly (no extra spaces)
- Check the key hasn’t been revoked
- Ensure you’re using the correct environment (prod vs sandbox)
- Confirm the key prefix matches the endpoint
”Forbidden” (403) Error
- Check if IP whitelisting is enabled
- Verify your IP is in the whitelist
- Confirm the key has required permissions
”Rate Limited” (429) Error
- Implement exponential backoff
- Check
X-RateLimit-Remainingbefore requests - Request a rate limit increase if needed
API Key Lifecycle
Generate → Active → (Optional: Regenerate) → Revoke → Deleted| State | Description |
|---|---|
| Active | Key can authenticate requests |
| Regenerating | New key issued, old key has 24h grace period |
| Revoked | Key immediately stops working |
| Deleted | Key removed from system after 30 days |