Skip to main content

Overview

The SmartLead API uses standard HTTP status codes and structured error responses to communicate what went wrong. This guide covers how to interpret errors, implement robust retry logic, and debug the most common issues.

HTTP Status Codes

Error Response Format

Error responses follow a consistent JSON structure:

Implementing Error Handling

Basic Error Handler

Retry with Exponential Backoff

For transient errors (429, 500, 503), implement automatic retries:
Python
Always add random jitter to your backoff delay. Without jitter, multiple clients retrying at the same intervals will create “thundering herd” problems that amplify the load on the server.

Common Errors and Solutions

Cause: The api_key parameter is missing, expired, or incorrect.Fix: Verify your API key in SmartLead Settings → API Keys. Regenerate if needed. Ensure the key is passed as a query parameter: ?api_key=YOUR_KEY.
Cause: One or more leads in your lead_list are missing the email field.Fix: Validate your data before sending. Every lead object must have an email field with a valid email address.
Cause: You’re trying to import more than 400 leads in a single request.Fix: Batch your imports into groups of 400 or fewer. See the Lead Management Guide for a batching example.
Cause: The campaign ID doesn’t exist or belongs to a different account.Fix: Verify the campaign ID by listing your campaigns first:
Cause: A lead with the same email address is already in this campaign.Fix: This isn’t necessarily an error — SmartLead prevents duplicate sends. Check the skipped_leads array in the import response for details.
Cause: Too many requests in a short time period.Fix: Implement exponential backoff (see above). Check the Retry-After header for the recommended wait time. See the Rate Limits Guide for details.
Cause: An unexpected error on SmartLead’s servers.Fix: Retry with exponential backoff. If the error persists, check the SmartLead status page and contact support with the request details.

Debugging Tips

Log Every Request and Response

Python

Validate Data Before Sending

Python

What’s Next?

Rate Limits Guide

Understand rate limits and optimize request patterns

Best Practices

Build reliable integrations with production-grade patterns