Getting Started

Base URL

All API requests are made against the following base URL:
https://lunarsend.com/api/v2

Authentication

LunarSend uses API keys to authenticate requests.
Include your key in the x-api-key header as $LUNARSEND_API_KEY
You can generate and manage keys from your dashboard
Keep keys secret, rotate them regularly, and revoke compromised keys immediately

Pagination and Search

Most /search endpoints support:
page and per_page query parameters for pagination
Flexible search via query parameters like search_term and search_by

Error Handling

All errors return a JSON object with:
error: short machine-readable error code
message: human-readable explanation

Common Status Codes

400 Bad request (invalid input)
401 Unauthorized (missing/invalid API key)
403 Forbidden (not allowed for this resource)
404 Not found
429 Too many requests (rate limit exceeded)
500 Server error

Best Practices

Most /search endpoints support:
Store API keys securely - never commit them to public repos
Implement retries with backoff - for 429 or 500 errors
Sanitize HTML inputs - when rendering email content