This developer guide covers integrating email warmup API integration into your application stack — with production-ready code, error handling, environment management, and performance tips.
Quick Start
Get your API key at ZeroPhantom Credits (free tier available). Then test immediately:
# Test the API from terminal
curl -X POST https://api.zphantom.com/v1/process \
-H "X-API-Key: your_key_here" \
-H "Content-Type: application/json" \
-d '{"type": "convert", "input": "data"}'
Production Python Integration
import requests, os
ZP_KEY = os.environ['ZP_API_KEY'] # Never hardcode keys!
def process(data: str) -> dict:
r = requests.post(
'https://api.zphantom.com/v1/process',
headers={'X-API-Key': ZP_KEY},
json={'input': data},
timeout=30
)
r.raise_for_status()
return r.json()
# Retry wrapper
from tenacity import retry, stop_after_attempt, wait_exponential
@retry(stop=stop_after_attempt(3), wait=wait_exponential(min=1, max=10))
def process_with_retry(data: str) -> dict:
return process(data)
Environment Configuration
Never hardcode API keys. Use environment variables or a secrets manager:
# .env file (add to .gitignore!)
ZP_API_KEY=sk_live_your_key_here
# Load in Python
from dotenv import load_dotenv
import os
load_dotenv()
api_key = os.getenv('ZP_API_KEY')
Performance Optimisation
- Connection pooling: reuse HTTP sessions —
requests.Session()is 10–15× faster for multiple calls - Async processing: use
asyncio+aiohttpfor high-volume parallel requests - Batch endpoints: process multiple items in one call where supported
- Caching: cache identical inputs — the same file processed twice costs 2 credits; cached, it costs 1
Monitoring and Observability
import logging, time
logger = logging.getLogger(__name__)
def process_with_logging(data):
start = time.time()
try:
result = process(data)
logger.info(f"Success in {time.time()-start:.2f}s, credits_left={result['credits_remaining']}")
return result
except Exception as e:
logger.error(f"Failed after {time.time()-start:.2f}s: {e}")
raise
Rate Limits
Rate limit: 60 requests/minute. Handle 429 responses with exponential backoff.
One credit wallet covers file conversion, OCR, and temp mail — credits never expire. See full technical reference at ZeroPhantom API Docs.
💡 Pro Tip: Set up a credits-remaining alert at 500 credits so you never hit zero mid-workflow.
Try it free: ZeroPhantom API Docs — no signup, no KYC. See ZeroPhantom Credits for full pricing.