Skip to content
B2BenrichA ContactLevel company

TAM mapping with an API: every account and buyer that fits your ICP

How a GTM engineer maps a total addressable market with an API: turn the ICP into filters, count before you pull, page through results and keep it fresh.

Dag Holmen · Updated · 5 min read

View as Markdown

TAM mapping turns your ICP into a list: every company that fits, the buyers inside each one, and the query that found them, stored where your code can read it. A market-size number tells you how big the opportunity is. A mapped TAM tells you which accounts make it up, which ones you already cover and who to reach at the rest.

With an API, the map is a query you can rerun. This guide walks through the build with B2Benrich: filters, counts, segments, paging, dedupe, storage and refresh.

What a mapped TAM contains

Two tables and a file.

  • Accounts. One row per company: company_id, name, domain, industry, size and the segment it belongs to.
  • Buyers. One row per person: id, name, title, LinkedIn URL, company_id, and when you first and last saw them.
  • The query. The exact filters behind both tables, saved with the run date.

Teams skip the third part. Without it, nobody can say why an account is on the list or rebuild it next quarter.

Step 1: Write the ICP as filters

Take each line of your ICP and find the filter that expresses it. The Prospector endpoint takes company and contact filters in the same request, so one query covers both halves.

ICP lineFilterGoes in
B2B software companiesindustry_linkedincompany_filters
50 to 1,000 employeesemployee_count_rangecompany_filters
Headquartered in the UShq_countrycompany_filters
Runs HubSpottechnologiescompany_filters
Marketing leadersjob_function, job_levelcontact_filters
Based in the UScountry_namecontact_filters

Filters match exact strings. Pull the allowed values for each field from POST /v1/search/meta/{field} and check your filters against them in code. The values in this guide are placeholders.

Use job_function plus job_level rather than job_title. Titles vary too much to map a whole market with them.

Step 2: Count before you pull

POST /v1/search/prospector/count takes the same filters as a search and returns only the total.

curl --request POST \
  --url https://api.b2benrich.com/v1/search/prospector/count \
  --header 'Content-Type: application/json' \
  --header 'X-Api-Key: YOUR_API_KEY' \
  --data '{
    "contact_filters": { "job_function": "Marketing", "job_level": "Director" },
    "company_filters": { "industry_linkedin": "Software Development", "hq_country": "United States" }
  }'
{ "total_count": 46910 }

That number is an example, not a real count. It counts people, not companies, because Prospector returns people. For accounts, count unique company_id values after the pull. It's also your first sanity check: if it's far from what you expected, fix the filters now, not after a hundred pages.

Step 3: Split the count into segments

One total hides the shape of the market. Add one more filter, such as size band or country, and run the count once per value. Here's an example breakdown by size band (made-up numbers):

employee_count_rangeBuyers
51-2009,820
201-5007,450
501-10004,130

Segments tell you where to start, give you a number to track coverage against and keep each pull small enough to rerun alone. For a full grid of counts across industry, size and region, see B2B market sizing.

Pick segments that don't overlap. Size bands and countries are clean cuts. Two technologies aren't: a company can run both, and its people land in both segments.

Step 4: Pull every page and dedupe on id

When the counts look right, page through each segment until has_more is false. This Node script builds both tables, keying people on id and accounts on company_id, so overlaps and reruns don't create duplicates:

import fs from 'node:fs';

const BASE = 'https://api.b2benrich.com';

async function post(path, body) {
  const res = await fetch(`${BASE}${path}`, {
    method: 'POST',
    headers: { 'Content-Type': 'application/json', 'X-Api-Key': process.env.B2BENRICH_KEY },
    body: JSON.stringify(body)
  });
  if (!res.ok) throw new Error(`${path}: ${res.status}`);
  return res.json();
}

// Placeholder values: copy the exact strings from /v1/search/meta/{field}
const icp = {
  contact_filters: { job_function: 'Marketing', job_level: 'Director' },
  company_filters: { industry_linkedin: 'Software Development', hq_country: 'United States' }
};
const segments = ['51-200', '201-500', '501-1000'];

const people = new Map();
const accounts = new Map();
const run = { run_at: new Date().toISOString(), icp, counts: {} };

for (const band of segments) {
  const query = { ...icp, company_filters: { ...icp.company_filters, employee_count_range: band } };
  run.counts[band] = (await post('/v1/search/prospector/count', query)).total_count;

  let page = 1;
  while (true) {
    const data = await post('/v1/search/prospector', { ...query, page, page_size: 100 });
    for (const r of data.records) {
      people.set(r.id, { ...r, segment: band });
      if (!accounts.has(r.company_id)) {
        accounts.set(r.company_id, {
          company_id: r.company_id, name: r.company_name, domain: r.company_domain,
          industry: r.industry, size: r.company_size, segment: band
        });
      }
    }
    if (!data.has_more) break;
    page = data.next_page ?? page + 1;
  }
}

fs.writeFileSync('tam-people.json', JSON.stringify([...people.values()]));
fs.writeFileSync('tam-accounts.json', JSON.stringify([...accounts.values()]));
fs.writeFileSync('tam-run.json', JSON.stringify(run, null, 2));

The prospecting API guide covers the Prospector request and response in more detail.

Step 5: Store it

JSON files are fine for a first pass. For a map you'll keep, use a database with three tables: accounts, people and runs. Each run row holds the filters, date and segment counts. Each person row holds the first and last run it appeared in. Upsert on id and company_id.

Add work emails later, when an account moves into outreach, with POST /v1/enrich/person/name-domain-to-email.

Step 6: Refresh on a schedule

Companies grow into your size band and people change jobs. Rerun the saved query monthly and compare the id sets with the last run:

  • New: route the people and accounts to whoever works them.
  • Still there: update their last-seen run.
  • Missing: flag them, don't delete them. They're history, and they may show up at another account.

Run the counts first on every refresh. A sudden jump or drop in one segment usually means a filter value changed, so check the meta lists before you trust the diff. Reruns cost nothing extra: B2Benrich is one plan, unlimited API usage for $500 a month, with no credits.

Optional: add intent as a layer

A mapped TAM says who fits, not who's looking right now. Intent data adds that: which accounts in your map are researching your category, your problem or your competitors. Store it as columns on the accounts table, not a separate list, so you can see what share of the market is active. B2Benrich is adding intent data to the API, and the call goes here once it's documented.

The in-market account list guide shows the full fit-plus-intent build.

Frequently asked questions

What does a TAM mapping API do?
It turns your ICP into a list in code: every company and buyer that fits, pulled with filters and stored with the query that produced it. Because the map is a saved query, you can rerun it to keep the list current.
How do I build a TAM list with an API?
Write each ICP criterion as a company or contact filter, look up the exact values with /v1/search/meta/{field}, size the market with /v1/search/prospector/count, then page through /v1/search/prospector by segment. Dedupe people on id and accounts on company_id, and store the results with the query.
Does the count endpoint count companies or people?
People. Prospector returns people, so /v1/search/prospector/count returns how many people match. For a company count, count unique company_id values after the pull, or read total_count from /v1/search/companies.
How often should I refresh a TAM list?
Monthly works for most teams. Rerun the same saved query, compare record IDs with the last run, route new people and accounts, and flag the ones that dropped out instead of deleting them.
Can I add intent data to a TAM map?
Yes, as a layer on the accounts you already mapped. Intent shows which accounts are researching your topics now. B2Benrich is adding intent data to its API, and it plugs into the same accounts table.

Get your API key.

Sign up, make your first call and start building your lists.

We’ll email you a link to log in. · Read the docs