Pre-Black Friday: 20% off, for as long as you stayEARLYBFon Solo and AgencyEnds Nov 28Start free

How-to guide

How to use Claude Code for GTM engineering (with a B2B data API)

Connect, count, pull, enrich. Four steps, about 20 minutes, 6 records.

Get your free API key →Free to start. No credit card. 1,000 records to spend whenever you like.

Claude Code is useful for GTM engineering when it can reach real data. Connect a data source over MCP, let the agent count before it pulls, and keep the REST API for scripts you want to rerun.

This guide builds that loop with LeadOcean. It is short on purpose. Every step has a command you can paste.

TL;DR

  • You connect Claude Code to a data source, size a list for free, pull five people and enrich one.
  • It takes about 20 minutes.
  • It spends 6 LeadOcean records: 5 for the search page and 1 for the enrichment. The free plan has 1,000.

Prerequisites

  • Claude Code installed.
  • A LeadOcean account. Start free: no card, 1,000 records, one-off.
  • For the REST steps, an API key from your account, exported as $LEADOCEAN_API_KEY.
  • curl and a shell.

Step 1: Connect the MCP server

One command adds the server. Claude Code documents claude mcp add --transport http for remote servers (Claude Code MCP docs, October 2026).

bash
claude mcp add --transport http leadocean https://api.leadocean.io/mcp
claude mcp list

Then start Claude Code, run /mcp, select leadocean and sign in. The sign-in opens your browser for OAuth 2.1. No key is pasted. The agent now has 13 tools, and 7 of them spend no records. Full setup is on Connect LeadOcean to Claude Code.

Step 2: Size the list before you pull anyone

Make the agent count first. Counting is free, so a wrong filter costs nothing.

text
How many people titled "GTM Engineer" can I email?
Count only. Do not pull anyone. Say what the count includes.

Claude Code calls leadocean_count_leads with title set to ["GTM Engineer"]. We ran that call on 2026-10-21 and got this:

json
{
  "total": 475,
  "totalIsExact": true,
  "totalAll": 1617,
  "distinctCompanies": 404,
  "credits": 0
}

Read it carefully. The 475 is mailable people only: email status verified, catch_all_valid or catch_all. The 1,617 is everyone matching the title with no email condition. The call cost 0 records.

For companies, ask the same way. The leadocean_count_companies tool is also free.

Step 3: Pull a small sample over REST

Agents explore. Scripts repeat. Once the filter is right, put it in a request you can rerun. The search body is flat JSON, filters are arrays and limit runs 1 to 100.

bash
curl -s https://api.leadocean.io/v1/people/search \
  -H "x-api-key: $LEADOCEAN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"title": ["GTM Engineer"], "limit": 5}'

This returns 5 people and spends 5 records. Page through more with the cursor value from the response. One search pages to 10,000 rows. If meta.depthCapped is true, narrow the filters instead of walking further.

Do not paste results into the chat to look at them. Ask Claude Code to write a script that saves data to a file and prints only the fields you need.

Step 4: Enrich one person

Enrichment takes exactly one of linkedin_url, email, phone or person_id. There is no name plus domain lookup, so search first, then enrich by person_id.

bash
curl -s https://api.leadocean.io/v1/people/enrich \
  -H "x-api-key: $LEADOCEAN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"person_id": "PERSON_ID_FROM_STEP_3", "reveal_email": true}'

This costs 1 record. A person we hold nothing for is a 404 and costs nothing. Since October 2026 the response also carries career history: past roles, education, certifications and awards. Past employers have no company_id yet.

To have the agent do it, use a prompt like this:

text
Take the first person from the search above. Enrich them with reveal_email.
Show title, current company, email status and past roles. Spend one record only.

Step 5: Add guardrails, then export

An agent with a data key can spend records fast. Put the rules in a CLAUDE.md in the project so every session starts with them.

markdown
## LeadOcean rules
- Count with leadocean_count_leads before any search or export.
- Never pull more than 25 people without asking me.
- Look up exact enum strings with leadocean_list_enum_values. Do not guess.
- State what every count includes (mailable only, or all).

When the list is right, export it. Exports take up to 50,000 rows a request and 500,000 a day, and they reserve up to your limit when they start. Bulk CSV export is not on Free.

bash
curl -s -X POST https://api.leadocean.io/v1/exports \
  -H "x-api-key: $LEADOCEAN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "gtm-engineers", "filters": {"title": ["GTM Engineer"]}, "limit": 500, "preset": "full"}'

The body takes filters (any people search filter except cursor, limit, count and facets), limit (rows, up to 50,000) and an optional preset or columns list. The full preset carries the email and phone columns (API reference, October 2026).

Poll the export with leadocean_get_export, which is free. You can also build the same export in the app at app.leadocean.io: filter builder, column picker, price preview and a CSV download.

What you get

The response shape below is from the API reference at api.leadocean.io/openapi.json. The values are placeholders, not a real person.

json
{
  "success": true,
  "data": [
    {
      "profile_data": { "profile_full_name": "Jane Doe", "profile_headline": "GTM Engineer at Acme" },
      "contact_data": {
        "contact_current_experiences": [
          { "job_title": "GTM Engineer", "company_name": "Acme", "company_domain": "acme.com" }
        ],
        "has_email": true,
        "email_status": "verified"
      },
      "meta": { "source_ids": { "person_id": "<person_id>" } }
    }
  ],
  "meta": { "count": 5, "credits": 5, "nextCursor": "<cursor>" }
}

Keep meta.source_ids.person_id and meta.nextCursor. The first drives enrichment. The second drives the next page.

Troubleshooting

ErrorCauseFix
401Missing or wrong x-api-key.Check $LEADOCEAN_API_KEY is exported in the same shell. Create a new key in your account if needed.
429You went above your plan's rate limit: 5 requests a second on Free, 200 on Agency.Wait for the Retry-After header, then retry. Batch the agent's calls.
402Your 1,000 free records are spent.Check leadocean_get_account. Move to Solo or Agency, or shrink the next pull.
Empty resultsA filter value is not an exact string, such as a made-up job level.Call leadocean_list_enum_values and use the exact string it returns.
Export refusedYou went past 50,000 rows a request or 500,000 a day.Split the export into smaller filtered runs. Bulk CSV export is not on Free.

FAQ

Do I need the MCP server and the API?

No. Use MCP for exploring and sizing, where the agent picks tools. Use the REST API for anything you rerun on a schedule.

Does Claude Code replace Clay or a sequencer?

No. Claude Code writes and runs the workflow. LeadOcean supplies the data. Sending still needs a sequencer, and LeadOcean has no sequencer, dialer or CRM.

Why is the count lower than the total?

The default count is mailable people only. Pass an emailStatus filter to widen it. The response shows totalAll beside it.

How many records will a real project use?

Count first, then multiply. A search page of 25 is 25 records. Counts, empty pages and misses cost nothing. Paid plans run on a fair-use pace, not credits. See pricing.

What else connects to Claude Code?

Give Claude Code real GTM data

Free to start. No credit card. 1,000 records to spend whenever you like.

Get your free API key →