Skip to main content

Overview

SmartLead API uses API keys for authentication. Your API key carries many privileges, so be sure to keep it secure!

Getting Your API Key

1

Login to SmartLead

Visit app.smartlead.ai and log in to your account
2

Navigate to Settings

Click on your profile icon and select “Settings” → “API Keys”
3

Generate New Key

Click “Generate New API Key” button
4

Copy and Store Securely

Copy the generated API key and store it securely. This key will not be shown again.
API keys are equivalent to your password. Never commit them to version control, share them publicly, or expose them in client-side code.

Using Your API Key

Pass your API key as a query parameter in the URL:
GET https://server.smartlead.ai/api/v1/campaigns/?api_key=YOUR_API_KEY

Request Body Method

For POST/PATCH requests, you can also include the API key in the request body:
{
  "api_key": "YOUR_API_KEY",
  "name": "My Campaign"
}

Example Requests

curl -X GET "https://server.smartlead.ai/api/v1/campaigns/?api_key=YOUR_API_KEY" \
  -H "Content-Type: application/json"

Authentication Errors

If your API key is invalid or missing, you’ll receive a 401 Unauthorized response:
{
  "success": false,
  "error": {
    "code": "UNAUTHORIZED",
    "message": "Invalid or missing API key"
  }
}

Best Practices

  • Use environment variables or secure key management systems
  • Never hardcode API keys in your source code
  • Rotate your API keys periodically
# .env file
SMARTLEAD_API_KEY=your_api_key_here
import os
API_KEY = os.getenv('SMARTLEAD_API_KEY')
Always check for authentication errors and handle them appropriately in your application.

Rate Limiting

Your API key is subject to rate limiting based on your subscription plan. See Rate Limits for more information.

Multiple API Keys

You can generate multiple API keys for different applications or environments:
  • Production Key: For your live application
  • Development Key: For testing and development
  • Integration Keys: For specific third-party integrations
Generate separate API keys for different environments to better manage access and track usage.

Regenerating API Keys

If you suspect your API key has been compromised:
  1. Log in to your dashboard
  2. Navigate to Settings → API Keys
  3. Click “Regenerate” next to the compromised key
  4. Update your application with the new key
Regenerating an API key will immediately invalidate the old key. Make sure to update all applications using the old key.

What’s Next?