📧 Email Scraper API

Complete REST API documentation for B2B email scraping service

🌟 Overview

The Email Scraper API allows you to programmatically submit email scraping jobs, monitor their progress, and retrieve results. Our AI-powered system finds targeted B2B email addresses based on your niche specifications.

Base URL

https://efficientpim.com/api/ess

Key Features

  • ✅ AI-powered niche expansion and targeting
  • ✅ Real-time job progress monitoring
  • ✅ Multiple export formats (JSON, CSV)
  • ✅ Company name extraction and B2B focus
  • ✅ Automatic credit management
  • ✅ Rate limiting and security
💡 Pro Tip: All API requests require your unique API key. You can find and manage your API key in your dashboard.

🔐 Authentication

All API requests require authentication using your personal API key. Include your API key in the request body for POST requests or as a query parameter for GET requests.

API Key Format

ess_[32-character-random-string]

Authentication Methods

Method 1: Request Body (Recommended for POST)

{ "api_key": "your-api-key-here", "niche": "your niche or description of your target audience" }

Method 2: Query Parameter (for GET requests)

GET /api/ess/balance?api_key=your-api-key-here

Method 3: Header (Alternative)

X-API-Key: your-api-key-here
⚠️ Security Note: Keep your API key secure and never share it publicly. Regenerate your key immediately if compromised.

🚀 Submit Scraping Job

POST /api/ess/submit

Submit a new email scraping job with AI-powered targeting.

Parameters

ParameterTypeRequiredDescription
api_keystringRequiredYour personal API key
nichestringRequiredTarget niche or industry (e.g., "digital marketing agencies")
target_countintegerRequiredNumber of emails to scrape (1-100000)

Example Request

curl -X POST "https://efficientpim.com/api/ess/submit" \ -H "Content-Type: application/json" \ -d '{ "api_key": "ess_1i3v1MbVoCYIvAcm3sCFkoi1VWGUp3kA", "niche": "digital marketing agencies in London", "target_count": 250 }'

Responses

200 OK - Success
{ "success": true, "job_id": 12345, "niche": "digital marketing agencies in London", "target_count": 250, "credits_remaining": 750, "status": "pending", "submitted_at": "2024-01-15 14:30:22", "estimated_completion": "2024-01-15 14:33:22" }
402 Payment Required - Insufficient Credits
{ "success": false, "error": "insufficient_credits", "message": "Insufficient credits. You have 50 credits, but need 250", "credits_available": 50, "credits_needed": 250 }

📊 Check Job Status

GET /api/ess/status/{job_id}

Check the current status and progress of a scraping job.

Parameters

ParameterTypeRequiredDescription
job_idintegerRequiredJob ID returned from submit endpoint
api_keystringRequiredYour personal API key

Example Request

curl -X GET "https://efficientpim.com/api/ess/status/12345?api_key=ess_1i3v1MbVoCYIvAcm3sCFkoi1VWGUp3kA"

Job Status Values

  • pending - Job submitted, waiting to start
  • processing - Currently scraping emails
  • completed - Job finished successfully
  • failed - Job failed due to error

Responses

200 OK - Success (Processing)
{ "job_id": 12345, "niche": "digital marketing agencies in London", "status": "processing", "target_count": 250, "current_count": 156, "progress_percentage": 62, "created_at": "2024-01-15 14:30:22", "completed_at": null, "error_message": null, "estimated_completion": "2024-01-15 14:33:22" }
200 OK - Success (Completed)
{ "job_id": 12345, "niche": "digital marketing agencies in London", "status": "completed", "target_count": 250, "current_count": 247, "progress_percentage": 100, "created_at": "2024-01-15 14:30:22", "completed_at": "2024-01-15 14:32:15", "error_message": null }

📄 Get Job Results

GET /api/ess/results/{job_id}

Retrieve the scraped email results from a completed job.

Parameters

ParameterTypeRequiredDescription
job_idintegerRequiredJob ID of completed job
api_keystringRequiredYour personal API key
formatstringOptionalResponse format: "json" (default) or "csv"

Example Requests

# Get results as JSON curl -X GET "https://efficientpim.com/api/ess/results/12345?api_key=ess_1i3v1MbVoCYIvAcm3sCFkoi1VWGUp3kA"# Get results as CSV curl -X GET "https://efficientpim.com/api/ess/results/12345?api_key=ess_1i3v1MbVoCYIvAcm3sCFkoi1VWGUp3kA&format=csv"

Responses

200 OK - JSON Format
{ "job_id": 12345, "niche": "digital marketing agencies in London", "total_count": 247, "results": [ { "email": "[email protected]", "company_name": "Digital Agency Ltd", "source_url": "https://digitalagency.com/contact" }, { "email": "[email protected]", "company_name": "Creative Studio", "source_url": "https://creativestudio.co.uk/about" } ], "completed_at": "2024-01-15 14:32:15", "export_formats": { "json": "https://efficientpim.com/api/ess/results/12345?format=json&api_key=YOUR_KEY", "csv": "https://efficientpim.com/api/ess/results/12345?format=csv&api_key=YOUR_KEY" } }
200 OK - CSV Format
Email,Company Name,Source URL "[email protected]","Digital Agency Ltd","https://digitalagency.com/contact" "[email protected]","Creative Studio","https://creativestudio.co.uk/about" "[email protected]","Marketing Pro","https://marketingpro.com/"
400 Bad Request - Job Not Completed
{ "success": false, "error": "job_not_completed", "message": "Job is not completed yet", "current_status": "processing", "progress_percentage": 62 }

💰 Check Credit Balance

GET /api/ess/balance

Check your current credit balance.

Parameters

ParameterTypeRequiredDescription
api_keystringRequiredYour personal API key

Example Request

curl -X GET "https://efficientpim.com/api/ess/balance?api_key=ess_1i3v1MbVoCYIvAcm3sCFkoi1VWGUp3kA"

Response

200 OK - Success
{ "user_id": 123, "username": "john_doe", "credits_available": 750, "last_updated": "2024-01-15 14:25:10" }

👤 Account Information

GET /api/ess/account

Get detailed account information and usage statistics.

Parameters

ParameterTypeRequiredDescription
api_keystringRequiredYour personal API key

Example Request

curl -X GET "https://efficientpim.com/api/ess/account?api_key=ess_1i3v1MbVoCYIvAcm3sCFkoi1VWGUp3kA"

Response

200 OK - Success
{ "account": { "user_id": 123, "username": "john_doe", "email": "[email protected]", "registered": "2024-01-01 12:00:00", "credits_available": 750 }, "statistics": { "total_jobs_submitted": 15, "completed_jobs": 14, "total_emails_scraped": 3420, "success_rate": "93%", "last_activity": "2024-01-15 14:30:22" }, "api_info": { "api_key_length": 36, "rate_limits": { "requests_per_minute": 60, "requests_per_hour": 1000, "concurrent_jobs": 5 } } }

⚠️ Error Codes

The API uses standard HTTP response codes to indicate success or failure of requests.

HTTP Status Codes

CodeStatusDescription
200OKRequest successful
400Bad RequestInvalid request parameters
401UnauthorizedMissing or invalid API key
402Payment RequiredInsufficient credits
404Not FoundJob not found or access denied
500Internal Server ErrorServer error occurred

Common Error Response Format

{ "success": false, "error": "error_code", "message": "Human readable error message", "details": { "additional": "context information" } }

Common Error Codes

Error CodeDescriptionSolution
missing_api_keyAPI key not providedInclude your API key in the request
invalid_api_keyAPI key is invalid or expiredCheck your API key or regenerate a new one
insufficient_creditsNot enough credits for the requestPurchase more credits or reduce target_count
invalid_nicheNiche parameter is empty or invalidProvide a valid niche description
invalid_target_countTarget count outside allowed rangeUse a value between 1 and 100000
job_not_foundJob ID doesn't exist or access deniedCheck the job ID and your permissions
job_not_completedTrying to get results from incomplete jobWait for job to complete before requesting results

🔧 Code Examples

Here are complete examples in different programming languages:

JavaScript (Node.js)

const axios = require('axios');class EmailScraperAPI { constructor(apiKey, baseUrl = 'https://efficientpim.com/api/ess') { this.apiKey = apiKey; this.baseUrl = baseUrl; }async submitJob(niche, targetCount) { try { const response = await axios.post(`${this.baseUrl}/submit`, { api_key: this.apiKey, niche: niche, target_count: targetCount }); return response.data; } catch (error) { throw new Error(`API Error: ${error.response?.data?.message || error.message}`); } }async checkStatus(jobId) { try { const response = await axios.get(`${this.baseUrl}/status/${jobId}`, { params: { api_key: this.apiKey } }); return response.data; } catch (error) { throw new Error(`API Error: ${error.response?.data?.message || error.message}`); } }async getResults(jobId, format = 'json') { try { const response = await axios.get(`${this.baseUrl}/results/${jobId}`, { params: { api_key: this.apiKey, format: format } }); return response.data; } catch (error) { throw new Error(`API Error: ${error.response?.data?.message || error.message}`); } } }// Usage example async function main() { const api = new EmailScraperAPI('ess_your_api_key_here'); try { // Submit job const job = await api.submitJob('digital marketing agencies', 100); console.log('Job submitted:', job.job_id); // Monitor progress let status; do { await new Promise(resolve => setTimeout(resolve, 5000)); // Wait 5 seconds status = await api.checkStatus(job.job_id); console.log(`Progress: ${status.progress_percentage}%`); } while (status.status === 'processing'); // Get results if (status.status === 'completed') { const results = await api.getResults(job.job_id); console.log(`Found ${results.total_count} emails`); } } catch (error) { console.error('Error:', error.message); } }main();

Python

import requests import time import jsonclass EmailScraperAPI: def __init__(self, api_key, base_url='https://efficientpim.com/api/ess'): self.api_key = api_key self.base_url = base_url def submit_job(self, niche, target_count): """Submit a new scraping job""" url = f"{self.base_url}/submit" data = { 'api_key': self.api_key, 'niche': niche, 'target_count': target_count } response = requests.post(url, json=data) response.raise_for_status() return response.json() def check_status(self, job_id): """Check job status""" url = f"{self.base_url}/status/{job_id}" params = {'api_key': self.api_key} response = requests.get(url, params=params) response.raise_for_status() return response.json() def get_results(self, job_id, format='json'): """Get job results""" url = f"{self.base_url}/results/{job_id}" params = {'api_key': self.api_key, 'format': format} response = requests.get(url, params=params) response.raise_for_status() if format == 'csv': return response.text return response.json() def get_balance(self): """Get credit balance""" url = f"{self.base_url}/balance" params = {'api_key': self.api_key} response = requests.get(url, params=params) response.raise_for_status() return response.json()# Usage example def main(): api = EmailScraperAPI('ess_your_api_key_here') try: # Check balance balance = api.get_balance() print(f"Credits available: {balance['credits_available']}") # Submit job job = api.submit_job('digital marketing agencies in NYC', 150) print(f"Job submitted: {job['job_id']}") # Monitor progress while True: status = api.check_status(job['job_id']) print(f"Status: {status['status']} - Progress: {status['progress_percentage']}%") if status['status'] in ['completed', 'failed']: break time.sleep(10) # Wait 10 seconds # Get results if completed if status['status'] == 'completed': results = api.get_results(job['job_id']) print(f"Found {results['total_count']} emails") # Save as CSV csv_data = api.get_results(job['job_id'], format='csv') with open(f"emails_{job['job_id']}.csv", 'w') as f: f.write(csv_data) print("Results saved to CSV file") except requests.RequestException as e: print(f"API Error: {e}")if __name__ == "__main__": main()

PHP

apiKey = $apiKey; $this->baseUrl = $baseUrl; } public function submitJob($niche, $targetCount) { $url = $this->baseUrl . '/submit'; $data = [ 'api_key' => $this->apiKey, 'niche' => $niche, 'target_count' => $targetCount ]; return $this->makeRequest('POST', $url, $data); } public function checkStatus($jobId) { $url = $this->baseUrl . '/status/' . $jobId; $params = ['api_key' => $this->apiKey]; return $this->makeRequest('GET', $url . '?' . http_build_query($params)); } public function getResults($jobId, $format = 'json') { $url = $this->baseUrl . '/results/' . $jobId; $params = ['api_key' => $this->apiKey, 'format' => $format]; return $this->makeRequest('GET', $url . '?' . http_build_query($params)); } private function makeRequest($method, $url, $data = null) { $ch = curl_init(); curl_setopt_array($ch, [ CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_CUSTOMREQUEST => $method, CURLOPT_HTTPHEADER => ['Content-Type: application/json'], ]); if ($data && $method === 'POST') { curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data)); } $response = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); if ($httpCode >= 400) { throw new Exception("API Error: HTTP $httpCode - $response"); } return json_decode($response, true); } }// Usage example try { $api = new EmailScraperAPI('ess_your_api_key_here'); // Submit job $job = $api->submitJob('digital marketing agencies', 100); echo "Job submitted: " . $job['job_id'] . "\n"; // Monitor progress do { sleep(5); // Wait 5 seconds $status = $api->checkStatus($job['job_id']); echo "Progress: " . $status['progress_percentage'] . "%\n"; } while ($status['status'] === 'processing'); // Get results if ($status['status'] === 'completed') { $results = $api->getResults($job['job_id']); echo "Found " . $results['total_count'] . " emails\n"; } } catch (Exception $e) { echo "Error: " . $e->getMessage() . "\n"; } ?>
🔗 Support: Need help? Contact our support team on Telegram or visit your Scraper Dashboard.