Skip to content

🎯 Production-ready OpenAPI 3.1 specification for LeadMagic's complete B2B data enrichment API suite. 19 endpoints, 249 examples, platform-agnostic documentation with comprehensive testing framework.

License

Notifications You must be signed in to change notification settings

LeadMagic/leadmagic-openapi

Repository files navigation

LeadMagic API - Complete Documentation

A comprehensive, production-ready OpenAPI 3.1 specification for LeadMagic's complete data enrichment API suite.

🎯 Overview

LeadMagic provides the most comprehensive B2B data enrichment API, featuring 19 endpoints across email finding, profile enrichment, company intelligence, job data, and advertisement tracking. This specification is 100% tested against the live API and fully OpenAPI 3.1 compliant.

πŸ“ Files

  • leadmagic-openapi-3.1.yaml - Complete OpenAPI 3.1 specification (60,883 bytes)
  • leadmagic-openapi-3.1.json - JSON format specification (91,190 bytes)
  • test-api.js - Comprehensive API validation suite
  • README.md - This complete documentation

πŸš€ Quick Start

Authentication

All endpoints require authentication via the X-API-Key header:

curl -H "X-API-Key: your-api-key-here" \
     -H "Content-Type: application/json" \
     https://api.leadmagic.io/credits

Security Note: Never commit API keys to version control. Use environment variables or secure configuration management.

Base URL

https://api.leadmagic.io

πŸ“‹ Complete API Reference

πŸ”„ Credits Management

Check Credits

Get your available API credits.

Endpoint: POST /credits

Request:

curl --request POST \
     --url https://api.leadmagic.io/credits \
     --header 'X-API-Key: your-api-key' \
     --header 'Content-Type: application/json'

Response:

{
  "credits": 7333.8
}

Use Cases:

  • Monitor credit usage in applications
  • Implement billing alerts
  • Display remaining credits to users

πŸ“§ Email Services

1. Email Validation

Validate email deliverability and get company information.

Endpoint: POST /email-validate

Request:

curl --request POST \
     --url https://api.leadmagic.io/email-validate \
     --header 'X-API-Key: your-api-key' \
     --header 'Content-Type: application/json' \
     --data '{
       "email": "elon@tesla.com",
       "first_name": "Elon",
       "last_name": "Musk"
     }'

Response:

{
  "email": "elon@tesla.com",
  "email_status": "valid",
  "credits_consumed": 0.05,
  "message": "Email is valid.",
  "is_domain_catch_all": false,
  "mx_record": "mx1.tesla.com",
  "mx_provider": "Google Workspace",
  "mx_security_gateway": false,
  "company_name": "Tesla",
  "company_industry": "Automotive",
  "company_size": "10001+",
  "company_founded": 2003,
  "company_type": "public",
  "company_linkedin_url": "linkedin.com/company/tesla-motors",
  "company_linkedin_id": "15564",
  "company_location": {
    "name": "austin, texas, united states",
    "locality": "austin",
    "region": "texas",
    "country": "united states"
  }
}

Status Values:

  • valid - Email is deliverable
  • valid_catch_all - Valid but domain accepts all emails
  • invalid - Email does not exist
  • unknown - Cannot determine status
  • catch_all - Domain is catch-all configured

Use Cases:

  • Clean email lists before campaigns
  • Real-time form validation
  • Lead qualification scoring
  • CRM data hygiene

2. Email Finder

Find verified email addresses using name and company.

Endpoint: POST /email-finder

Request:

curl --request POST \
     --url https://api.leadmagic.io/email-finder \
     --header 'X-API-Key: your-api-key' \
     --header 'Content-Type: application/json' \
     --data '{
       "first_name": "Elon",
       "last_name": "Musk",
       "domain": "tesla.com",
       "company_name": "Tesla"
     }'

Response:

{
  "email": "elon@tesla.com",
  "status": "valid",
  "credits_consumed": 1,
  "message": "Valid email found.",
  "first_name": "Elon",
  "last_name": "Musk",
  "domain": "tesla.com",
  "is_domain_catch_all": false,
  "mx_record": "mx1.tesla.com",
  "mx_provider": "Google Workspace",
  "mx_security_gateway": false,
  "company_name": "Tesla",
  "company_industry": "Automotive",
  "company_size": "10001+",
  "company_founded": 2003,
  "company_type": "public",
  "company_linkedin_url": "linkedin.com/company/tesla-motors",
  "company_linkedin_id": "15564",
  "company_location": {
    "name": "austin, texas, united states"
  }
}

Status Values:

  • valid - Email found and verified
  • valid_catch_all - Found but domain is catch-all
  • not_found - No email found

Use Cases:

  • Sales prospecting and outreach
  • Lead generation campaigns
  • Contact database building
  • Recruitment and talent acquisition

3. Personal Email Finder

Find personal email addresses from B2B profiles.

Endpoint: POST /personal-email-finder

Request:

curl --request POST \
     --url https://api.leadmagic.io/personal-email-finder \
     --header 'X-API-Key: your-api-key' \
     --header 'Content-Type: application/json' \
     --data '{
       "profile_url": "https://www.linkedin.com/in/elonmusk/"
     }'

Response:

{
  "personal_email": "elon@spacex.com",
  "status": "found",
  "credits_consumed": 1,
  "message": "Personal email found"
}

Use Cases:

  • Personal outreach campaigns
  • Executive communication
  • Direct marketing initiatives
  • Influencer partnerships

4. B2B Social to Email

Find work emails from B2B profile URLs.

Endpoint: POST /b2b-social-email

Request:

curl --request POST \
     --url https://api.leadmagic.io/b2b-social-email \
     --header 'X-API-Key: your-api-key' \
     --header 'Content-Type: application/json' \
     --data '{
       "profile_url": "https://www.linkedin.com/in/elonmusk/"
     }'

Response:

{
  "work_email": "elon@tesla.com",
  "status": "found",
  "credits_consumed": 1,
  "message": "Work email found"
}

Use Cases:

  • B2B prospecting workflows
  • Social selling strategies
  • B2B lead generation
  • Account-based marketing

5. Work Email to B2B Profile

Find B2B profiles from work email addresses.

Endpoint: POST /b2b-profile

Request:

curl --request POST \
     --url https://api.leadmagic.io/b2b-profile \
     --header 'X-API-Key: your-api-key' \
     --header 'Content-Type: application/json' \
     --data '{
       "work_email": "elon@tesla.com"
     }'

Response:

{
  "profile_url": "https://www.linkedin.com/in/elonmusk/",
  "message": "Profile URL found",
  "credits_consumed": 10
}

Use Cases:

  • Enrich existing email databases
  • Social media prospecting
  • Contact intelligence gathering
  • Lead scoring enhancement

πŸ“± Mobile & Contact Services

6. Mobile Finder

Find mobile phone numbers using various identifiers.

Endpoint: POST /mobile-finder

Request:

curl --request POST \
     --url https://api.leadmagic.io/mobile-finder \
     --header 'X-API-Key: your-api-key' \
     --header 'Content-Type: application/json' \
     --data '{
       "work_email": "elon@tesla.com"
     }'

Response:

{
  "message": "mobile not found",
  "credits_consumed": 0,
  "mobile_number": null
}

Parameters (provide at least one):

  • profile_url - B2B profile URL
  • work_email - Work email address
  • personal_email - Personal email address

Use Cases:

  • SMS marketing campaigns
  • Direct outreach via phone/WhatsApp
  • Multi-channel communication
  • Emergency contact information

πŸ‘€ Profile & People Services

7. Profile Search

Get comprehensive B2B profile information.

Endpoint: POST /profile-search
Rate Limit: 300 requests/minute
Note: Public profiles only

Request:

curl --request POST \
     --url https://api.leadmagic.io/profile-search \
     --header 'X-API-Key: your-api-key' \
     --header 'Content-Type: application/json' \
     --data '{
       "profile_url": "https://www.linkedin.com/in/elonmusk/"
     }'

Response:

{
  "profile_url": "https://www.linkedin.com/in/elonmusk/",
  "first_name": "Elon",
  "last_name": "Musk",
  "full_name": "Elon Musk",
  "public_identifier": "elonmusk",
  "headline": "CEO at Tesla, SpaceX",
  "company_name": "Tesla",
  "company_size": "10001+",
  "company_industry": "Automotive",
  "company_linkedin_url": "linkedin.com/company/tesla-motors",
  "company_website": "tesla.com",
  "total_tenure_months": "180",
  "total_tenure_days": "5400",
  "total_tenure_years": "15.0",
  "connections": 500,
  "followers": 25000000,
  "country": "United States",
  "location": "Austin, Texas, United States",
  "about": "CEO of Tesla and SpaceX. Working to accelerate sustainable transport and space exploration.",
  "experiences": [
    {
      "company_id": "15564",
      "title": "CEO",
      "subtitle": "Tesla",
      "caption": "2008 - Present Β· 16 yrs"
    }
  ],
  "educations": [
    {
      "title": "University of Pennsylvania",
      "caption": "1992 - 1997"
    }
  ],
  "credits_consumed": 1
}

Use Cases:

  • Sales prospect research
  • Recruitment and talent sourcing
  • Business development research
  • Market intelligence gathering
  • Partnership opportunity assessment

8. Role Finder

Find specific roles within companies.

Endpoint: POST /role-finder

Request:

curl --request POST \
     --url https://api.leadmagic.io/role-finder \
     --header 'X-API-Key: your-api-key' \
     --header 'Content-Type: application/json' \
     --data '{
       "job_title": "Software Engineer",
       "company_name": "Tesla",
       "company_domain": "tesla.com"
     }'

Response:

{
  "message": "Role found.",
  "credits_consumed": 1,
  "company_name": "Tesla",
  "company_website": "tesla.com",
  "contacts": [
    {
      "name": "John Doe",
      "title": "Senior Software Engineer",
      "profile_url": "https://linkedin.com/in/johndoe"
    }
  ]
}

Parameters (job_title required + one of):

  • company_name - Company name
  • company_domain - Company domain
  • company_profile_url - Company profile URL

Use Cases:

  • Targeted recruitment campaigns
  • Sales team building for specific companies
  • Competitive intelligence
  • Partnership development

9. Employee Finder

Find employees of specific companies.

Endpoint: POST /employee-finder

Request:

curl --request POST \
     --url https://api.leadmagic.io/employee-finder \
     --header 'X-API-Key: your-api-key' \
     --header 'Content-Type: application/json' \
     --data '{
       "company_name": "Tesla",
       "page": 1,
       "per_page": 5
     }'

Response:

{
  "message": "Data found for the given company.",
  "total_count": 50000,
  "returned_count": 5,
  "credits_consumed": 1,
  "data": [
    {
      "first_name": "Elon",
      "last_name": "Musk",
      "title": "CEO",
      "website": "https://www.tesla.com",
      "company_name": "Tesla"
    },
    {
      "first_name": "Drew",
      "last_name": "Baglino",
      "title": "SVP, Powertrain and Energy Engineering",
      "website": "https://www.tesla.com",
      "company_name": "Tesla"
    }
  ]
}

Use Cases:

  • Bulk recruitment campaigns
  • Company analysis and research
  • Sales territory mapping
  • Competitive intelligence
  • Organization chart building

🏒 Company Services

10. Company Search

Get detailed company information and insights.

Endpoint: POST /company-search

Request:

curl --request POST \
     --url https://api.leadmagic.io/company-search \
     --header 'X-API-Key: your-api-key' \
     --header 'Content-Type: application/json' \
     --data '{
       "company_domain": "tesla.com",
       "company_name": "Tesla"
     }'

Response:

{
  "company_name": "Tesla",
  "company_id": 15564,
  "locations": [
    {
      "country": "US",
      "city": "Austin",
      "geographic_area": "Texas",
      "postal_code": "78725",
      "line1": "1 Tesla Rd",
      "description": "Headquarters",
      "headquarter": true,
      "localized_name": "Austin",
      "latitude": 30.2672,
      "longitude": -97.7431
    }
  ],
  "employee_count": 99290,
  "specialities": ["Electric Vehicles", "Energy Storage", "Solar"],
  "employee_count_range": {
    "start": 10001,
    "end": 999999
  },
  "tagline": "Accelerating the world's transition to sustainable energy",
  "follower_count": 5200000,
  "industry": "Automotive",
  "description": "Tesla designs and manufactures electric vehicles, energy storage systems, and solar panels.",
  "website_url": "https://tesla.com",
  "founded_on": {
    "year": 2003,
    "month": 7,
    "day": 1
  },
  "universal_name": "tesla-motors",
  "hashtag": "#tesla",
  "industry_v2_taxonomy": "Motor Vehicle Manufacturing",
  "url": "https://www.linkedin.com/company/tesla-motors/",
  "credits_consumed": 1
}

Parameters (provide at least one):

  • company_domain - Company website domain
  • company_name - Company name
  • profile_url - Company profile URL

Use Cases:

  • Lead qualification and scoring
  • Market research and analysis
  • Competitive intelligence
  • Investment research
  • Partnership evaluation

11. Company Funding

Get comprehensive funding, financial, and competitive intelligence.

Endpoint: POST /company-funding

Request:

curl --request POST \
     --url https://api.leadmagic.io/company-funding \
     --header 'X-API-Key: your-api-key' \
     --header 'Content-Type: application/json' \
     --data '{
       "company_domain": "tesla.com"
     }'

Response:

{
  "basicInfo": {
    "companyName": "Tesla Inc.",
    "description": "Tesla designs and manufactures electric vehicles and energy solutions.",
    "shortName": "Tesla",
    "founded": "2003",
    "headquarters": {
      "city": "Austin",
      "state": "Texas",
      "country": "USA",
      "fullAddress": "Austin, Texas, USA"
    },
    "primaryDomain": "tesla.com",
    "phone": "1-512-516-8177",
    "status": "PUBLIC",
    "followers": 5200000,
    "ownership": "Public"
  },
  "financialInfo": {
    "revenue": 96773000000,
    "formattedRevenue": "96.8B",
    "totalFunding": 7538000000,
    "formattedFunding": "7.5B",
    "lastFundingRound": {
      "round": "IPO",
      "date": "2010-06-29T00:00:00.000Z",
      "amount": 226100000
    }
  },
  "companySize": {
    "employees": 99290,
    "employeeRange": "10,000 - 99,999",
    "employeeGrowth": "15.2%"
  },
  "leadership": {
    "ceo": {
      "firstName": "Elon",
      "lastName": "Musk",
      "designation": "CEO & Product Architect",
      "linkedIn": "https://www.linkedin.com/in/elonmusk/",
      "twitter": "https://twitter.com/elonmusk"
    }
  },
  "topCompetitors": [
    {
      "name": "Ford Motor Company",
      "revenue": "$158B",
      "employees": "190,000",
      "headquarters": {
        "city": "Dearborn",
        "state": "Michigan",
        "country": "USA"
      },
      "website": "https://www.ford.com"
    }
  ],
  "acquisitions": [
    {
      "companyName": "SolarCity",
      "acquisitionDate": "2016-11-01T00:00:00.000Z",
      "description": "Solar energy services company",
      "source": "https://tesla.com/solarcity"
    }
  ],
  "socialMedia": [
    {
      "platform": "twitter",
      "url": "https://twitter.com/tesla"
    },
    {
      "platform": "facebook",
      "url": "https://www.facebook.com/tesla"
    }
  ],
  "credits_consumed": 4
}

Use Cases:

  • Investment due diligence
  • Competitive landscape analysis
  • Market opportunity assessment
  • Sales strategy development
  • Partnership evaluation

πŸ’Ό Jobs Services

12. Jobs Finder

Search job postings with advanced filtering.

Endpoint: POST /jobs-finder

Request:

curl --request POST \
     --url https://api.leadmagic.io/jobs-finder \
     --header 'X-API-Key: your-api-key' \
     --header 'Content-Type: application/json' \
     --data '{
       "company_name": "Tesla",
       "job_title": "Software Engineer",
       "location": "Austin",
       "experience_level": "senior",
       "page": 1,
       "per_page": 5
     }'

Response:

{
  "total_count": 157,
  "page": 1,
  "per_page": 5,
  "total_pages": 32,
  "credits_consumed": 5,
  "results": [
    {
      "company": {
        "name": "Tesla",
        "website_url": "https://www.tesla.com/",
        "linkedin_url": "https://www.linkedin.com/company/tesla-motors/",
        "twitter_handle": "Tesla",
        "github_url": "https://github.com/tesla",
        "is_agency": false
      },
      "title": "Senior Software Engineer - Autopilot",
      "location": "Austin, Texas, United States",
      "types": [
        {
          "id": 1,
          "name": "Full Time"
        }
      ],
      "cities": [
        {
          "geonameid": 4671654,
          "asciiname": "Austin",
          "name": "Austin",
          "country": {
            "id": 238,
            "code": "US",
            "name": "United States"
          }
        }
      ],
      "has_remote": false,
      "published": "2024-06-25T20:36:00Z",
      "expired": null,
      "application_url": "https://jobs.lever.co/tesla/senior-software-engineer",
      "language": "en",
      "salary_min": "150000",
      "salary_max": "250000",
      "salary_currency": "USD",
      "experience_level": "Senior Level",
      "description": "Join Tesla's Autopilot team to develop cutting-edge autonomous driving technology..."
    }
  ]
}

Filter Options:

  • company_name - Filter by company
  • company_website - Filter by company domain
  • job_title - Filter by job title
  • location - Filter by location
  • experience_level - entry, mid, senior, executive
  • job_description - Keywords in description
  • country_id - Country code (US, CA, etc.)
  • page - Page number (default: 1)
  • per_page - Results per page (max: 50)

Use Cases:

  • Recruitment and talent acquisition
  • Competitive salary analysis
  • Market opportunity assessment
  • Industry trend analysis
  • Career opportunity tracking

13. Get Job Countries

Get list of available countries for job filtering.

Endpoint: GET /job-country

Request:

curl --request GET \
     --url https://api.leadmagic.io/job-country \
     --header 'X-API-Key: your-api-key'

Response:

[
  {"id": "US", "name": "United States"},
  {"id": "CA", "name": "Canada"},
  {"id": "GB", "name": "United Kingdom"},
  {"id": "DE", "name": "Germany"},
  {"id": "FR", "name": "France"}
]

14. Get Job Types

Get list of available job types.

Endpoint: GET /job-types

Request:

curl --request GET \
     --url https://api.leadmagic.io/job-types \
     --header 'X-API-Key: your-api-key'

Response:

[
  {"id": 1, "name": "Full Time"},
  {"id": 2, "name": "Part Time"},
  {"id": 3, "name": "Temporary"},
  {"id": 4, "name": "Internship"},
  {"id": 5, "name": "Freelance"},
  {"id": 6, "name": "Contract"}
]

πŸ“Ί Advertisement Intelligence

15. Google Ads Search

Find Google Ads campaigns by company.

Endpoint: POST /google/searchads

Request:

curl --request POST \
     --url https://api.leadmagic.io/google/searchads \
     --header 'X-API-Key: your-api-key' \
     --header 'Content-Type: application/json' \
     --data '{
       "company_domain": "tesla.com",
       "company_name": "Tesla"
     }'

Response:

{
  "credits_consumed": 8,
  "ads": [
    {
      "advertiser_id": "AR15234567890123456789",
      "creative_id": "CR98765432109876543210",
      "advertiser_name": "Tesla Inc",
      "format": "Text",
      "start": "2024-01-15",
      "last_seen": "2024-06-27",
      "original_url": "https://adstransparency.google.com/advertiser/AR15234567890123456789/creative/CR98765432109876543210",
      "variants": [
        {
          "content": "Experience the future of driving with Tesla Model 3. Zero emissions, maximum performance.",
          "height": null,
          "width": null
        }
      ]
    }
  ]
}

Use Cases:

  • Competitive ad intelligence
  • Marketing strategy research
  • Ad copy inspiration
  • Campaign performance tracking
  • Industry trend analysis

16. Meta Ads Search

Find Facebook/Instagram ads by company.

Endpoint: POST /meta/searchads

Request:

curl --request POST \
     --url https://api.leadmagic.io/meta/searchads \
     --header 'X-API-Key: your-api-key' \
     --header 'Content-Type: application/json' \
     --data '{
       "company_domain": "tesla.com",
       "company_name": "Tesla"
     }'

Response:

{
  "credits_consumed": 2.6,
  "ads": [
    {
      "ad_archive_id": "987654321098765432",
      "page_id": "123456789012345678",
      "page_name": "Tesla",
      "is_active": true,
      "publisher_platform": ["facebook", "instagram"],
      "snapshot": {
        "body": {
          "markup": "Drive the future with Tesla. Zero emissions, infinite possibilities."
        },
        "title": "Tesla Model Y",
        "cta_text": "Learn More",
        "images": [
          {
            "original_image_url": "https://scontent.xx.fbcdn.net/tesla-model-y.jpg"
          }
        ],
        "videos": []
      }
    }
  ]
}

Use Cases:

  • Social media ad tracking
  • Creative strategy analysis
  • Brand monitoring
  • Competitive intelligence
  • Campaign inspiration

17. B2B Ads Search

Search for B2B advertisement campaigns.

Endpoint: POST /b2b/searchads

Request:

curl --request POST \
     --url https://api.leadmagic.io/b2b/searchads \
     --header 'X-API-Key: your-api-key' \
     --header 'Content-Type: application/json' \
     --data '{
       "company_domain": "tesla.com",
       "company_name": "Tesla"
     }'

Response:

{
  "credits_consumed": 5,
  "ads": [
    {
      "ad_id": "b2b_12345",
      "company_name": "Tesla",
      "ad_title": "Tesla for Business - Fleet Solutions",
      "ad_description": "Transform your business fleet with Tesla's commercial vehicle solutions.",
      "ad_url": "https://tesla.com/fleet"
    }
  ]
}

18. B2B Ad Details

Get detailed information about specific B2B ads.

Endpoint: POST /b2b/ad-details

Request:

curl --request POST \
     --url https://api.leadmagic.io/b2b/ad-details \
     --header 'X-API-Key: your-api-key' \
     --header 'Content-Type: application/json' \
     --data '{
       "ad_id": "b2b_12345"
     }'

Response:

{
  "ad_id": "b2b_12345",
  "company_name": "Tesla",
  "ad_title": "Tesla for Business - Fleet Solutions",
  "ad_description": "Complete fleet electrification solutions for businesses of all sizes.",
  "ad_url": "https://tesla.com/fleet",
  "campaign_info": {
    "campaign_name": "Tesla Business Q2 2024",
    "start_date": "2024-04-01",
    "end_date": "2024-06-30"
  },
  "credits_consumed": 2
}

Use Cases:

  • B2B marketing intelligence
  • Enterprise solution tracking
  • Competitive analysis
  • Campaign research
  • Business development insights

🎯 Use Case Examples

Sales & Marketing Teams

// Complete lead enrichment workflow
const lead = {
  firstName: "Elon",
  lastName: "Musk",
  company: "Tesla"
};

// 1. Find email
const emailResult = await findEmail(lead);

// 2. Validate email
const validation = await validateEmail(emailResult.email);

// 3. Get profile details
const profile = await searchProfile(emailResult.profile_url);

// 4. Get company intelligence
const company = await searchCompany("tesla.com");

// 5. Find mobile for multi-channel outreach
const mobile = await findMobile(emailResult.email);

Recruitment Teams

// Targeted recruitment pipeline
const company = "Tesla";
const role = "Software Engineer";

// 1. Find employees in role
const employees = await findEmployees(company);

// 2. Get specific role holders
const roleHolders = await findRole(role, company);

// 3. Get their profiles
const profiles = await Promise.all(
  roleHolders.map(person => searchProfile(person.profile_url))
);

// 4. Find contact information
const contacts = await Promise.all(
  profiles.map(profile => findEmail(profile))
);

Business Intelligence

// Competitive analysis workflow
const competitor = "tesla.com";

// 1. Get company overview
const company = await searchCompany(competitor);

// 2. Get funding and financial data
const funding = await getCompanyFunding(competitor);

// 3. Analyze job market activity
const jobs = await findJobs({ company_name: "Tesla" });

// 4. Track advertising strategy
const googleAds = await searchGoogleAds(competitor);
const metaAds = await searchMetaAds(competitor);
const b2bAds = await searchB2BAds(competitor);

πŸ”§ Important Technical Details

Field Naming Convention

All fields use snake_case:

{
  "first_name": "Elon",          // βœ… Correct
  "company_name": "Tesla",       // βœ… Correct
  "email_status": "valid"        // βœ… Correct
}

NOT camelCase:

{
  "firstName": "Elon",           // ❌ Wrong
  "companyName": "Tesla",        // ❌ Wrong
  "emailStatus": "valid"         // ❌ Wrong
}

HTTP Methods

All endpoints use POST method (even for data retrieval):

POST /credits              # βœ… Correct
POST /email-validate       # βœ… Correct
GET /job-country          # βœ… Exception (metadata only)
GET /job-types            # βœ… Exception (metadata only)

Authentication

Include API key in every request:

curl --header 'X-API-Key: your-leadmagic-api-key'

Rate Limits

  • Profile Search: 300 requests/minute
  • Other endpoints: Standard rate limits apply

Error Handling

All endpoints return consistent error format:

{
  "error": "Bad Request",
  "message": "API key is missing or invalid."
}

Common HTTP Status Codes:

  • 200 - Success
  • 400 - Bad Request (invalid parameters)
  • 401 - Unauthorized (invalid API key)
  • 429 - Rate limit exceeded
  • 500 - Internal server error

πŸ“Š Credit Consumption

Endpoint Credits Notes
/credits 0 Free to check
/email-validate 0.05 Very cost-effective
/email-finder 1 Standard rate
/mobile-finder 5 Only if found
/profile-search 1 Rate limited
/b2b-profile 10 Higher cost for reverse lookup
/personal-email-finder 1 Standard rate
/b2b-social-email 1 Standard rate
/role-finder 0-1 Only if found
/employee-finder 1 Per request (multiple results)
/company-search 1 Comprehensive data
/company-funding 4 Premium intelligence
/jobs-finder 1 per job Based on results returned
/google/searchads 1 per ad Based on ads found
/meta/searchads 1 per ad Based on ads found
/b2b/searchads 1 per ad Based on ads found
/b2b/ad-details 2 Per ad detail request
/job-country 0 Metadata endpoint
/job-types 0 Metadata endpoint

πŸ› οΈ OpenAPI 3.1 Features

This specification is 100% OpenAPI 3.1 compliant and includes:

βœ… Modern JSON Schema 2020-12 support
βœ… 249 comprehensive examples (all using OpenAPI 3.1 examples format)
βœ… 0 legacy examples (no deprecated example fields)
βœ… Proper webhook support (if needed)
βœ… Advanced validation with pattern matching
βœ… Complete security scheme definitions
βœ… Comprehensive error handling specifications

Using with Tools

Swagger UI:

npx swagger-ui-serve leadmagic-openapi-3.1.yaml

Code Generation:

# JavaScript/TypeScript
npx @openapitools/openapi-generator-cli generate \
  -i leadmagic-openapi-3.1.yaml \
  -g typescript-fetch \
  -o ./leadmagic-client

# Python
openapi-generator-cli generate \
  -i leadmagic-openapi-3.1.yaml \
  -g python \
  -o ./leadmagic-python-client

# Go
openapi-generator-cli generate \
  -i leadmagic-openapi-3.1.yaml \
  -g go \
  -o ./leadmagic-go-client

Postman Import:

# Convert to Postman collection
openapi2postmanv2 -s leadmagic-openapi-3.1.yaml -o leadmagic.postman_collection.json

πŸ§ͺ Testing & Validation

Setup Environment

Before running tests, set your API key as an environment variable:

# Option 1: Set for single test run
LEADMAGIC_API_KEY=your-api-key-here node test-api.js

# Option 2: Export for session
export LEADMAGIC_API_KEY=your-api-key-here
node test-api.js

# Option 3: Create .env file (recommended)
echo "LEADMAGIC_API_KEY=your-api-key-here" > .env
# Then modify test-api.js to use dotenv if needed

Run Comprehensive Tests

# After setting up your API key:
node test-api.js

Expected Output

πŸ§ͺ Testing LeadMagic API Endpoints

1. βœ… /credits - 7333.8 credits available
2. βœ… /email-validate - Email validation working
3. βœ… /email-finder - Email finding operational  
4. βœ… /mobile-finder - Mobile search functional
5. βœ… /b2b-profile - Profile lookup working
6. βœ… /personal-email-finder - Personal email search ready
7. βœ… /b2b-social-email - Social to email working
8. βœ… /profile-search - Profile enrichment functional
9. βœ… /role-finder - Role search operational
10. βœ… /employee-finder - Employee search working
11. βœ… /company-search - Company lookup functional
12. βœ… /company-funding - Funding data available
13. βœ… /jobs-finder - Job search operational
14. βœ… /job-country - Country metadata available
15. βœ… /job-types - Job type metadata ready
16. βœ… /google/searchads - Google ads search working
17. βœ… /meta/searchads - Meta ads search functional
18. βœ… /b2b/searchads - B2B ads search operational
19. βœ… /b2b/ad-details - Ad details lookup working

πŸŽ‰ All 19 endpoints validated successfully!

πŸ“ˆ Specification Stats

  • OpenAPI Version: 3.1.0 βœ…
  • Total Endpoints: 19 βœ…
  • Component Schemas: 7 βœ…
  • Defined Tags: 8 βœ…
  • Security Schemes: 1 βœ…
  • Examples: 249 (all OpenAPI 3.1 format) βœ…
  • Legacy Examples: 0 βœ…
  • File Sizes: YAML (60,883 bytes), JSON (91,190 bytes) βœ…

🀝 Support & Resources


πŸ“„ License

This OpenAPI specification is provided under the MIT License.


πŸŽ‰ Built with comprehensive testing and rigorous validation to ensure 100% API accuracy

About

🎯 Production-ready OpenAPI 3.1 specification for LeadMagic's complete B2B data enrichment API suite. 19 endpoints, 249 examples, platform-agnostic documentation with comprehensive testing framework.

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Packages

No packages published