API enrichment skill

Build API-first enrichment pipelines — provider selection, batching, retries, rate limits, idempotency, webhooks, cost tracking, and CRM writes.

by LeadMagic·MIT license·★ 62 Stars on the repo·GitHub ↗

Use now

Inside this skill

SKILL.md · the author's own words
# API Enrichment

## Overview

API enrichment fails when teams treat it like a simple loop over contacts. The hard parts are not the HTTP calls — they are data quality, d…

This skill builds a production-ready enrichment pipeline that can process leads, contacts, and accounts without silent failures or uncontro…

## When to Use

Use this skill when the user asks to: "build an enrichment API pipeline", "integrate enrichment directly into our app", "set up automated e…

Do not use this for tool-specific no-code workflows. Use `clay-automation` or `n8n-automation` when the user wants a no-code platform.

## Authoritative Foundations

Word-for-word excerpt, not a result. Read the full SKILL.md ↓

Files of API enrichment

LeadMagic/main1 file shown
SKILL.md
Show the full text154 lines

API Enrichment

Overview

API enrichment fails when teams treat it like a simple loop over contacts. The hard parts are not the HTTP calls — they are data quality, deduplication, retry safety, rate limiting, cost controls, and knowing when not to enrich.

This skill builds a production-ready enrichment pipeline that can process leads, contacts, and accounts without silent failures or uncontrolled vendor spend.

When to Use

Use this skill when the user asks to: "build an enrichment API pipeline", "integrate enrichment directly into our app", "set up automated enrichment via API", "replace manual enrichment with API calls", "batch enrich contacts", "add enrichment to inbound routing", "push enriched data to CRM", or "handle enrichment retries and webhooks".

Do not use this for tool-specific no-code workflows. Use clay-automation or n8n-automation when the user wants a no-code platform.

Authoritative Foundations

REST API Best Practices — Idempotency and Retries

Any bulk enrichment job needs idempotent writes and retry-safe requests. A retry should never create duplicate contacts, duplicate CRM notes, or duplicate sequence enrollment.

DAMA-DMBOK — Data Quality Dimensions

Provider waterfalls improve coverage and cost control by trying the best-fit source first, then falling back only when needed. This avoids paying multiple providers for the same field.

Data Quality Management — Source Priority and Freshness

Fields need source attribution and timestamps. A title from two years ago should not override a title returned yesterday. Freshness and source priority are part of the data model.

Webhook Integration Patterns

Async jobs should call back when complete instead of forcing the client to poll. Webhooks need signature verification, retry handling, and event deduplication.

Prerequisites

  • Canonical record ID for every contact/account
  • Source-of-truth CRM fields
  • Provider API keys
  • Rate limits and pricing model for each provider
  • Field-level priority rules
  • Error logging destination
  • Webhook endpoint if processing async jobs

Step-by-Step Process

Phase 1: Define the Enrichment Contract
Field Type Examples Owner
Identity name, email, phone Enrichment pipeline
Company domain, size, industry, funding Enrichment pipeline
Sales context lifecycle stage, owner, next step CRM / rep
Compliance suppression, opt-out, consent Compliance system / CRM

Never let enrichment overwrite human-owned sales fields without explicit rules.

Phase 2: Build the Request Model

For every request, include external ID, input fields, provider selected, requested field set, idempotency key, timestamp, and callback URL if async. Use deterministic idempotency keys such as record_id + provider + field_set + date_bucket.

Phase 3: Design the Provider Waterfall
Step Use When Stop Condition
Primary provider Best cost/coverage for segment Required fields returned
Secondary provider Primary misses critical field Critical fields returned
Specialist provider Region/persona/company-type gap Specialist field returned
Manual review High-value account still incomplete Human decides

Do not call every provider for every record. Waterfall only when the previous step misses.

Phase 4: Implement Reliability Controls

Minimum controls: exponential backoff, dead-letter queue, rate-limit budget, cost ceiling, field source attribution, hash-based dedupe before CRM write, webhook signature verification.

Phase 5: Monitor the Pipeline

Track coverage by field, match rate by provider, cost per enriched record, error rate by provider, latency p50/p95, CRM write success rate, and duplicate rate.

Output Format

# API Enrichment Pipeline Plan

## Fields Owned
| Field | Source Priority | Freshness Rule | CRM Write Rule |
|---|---|---|---|

## Provider Waterfall
| Step | Provider Type | Trigger | Stop Condition | Cost Guardrail |
|---|---|---|---|---|

## Request Contract
- Required inputs:
- Idempotency key:
- Retry policy:
- Webhook policy:

## Monitoring
- Coverage:
- Cost:
- Errors:
- Latency:

Quality Check

Before delivering, verify:

  • Every field has source attribution
  • Retry logic is idempotent
  • Provider calls stop when required fields are found
  • CRM writes cannot duplicate records
  • Rate limits and cost ceilings are defined
  • Webhooks include verification and dedupe
  • Monitoring covers coverage, cost, errors, latency, and CRM writes

Common Pitfalls

  1. Looping over contacts without idempotency. Retries create duplicates. Fix: idempotency keys and upserts.
  2. Calling all providers every time. Costs explode. Fix: waterfall by stop condition.
  3. Overwriting rep-owned fields. Enrichment corrupts active deals. Fix: field ownership rules.
  4. Silent failures. Missing data looks like no match. Fix: explicit error states and dead-letter queue.
  5. No freshness rule. Old data overwrites newer CRM data. Fix: compare timestamps and source priority.
  6. Polling huge jobs. Polling wastes compute and API calls. Fix: signed webhooks with retry handling.

Execution Artifacts

  • references/framework-notes.md — named frameworks, citation anchors, and operating assumptions
  • templates/output-template.md — copy-paste deliverable structure for the user
  • scripts/check-output.py — local checklist validator for required sections This skill includes lightweight artifacts the agent can load on demand: Use the artifacts when the user asks for an implementation-ready deliverable, a repeatable workflow, or a quality check rather than generic advice.
  • waterfall-enrichment — multi-provider enrichment design
  • data-enrichment-strategy — source selection and data quality
  • crm-integration — CRM writes and lifecycle fields
  • campaign-analytics — measuring enrichment impact on pipeline
1---
2name: api-enrichment
3description: >-
4 Build API-first enrichment pipelines — provider selection, batching, retries,
5 rate limits, idempotency, webhooks, cost tracking, and CRM writes. Use when
6 integrating enrichment APIs directly into GTM systems or replacing manual data
7 workflows with programmatic pipelines.
8license: MIT
9compatibility: Claude Code, Codex, GitHub Copilot, Cursor, Gemini CLI, OpenCode, Goose, Hermes, Windsurf, Zed
10metadata:
11 version: "1.0.0"
12 author: LeadMagic
13 category: automation
14 tags: [api, enrichment, automation, pipelines, data-quality]
15 related_skills: [waterfall-enrichment, data-enrichment-strategy, crm-integration, campaign-analytics]
16 frameworks: [REST API Best Practices, Bulk Enrichment Patterns, DAMA-DMBOK Data Quality Dimensions, Idempotent API Design]
17---
18 
19# API Enrichment
20 
21## Overview
22 
23API enrichment fails when teams treat it like a simple loop over contacts. The hard parts are not the HTTP calls — they are data quality, deduplication, retry safety, rate limiting, cost controls, and knowing when not to enrich.
24 
25This skill builds a production-ready enrichment pipeline that can process leads, contacts, and accounts without silent failures or uncontrolled vendor spend.
26 
27## When to Use
28 
29Use this skill when the user asks to: "build an enrichment API pipeline", "integrate enrichment directly into our app", "set up automated enrichment via API", "replace manual enrichment with API calls", "batch enrich contacts", "add enrichment to inbound routing", "push enriched data to CRM", or "handle enrichment retries and webhooks".
30 
31Do not use this for tool-specific no-code workflows. Use `clay-automation` or `n8n-automation` when the user wants a no-code platform.
32 
33## Authoritative Foundations
34 
35### REST API Best Practices — Idempotency and Retries
36Any bulk enrichment job needs idempotent writes and retry-safe requests. A retry should never create duplicate contacts, duplicate CRM notes, or duplicate sequence enrollment.
37 
38### DAMA-DMBOK — Data Quality Dimensions
39Provider waterfalls improve coverage and cost control by trying the best-fit source first, then falling back only when needed. This avoids paying multiple providers for the same field.
40 
41### Data Quality Management — Source Priority and Freshness
42Fields need source attribution and timestamps. A title from two years ago should not override a title returned yesterday. Freshness and source priority are part of the data model.
43 
44### Webhook Integration Patterns
45Async jobs should call back when complete instead of forcing the client to poll. Webhooks need signature verification, retry handling, and event deduplication.
46 
47## Prerequisites
48 
49- Canonical record ID for every contact/account
50- Source-of-truth CRM fields
51- Provider API keys
52- Rate limits and pricing model for each provider
53- Field-level priority rules
54- Error logging destination
55- Webhook endpoint if processing async jobs
56 
57## Step-by-Step Process
58 
59### Phase 1: Define the Enrichment Contract
60 
61| Field Type | Examples | Owner |
62|---|---|---|
63| Identity | name, email, phone | Enrichment pipeline |
64| Company | domain, size, industry, funding | Enrichment pipeline |
65| Sales context | lifecycle stage, owner, next step | CRM / rep |
66| Compliance | suppression, opt-out, consent | Compliance system / CRM |
67 
68Never let enrichment overwrite human-owned sales fields without explicit rules.
69 
70### Phase 2: Build the Request Model
71 
72For every request, include external ID, input fields, provider selected, requested field set, idempotency key, timestamp, and callback URL if async. Use deterministic idempotency keys such as `record_id + provider + field_set + date_bucket`.
73 
74### Phase 3: Design the Provider Waterfall
75 
76| Step | Use When | Stop Condition |
77|---|---|---|
78| Primary provider | Best cost/coverage for segment | Required fields returned |
79| Secondary provider | Primary misses critical field | Critical fields returned |
80| Specialist provider | Region/persona/company-type gap | Specialist field returned |
81| Manual review | High-value account still incomplete | Human decides |
82 
83Do not call every provider for every record. Waterfall only when the previous step misses.
84 
85### Phase 4: Implement Reliability Controls
86 
87Minimum controls: exponential backoff, dead-letter queue, rate-limit budget, cost ceiling, field source attribution, hash-based dedupe before CRM write, webhook signature verification.
88 
89### Phase 5: Monitor the Pipeline
90 
91Track coverage by field, match rate by provider, cost per enriched record, error rate by provider, latency p50/p95, CRM write success rate, and duplicate rate.
92 
93## Output Format
94 
95```markdown
96# API Enrichment Pipeline Plan
97 
98## Fields Owned
99| Field | Source Priority | Freshness Rule | CRM Write Rule |
100|---|---|---|---|
101 
102## Provider Waterfall
103| Step | Provider Type | Trigger | Stop Condition | Cost Guardrail |
104|---|---|---|---|---|
105 
106## Request Contract
107- Required inputs:
108- Idempotency key:
109- Retry policy:
110- Webhook policy:
111 
112## Monitoring
113- Coverage:
114- Cost:
115- Errors:
116- Latency:
117```
118 
119## Quality Check
120 
121Before delivering, verify:
122 
123- [ ] Every field has source attribution
124- [ ] Retry logic is idempotent
125- [ ] Provider calls stop when required fields are found
126- [ ] CRM writes cannot duplicate records
127- [ ] Rate limits and cost ceilings are defined
128- [ ] Webhooks include verification and dedupe
129- [ ] Monitoring covers coverage, cost, errors, latency, and CRM writes
130 
131## Common Pitfalls
132 
1331. **Looping over contacts without idempotency.** Retries create duplicates. Fix: idempotency keys and upserts.
1342. **Calling all providers every time.** Costs explode. Fix: waterfall by stop condition.
1353. **Overwriting rep-owned fields.** Enrichment corrupts active deals. Fix: field ownership rules.
1364. **Silent failures.** Missing data looks like no match. Fix: explicit error states and dead-letter queue.
1375. **No freshness rule.** Old data overwrites newer CRM data. Fix: compare timestamps and source priority.
1386. **Polling huge jobs.** Polling wastes compute and API calls. Fix: signed webhooks with retry handling.
139 
140## Execution Artifacts
141 
142- `references/framework-notes.md` — named frameworks, citation anchors, and operating assumptions
143- `templates/output-template.md` — copy-paste deliverable structure for the user
144- `scripts/check-output.py` — local checklist validator for required sections
145This skill includes lightweight artifacts the agent can load on demand:
146Use the artifacts when the user asks for an implementation-ready deliverable, a repeatable workflow, or a quality check rather than generic advice.
147 
148## Related Skills
149 
150- `waterfall-enrichment` — multi-provider enrichment design
151- `data-enrichment-strategy` — source selection and data quality
152- `crm-integration` — CRM writes and lifecycle fields
153- `campaign-analytics` — measuring enrichment impact on pipeline
154 

Discussion

Alternatives

API and interface designGuides stable API and interface design. Use when designing APIs, module boundaries, or any public interface. Use when creating REST or GraphQL endpoints, defining type contracts between modules, or establishing boundaries between frontend and backend.Coding · MITContext7Pulls up-to-date, version-specific library docs and code examples into the prompt so the AI stops inventing old APIs.Coding · MITContext7 Documentation LookupFetch up-to-date documentation and code examples for any library, framework, SDK, CLI tool, or cloud service. Use whenever the user asks about a specific library — even well-known ones like React, Next.js, Prisma, Express, Tailwind, Django, or Spring Boot — because training data may not reflect recent API changes or version updates. Always use for: API syntax questions, configuration options, version migration issues, "how do I" questions mentioning a library name, debugging that involves library-specific behavior, setup instructions, and CLI tool usage. Use even when you think you know the answer. Do not rely on training data for API details, signatures, or configuration options — they are frequently out of date. Prefer this over web search for library documentation.Coding · MITAdaptyv Bio Foundry APIHow to use the Adaptyv Bio Foundry API and Python SDK for protein experiment design, submission, and results retrieval. Use this skill whenever the user mentions Adaptyv, Foundry API, protein binding assays, protein screening experiments, BLI/SPR assays, thermostability assays, or wants to submit protein sequences for experimental characterization. Also trigger when code imports `adaptyv`, `adaptyv_sdk`, or `FoundryClient`, or references `foundry-api-public.adaptyvbio.com`.Science · MIT