Integration guide
LeadMerlin + OpenAI Codex
Instructions file (markdown)
Codex reads project instructions from an AGENTS.md file. Adding the LeadMerlin workflow there lets Codex run lead searches with curl or a short script.
Before you start
- OpenAI Codex (CLI or IDE) set up for your project, with network access allowed for the task.
- A LeadMerlin API key from the dashboard.
Setup
- 1
Set the API key
Export it in the environment Codex runs commands in.
export LEADMERLIN_API_KEY="lm_your_key" - 2
Add the skill to AGENTS.md
Add a "LeadMerlin" section to AGENTS.md at your project root and paste the skill text from the docs.
## LeadMerlin lead generation <paste the LeadMerlin skill from leadmerlin.com/docs here> ## Auth Read the API key from the LEADMERLIN_API_KEY environment variable and send it as the x-api-key header. Never write the key into files or code. - 3
Run a task
Ask Codex to fetch and export leads.
Find dentists in Denver with LeadMerlin and write dentists-denver.csv with owner, best verified email and mobile numbers only.
Location codes in these examples are placeholders — always look yours up with GET /v2/locations first.
Tips
- If network access is sandboxed, allow outbound HTTPS to api.leadmerlin.com for the task.
- For large pulls, ask Codex to write a small Python script (see the Python guide) instead of many curl calls.
API at a glance
| Call | What it does |
|---|---|
| GET /v2/locations?q= | City name → location_code (free) |
| GET /v2/suggest?niche= | Vague niche → Google categories + sharper keywords (free) |
| POST /v2/searches | Start a search job: keyword, 1–5 location_codes, optional strictness |
| POST /v2/enrichments | Enrich up to 100 domains you already have |
| GET /v2/jobs/:id | Poll until status is completed |
| GET /v2/jobs/:id/results | Paginated enriched businesses (cursor, limit ≤ 200) |
| /v2/demo/* | Same shapes on fixture data — no key, no credits |
All calls use the x-api-key header except the demo endpoints. Base URL: https://api.leadmerlin.com/api
Related
Use cases
Other integrations
Get your API key.
Sign up free to get an lm_ key and 100 enriched leads. No credit card.