Prerequisites
-
A Context.dev API key. Sign up at context.dev, copy it from the dashboard, and save it to
.env(make sure.envis in.gitignore). - Admin access to your CRM to create a webhook on new leads and write fields back.
-
The Context.dev SDK for your backend, or call the API directly with
curl(no install required):
Architecture
The pipeline has two jobs:- Enrich a lead’s company profile by saving the Brand API response in your CRM’s fields.
- Listen for new-lead events and run that enrichment on each one.
Step 1. Enrich with the Brand API
Here’s what the Brand API gives you:| Field | What it is |
|---|---|
brand.title | Company name. |
brand.description | One-paragraph company description. |
brand.slogan | Marketing tagline, when available. |
brand.domain | Canonical company domain. |
brand.logos[] | Image source URLs for all variants of the logo and icon. |
brand.colors[] | Hex codes for every color in the brand palette. |
brand.backdrops[] | Hero and background imagery. |
brand.socials[] | Links to their social profiles. |
brand.address | HQ address: street, city, state/province, country, and postal code. |
brand.phone | Public contact phone, when available. |
brand.email | Public contact email, when available. |
brand.industries.eic[] | Industry and subindustry classification. (Read more about EIC) |
brand.stock | Stock ticker and the name of the exchange for public companies, otherwise null. |
brand.primary_language | Detected language of the brand’s site. |
- Free and personal email filtering is built in. Brand API rejects Gmail, Yahoo, and 10,000+ free or disposable providers with a 422 error code. Keep placeholders for when data can’t be found.
- Set a timeout. Pass
timeoutMSso a cold lookup can’t hang your handler. A first-time domain can take a few seconds; warm lookups return in about 250ms. - Cache by domain. Enrich once per company and store the result in your own database keyed by domain. Since brand details don’t change often, this will save your API credits.
Step 2. Listen for new leads
Every major CRM platform lets you set up webhooks. When set up, every time you add a new lead, the CRM app will send a POST request to the configured endpoint. You’ll need to create a backend server which serves this route by using the work email field to pull data from Context.dev’s Brand API and then write the brand profile data back to the CRM.| CRM | How to set up a webhook on new leads | Docs |
|---|---|---|
| HubSpot | Subscribe a private app to the contact.creation event (Settings → Integrations → Private Apps → Webhooks). | Private app webhooks |
| Salesforce | A record-triggered Flow on Lead → created, with an HTTP Callout (or Outbound Message) action to your endpoint. | Configure an HTTP Callout |
| Zoho CRM | A workflow rule on the Leads module with a Webhook action, or the Webhook API. | Webhooks in workflows |
| Pipedrive | A Webhooks v2 subscription for create.person (or create.lead). | Guide for Webhooks v2 |
| monday.com | A create_item webhook on your leads board, via the API or the board integration. | Webhooks reference |
https://api.example.com/webhooks/hubspot).
Step 1 describes how to actually build this server.
(Optional) Get specific information about leads
When you need a specific data point your sales team cares about but isn’t included in the Brand API’s response, use the Extract API. It crawls the company’s website, runs an LLM over the pages, and returns values matching a JSON Schema you provide: describe each field you need (e.g., “Do they have referral rewards?”) and get typed answers in response. Add this to your server, right after the Brand API enrichment:Best practices
Enrich on create, not on read
Trigger enrichment when a lead is created or explicitly re-enriched, never on every record view. A view should read your cached columns, not fire an API call.Prefetch for faster response
Context.dev provides a prefetch endpoint that starts the scraping for building the brand profiles when a new brand comes in that isn’t already in Context.dev’s database.Handle the misses
Common failure situations:- Free or disposable email (HTTP 422). Expected. Don’t retry; you have no company domain to look up. Fall back to the rep’s typed company name.
- No brand found (HTTP 400,
error_code: "NOT_FOUND"). The domain isn’t in Context.dev’s index. Log it and show a “could not enrich” badge; reps like to know. - Cold-hit timeout (HTTP 408). Rare. Retry once with backoff, or let it fall through; the next call against that domain hits the now-warm cache.
Next steps
Retrieve by Email
Endpoint reference for the call this guide uses.
Prefetch for Faster Response
Hide cold-hit latency from your create-record handler.
Onboarding Flows
The same enrichment pattern, applied to in-product signup forms.
Classify Brands by Industry
Choosing between EIC, NAICS, and SIC for lead segmentation.