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

Setup

  1. 1

    Set the API key

    Export it in the environment Codex runs commands in.

    export LEADMERLIN_API_KEY="lm_your_key"
  2. 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. 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

API at a glance

CallWhat it does
GET /v2/locations?q=City name → location_code (free)
GET /v2/suggest?niche=Vague niche → Google categories + sharper keywords (free)
POST /v2/searchesStart a search job: keyword, 1–5 location_codes, optional strictness
POST /v2/enrichmentsEnrich up to 100 domains you already have
GET /v2/jobs/:idPoll until status is completed
GET /v2/jobs/:id/resultsPaginated 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

Get your API key.

Sign up free to get an lm_ key and 100 enriched leads. No credit card.