Skip to main content

Apollo.io

Apollo.io is used for company-level enrichment across both the attorney intelligence pipeline (law firms) and the internal sales pipeline (prospect companies). It provides organizational data like employee count, founding year, industry, revenue, and LinkedIn URLs.

API Configuration

SettingValue
API Base URLhttps://api.apollo.io/v1
Auth HeaderX-Api-Key: {APOLLO_API_KEY}
Env VariableAPOLLO_API_KEY (Supabase secret)

Edge Functions

Purpose: Search for companies by name or domain. Returns matching organizations for selection before enrichment.

Request

{
"name": "Kirkland & Ellis",
"domain": "kirkland.com"
}

At least one of name or domain is required.

API Call

const searchParams = {
page: 1,
per_page: 10,
};
if (domain) searchParams.organization_domains = [domain];
if (name) searchParams.q_organization_name = name;

const response = await fetch("https://api.apollo.io/v1/mixed_companies/search", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-Api-Key": APOLLO_API_KEY,
},
body: JSON.stringify(searchParams),
});

Response

{
"success": true,
"accounts": [...],
"organizations": [...],
"pagination": { "page": 1, "per_page": 10, "total_entries": 3 }
}

apollo-enrich-company

Purpose: Enrich a law firm record in the firms table using Apollo's organization enrichment endpoint.

Request

{
"domain": "kirkland.com",
"firmId": "uuid (optional -- updates existing firm)"
}

API Call

const response = await fetch("https://api.apollo.io/v1/organizations/enrich", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-Api-Key": APOLLO_API_KEY,
},
body: JSON.stringify({ domain }),
});

Fields Mapped to firms Table

Apollo FieldFirms ColumnDescription
linkedin_urllinkedin_urlCompany LinkedIn page
logo_urllogo_urlCompany logo image URL
short_descriptiondescriptionBrief company description
estimated_num_employeesemployee_countTotal employee count
founded_yearfounded_yearYear company was founded
cityheadquarters_cityHQ city
stateheadquarters_stateHQ state
countryheadquarters_countryHQ country
industryindustryIndustry classification
annual_revenue_printedrevenue_rangeRevenue range string
idapollo_org_idApollo organization ID

Behavior

  • If firmId is provided: updates the existing firm record (preserves name, tier, domain).
  • If only domain is provided: upserts by website (legacy behavior for new firms).
  • Sets enrichment_status = 'complete' and last_enriched_at on success.
  • Sets enrichment_status = 'failed' or 'not_found' on failure.

apollo-enrich-sales-company

Purpose: Enrich a sales prospect's company in the sales_companies table. Same Apollo API, different destination table.

Request

{
"companyId": "uuid (optional -- enriches and saves)",
"domain": "smithlegal.com (for direct lookups)"
}

Fields Mapped to sales_companies Table

Apollo FieldSales Companies Column
linkedin_urllinkedin_url
logo_urllogo_url
short_descriptiondescription
estimated_num_employeesemployee_count
founded_yearfounded_year
cityheadquarters_city
stateheadquarters_state
countryheadquarters_country
industryindustry
annual_revenue_printedrevenue_range
idapollo_org_id

Behavior

  • If companyId is provided: fetches the company from sales_companies, extracts domain from website or domain field, enriches, and updates the record.
  • If only domain is provided: returns enriched data without saving (for preview/search).
  • Also backfills name and website from Apollo if local data is sparse.

apollo-search-firm-attorneys

Purpose: Discover attorneys at a law firm using Apollo's people search. This is an alternative to Blitz API's employee-finder that works when the firm has an apollo_org_id.

Request

{
"firmId": "uuid",
"maxResults": 100
}

Prerequisites

The firm must have an apollo_org_id (set by apollo-enrich-company). If missing, the function returns an error instructing you to enrich the company first.

API Call

const response = await fetch("https://api.apollo.io/v1/mixed_people/search", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-Api-Key": APOLLO_API_KEY,
},
body: JSON.stringify({
organization_ids: [firm.apollo_org_id],
person_titles: [
"Partner", "Equity Partner", "Managing Partner", "Senior Partner",
"Counsel", "Of Counsel", "Senior Counsel", "Special Counsel",
"Senior Associate", "Associate", "Attorney", "Lawyer",
],
person_locations: ["United States"],
page: 1,
per_page: Math.min(maxResults, 100),
}),
});

Output

Discovered attorneys are upserted into the attorneys table with enrichment_status: 'linkedin_only'. They have LinkedIn URLs and basic info but no email or phone -- those require Blitz API enrichment as a second step.

{
"success": true,
"count": 47,
"message": "Discovered 47 attorneys. Use blitz-enrich-attorney-contacts to get email/phone."
}

Data Flow

Apollo vs Blitz: When to Use Which

NeedUse
Company enrichment (firm or prospect)Apollo (apollo-enrich-company, apollo-enrich-sales-company)
Attorney discovery at a firmBlitz (primary) or Apollo (alternative)
Attorney email lookupBlitz (/v2/enrichment/email) -- Apollo does not provide this
Attorney phone lookupBlitz (/v2/enrichment/phone) -- Apollo does not provide this
Company search by name/domainApollo (apollo-org-search)

The typical workflow is:

  1. Enrich firm with Apollo (get apollo_org_id, company data)
  2. Discover attorneys with Blitz employee-finder (or Apollo people search)
  3. Enrich attorney contacts with Blitz email + phone endpoints

Error Handling

HTTP StatusMeaning
200Success
400Missing required parameters
401Invalid API key
404No organization found for domain
429Rate limited
500Apollo server error

On failure, the enrichment status is set to 'failed' on the company record for visibility in the UI.