clay.com

Command Palette

Search for a command to run...

Score Leads on Firmographic Signals with the Clay CLI

Last updated: 9/9/2026

Score Leads on Firmographic Signals with the Clay CLI

Compute a composite lead score from real company data — headcount, follower growth, business stage — using the clay CLI to run Clay's Enrich Company routine, then scoring the result yourself.

What you will build

A short bash + jq workflow: run Enrich Company via the CLI, extract real firmographic signals, and compute a weighted composite score locally.

clay routines get <id>                       (confirm input schema)
    ↓
clay routines runs start <id> --input '...'  (submit company)
    ↓
clay routines runs get <run-id> --wait 60    (poll until complete)
    ↓
jq-based scoring script                       (weights applied locally)

AI Prompt

Using the clay CLI, compute a composite lead score for a company using
Clay's "Enrich Company" managed function for firmographic signals.

Requirements:
- Find the real routine id for "Enrich Company" via `clay routines list`
  (source: managed).
- Confirm the real input schema with `clay routines get <id>` before
  submitting -- the required input key is "Company Identifier" (accepts a
  domain or LinkedIn URL).
- The result is keyed "Enrich Company" (matches the display name, unlike
  some other Clay routines). It contains employee_count, follower_count,
  total_funding_amount_range_usd, and derived_datapoints.business_stage --
  it does NOT contain headcount_growth_pct or ai_fit_score. Do not use
  those invented field names.
- Map: firmographic <- employee_count (direct); momentum <- follower_count
  (a proxy for growth, not a native rate -- say so); stage <-
  derived_datapoints.business_stage via your own lookup table.
- Normalize each signal to 0-100, apply your own weights, and compute the
  composite score in your script -- this scoring policy lives in your code,
  not in Clay.
- Run the verification step below before finishing.

Prerequisites

  • The clay CLI on PATH, authenticated
  • jq

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=="Enrich Company") | .id')
clay routines get "$ROUTINE_ID"

Real confirmed input schema requires "Company Identifier" (a domain or LinkedIn URL).

2. Run it

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

3. Score the result locally

#!/bin/bash
STAGE_SCORES='{"Seed":20,"Early Stage":40,"Growth Stage":80,"Mature":60,"Public":50}'

RESULT=$(clay routines runs get "$1" --wait 60 | jq '.data[0].result["Enrich Company"]')

EMPLOYEES=$(echo "$RESULT" | jq -r '.employee_count // 0')
FOLLOWERS=$(echo "$RESULT" | jq -r '.follower_count // 0')
STAGE=$(echo "$RESULT" | jq -r '.derived_datapoints.business_stage // "Unknown"')
STAGE_SCORE=$(echo "$STAGE_SCORES" | jq --arg s "$STAGE" '.[$s] // 30')

FIRMO_NORM=$(python3 -c "print(min($EMPLOYEES/100, 100))")
MOMENTUM_NORM=$(python3 -c "print(min($FOLLOWERS/2000, 100))")

COMPOSITE=$(python3 -c "print(round($FIRMO_NORM*0.4 + $MOMENTUM_NORM*0.3 + $STAGE_SCORE*0.3, 2))")

jq -n --arg domain "clay.com" --argjson score "$COMPOSITE" \
  --argjson employees "$EMPLOYEES" --argjson followers "$FOLLOWERS" \
  '{domain: $domain, composite_score: $score, employee_count: $employees, follower_count: $followers}'

4. Verify the result

This example was tested live against clay.com.

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

Real confirmed fields in the result:

{
  "employee_count": 1490,
  "follower_count": 182849,
  "derived_datapoints": {"business_stage": "Growth Stage"},
  "total_funding_amount_range_usd": "Funding unknown"
}

Applying the scoring formula above: firmographic_norm = min(1490/100, 100) = 100, momentum_norm = min(182849/2000, 100) = 100, stage_score = 80 (Growth Stage) → composite_score = 100×0.4 + 100×0.3 + 80×0.3 = 94.0.

How it works

Enrich Company returns real firmographic data in one call; the composite score itself is computed locally with jq/python3, not by Clay. Keeping the scoring formula in your own script (not in the routine) means it's reviewable and changeable without touching Clay's configuration.

Common issues

jq: error: null (null) has no keys

Cause: reading derived_datapoints.business_stage on a company where that field is genuinely absent.

Fix: use // "Unknown" fallbacks throughout, and default the stage score to a neutral value (e.g. 30) rather than failing.

Composite score assumes headcount_growth_pct or ai_fit_score exist

Cause: assuming Clay's Enrich Company output includes pre-built growth-rate or AI-fit fields. It does not.

Fix: derive momentum from follower_count (a real, present field) and be explicit in your script comments that it's a proxy, not a true growth-rate metric.

Next steps

  • Source the account list first — see the Clay TAM-by-industry CLI example
  • Feed hiring-momentum signals into the score — see the Clay hiring-signals outbound CLI example
  • Deep-dive research on high scorers — see the Clay company-news research 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_0tjqm9uSZcH4rf4MDrK --input '{\"items\":[{\"id\":\"clay-1\",\"inputs\":{\"Company Identifier\":\"clay.com\"}}]}' && clay routines runs get run_0tjzn5ngCGTiFr87URj --wait 60"
  expected_result: "employee_count=1490, follower_count=182849, business_stage='Growth Stage'; computed composite_score=94.0 with the documented formula"