Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.blitz-api.ai/llms.txt

Use this file to discover all available pages before exploring further.

Code Examples & Best Practices

Production-ready code for every Blitz API v2 endpoint. Copy, paste, and ship.
Agents & LLMs: a Markdown version of this page is available by appending .md to the URL, and the full documentation index is at llms.txt.
This page is split into a shared client setup plus a dedicated example page for each endpoint. Copy the client below once, then drop in the per-endpoint snippet you need.

Endpoint Quick Reference

All v2 endpoints at a glance. Base URL: https://api.blitz-api.ai. All endpoints use POST except key-info.
EndpointMethodDescriptionPlan requiredExample
/v2/account/key-infoGETCheck API key validity & rate limitAnyCheck API Key
/v2/search/waterfall-icp-keywordPOSTFind decision-makers by cascade hierarchyUnlimited Leads+Waterfall ICP
/v2/search/employee-finderPOSTSearch employees at one companyUnlimited Leads+Employee Finder
/v2/search/peoplePOSTSearch people across many companiesUnlimited Leads+Find People
/v2/search/companiesPOSTFind companies by filtersUnlimited Leads+Company Search
/v2/enrichment/emailPOSTLinkedIn profile URL → verified work emailUnlimited Email+Email Enrichment
/v2/enrichment/phonePOSTLinkedIn profile URL → phone (US only)Unlimited PhonePhone Enrichment
/v2/enrichment/email-to-personPOSTWork email → full person profileUnlimited Leads+Reverse Email
/v2/enrichment/phone-to-personPOSTPhone number → full person profileUnlimited Leads+Reverse Phone
/v2/enrichment/companyPOSTCompany LinkedIn URL → company profileUnlimited Leads+Company Enrichment
/v2/enrichment/domain-to-linkedinPOSTWebsite domain → Company LinkedIn URLUnlimited Leads+Domain → LinkedIn
/v2/enrichment/linkedin-to-domainPOSTCompany LinkedIn URL → email domainUnlimited Leads+LinkedIn → Domain
/v2/utils/current-datePOSTGet current server date/timeAny

Base Setup

Every request requires the x-api-key header. The client below handles rate limiting, retries on 429, and error handling. Each per-endpoint example page assumes this client is already in scope as blitzRequest().
Never expose your API key in client-side code (browsers, mobile apps). Always call the Blitz API from your backend.
const BLITZ_API_KEY = "YOUR_API_KEY";
const BLITZ_BASE_URL = "https://api.blitz-api.ai";

// Replace 5 with the max_requests_per_seconds value from /v2/account/key-info
function createRateLimiter(maxRps) {
  const timestamps = [];
  let pending = Promise.resolve();

  return () => {
    pending = pending.then(
      () =>
        new Promise((resolve) => {
          const poll = () => {
            const now = Date.now();
            while (timestamps.length && timestamps[0] <= now - 1000)
              timestamps.shift();
            if (timestamps.length < maxRps) {
              timestamps.push(Date.now());
              resolve();
            } else {
              setTimeout(poll, timestamps[0] + 1000 - now + 1);
            }
          };
          poll();
        })
    );
    return pending;
  };
}

const rateLimit = createRateLimiter(5);

async function blitzRequest(method, path, payload) {
  const headers = {
    "x-api-key": BLITZ_API_KEY,
    "Content-Type": "application/json",
  };

  for (let attempt = 0; attempt < 3; attempt++) {
    try {
      await rateLimit();

      const res = await fetch(`${BLITZ_BASE_URL}${path}`, {
        method,
        headers,
        body: payload ? JSON.stringify(payload) : undefined,
      });

      if (res.status === 429) {
        console.log("Rate limited by server, waiting 60s...");
        await new Promise((r) => setTimeout(r, 60000));
        continue;
      }

      if (res.status === 402) {
        console.error("Insufficient credits");
        return null;
      }

      if (res.status === 401) {
        console.error("Invalid API key");
        return null;
      }

      if (res.ok) return await res.json();

      await new Promise((r) => setTimeout(r, 2 ** attempt * 1000));
    } catch (error) {
      if (attempt === 2) {
        console.error(`API error: ${error.message}`);
        return null;
      }
      await new Promise((r) => setTimeout(r, 2000));
    }
  }
  return null;
}