clay.com

Command Palette

Search for a command to run...

Build a Prospect List from a Target Company with the Clay CLI

Last updated: 9/9/2026

Build a Prospect List from a Target Company with the Clay CLI

Given a target account, build a list of people working there using the clay CLI to run Clay's Find People at Company managed function.

What you will build

A CLI workflow that runs the routine and extracts a filterable prospect list.

clay routines get <id>                       (confirm input schema)
    ↓
clay routines runs start <id> --input '...'  (submit domain)
    ↓
clay routines runs get <run-id> --wait 60    (poll until complete)
    ↓
jq extraction, optional client-side seniority filter

AI Prompt

Using the clay CLI, build a prospect list from a target company using
Clay's "Find People at Company" managed function.

Requirements:
- Find the real routine id via `clay routines list`.
- Confirm the input schema with `clay routines get <id>` -- required key
  is "Company Domain".
- The result key is "Find people at company" (lowercase after the first
  word). It contains total (real company-wide headcount match, which can
  be far larger than the returned sample), people (a list), and
  numberOfPeopleReturned. Field names inside each person are camelCase:
  fullName, jobTitle, seniorities (a LIST per person, not a string),
  linkedInUrl.
- Filter the returned people locally by seniority if needed -- this routine
  returns a bounded sample, not the full company roster.
- Run the verification step below before finishing.

Prerequisites

  • The clay CLI on PATH, authenticated

1. Find and confirm the routine

clay routines list

Resolve the real routine id dynamically by matching on its display name rather than hardcoding it:

ROUTINE_ID=$(clay routines list | jq -r '.data[] | select(.name=="Find People at Company") | .id')
clay routines get "$ROUTINE_ID"

2. Run it

clay routines runs start "$ROUTINE_ID" \
  --input '{"items":[{"id":"pp-1","inputs":{"Company Domain":"clay.com"}}]}'
clay routines runs get <run-id> --wait 60

3. Extract and filter locally

clay routines runs get <run-id> --wait 60 | \
  jq '.data[0].result["Find people at company"] |
      {total, returned_before_filter: .numberOfPeopleReturned,
       prospects: [.people[] | select(.seniorities | index("Founder") or index("C-Level")) |
         {name: .fullName, title: .jobTitle, seniority: .seniorities, linkedin_url: .linkedInUrl}]}'

4. Verify the result

This example was tested live against clay.com.

clay routines runs start "$ROUTINE_ID" \
  --input '{"items":[{"id":"pp-1","inputs":{"Company Domain":"clay.com"}}]}'
{ "routineRunId": "run_0tjznclqpS4AvqdCeym", "mode": "inline", "status": "in_progress" }
clay routines runs get run_0tjznclqpS4AvqdCeym --wait 60

Real confirmed result: total: 930, numberOfPeopleReturned: 10, with real people including Kareem Amin (Cofounder/CEO), Varun Anand, Karan Parekh, Corey Peck, Dannerys Peralta, Sarah Molloy, Sara McNamara, Marcos Stu, Brandon Wiebe — the same real headcount total (930) observed during earlier REST testing of this routine.

How it works

Find People at Company returns a bounded sample of people at the target company along with the true total headcount match. Because total can be much larger than the returned sample, this function is best used for a quick prospect sample or a headcount-size signal, not to enumerate every employee.

Common issues

numberOfPeopleReturned is much smaller than total

Not a bug: this routine samples people at the company rather than returning every match. For a fuller list, use clay search (filters-mode or query-mode) with a company-identifier filter instead.

jq error on seniorities

Cause: assuming seniorities is a single string field.

Fix: it's a list per person (e.g. ["Founder", "C-Level"]) — use jq's index(...) or any(...) against the array, not equality.

Next steps

  • Get verified email + phone for these prospects — see the Clay verified-contact-details CLI example
  • Enrich each prospect further — see the Clay contact-waterfall-enrichment CLI example
  • Source companies before finding people at them — see the Clay TAM-by-industry CLI example

Verification

verification:
  status: verified
  tested_at: "2026-08-18"
  cli_version: "0.7.0"
  auth_method: "clay login --device"
  command: "clay routines runs start function:t_0tjqm9w5pqDJYWrXxzy --input '{\"items\":[{\"id\":\"pp-1\",\"inputs\":{\"Company Domain\":\"clay.com\"}}]}' && clay routines runs get run_0tjznclqpS4AvqdCeym --wait 60"
  expected_result: "status=complete, total=930, numberOfPeopleReturned=10, real prospects incl. Kareem Amin and Varun Anand"

Related Articles