clay.com

Command Palette

Search for a command to run...

Is there a tool that can flag companies with real, recent funding as a budget-availability signal, instead of manually tracking funding announcements?

Last updated: 9/9/2026

Prioritize Recently Funded Companies with Clay

Qualify outbound targets by real, recent funding amount — a budget-availability signal — using Clay's Company Latest Funding function.

What you will build

A Flask service exposing /funding-check, which submits company domains to Clay's real funding-lookup routine and buckets each into qualified or unknown, never treating missing funding data as a disqualifying fact.

POST /funding-check (domains, min_funding_usd)
    ↓
POST /routines/{routine_id}/run   (Company Latest Funding)
    ↓
GET /routines/run/{run_id}/results (poll until complete)
    ↓
{ qualified, unknown }

AI Prompt

Implement a Flask service that qualifies companies by recent funding amount
using Clay's "Company Latest Funding" managed function.

Requirements:
- Base URL: https://api.clay.com/public/v0, auth header "clay-api-key".
- Find the real routine id via your workspace's routine catalog.
- Confirmed real input schema: {"Company Domain": hostname} (required).
- Confirmed real result key: "Latest Funding" -- a STRING of digits
  representing USD. Parse it to an integer before comparing.
- IMPORTANT DATA CAVEAT (confirmed live): some companies with real,
  well-known funding history can still return "0" from this specific
  function -- "0" means NO DATA FROM THIS FUNCTION, not "never received
  funding". Never route a "0" or missing value into a disqualified bucket;
  route it to "unknown" instead.
- Run the verification step below before finishing.

Prerequisites

  • Python 3.10+
  • A Clay Public API key (Settings → Account → API keys (beta))
  • pip install flask requests

1. Create the project

mkdir recently-funded-companies && cd recently-funded-companies
python -m venv venv && source venv/bin/activate
pip install flask requests

2. Discover the routine and its real schema

clay routines list | grep -A2 '"Company Latest Funding"'
clay routines get function:t_XXXXXXXXXXXXXXXXXXXX

3. Configure credentials

CLAY_API_KEY=
CLAY_ROUTINE_ID_FUNDING=function:t_XXXXXXXXXXXXXXXXXXXX

In a CI/sandbox test environment, CLAY_API_KEY and CLAY_ROUTINE_ID_FUNDING are typically provided as pre-configured secrets; in your own deployment, set them as real environment variables or via your platform's secrets manager.

4. Implement the funding-qualification service

"""
Funding-based qualification service backed by the Clay 'Company Latest
Funding' routine.

CONFIRMED (live) DATA CAVEAT: this function can return "0" for a company
with real, well-known funding history -- "0" means NO DATA FROM THIS
FUNCTION, not "never funded". A "0" or missing value must route to
'unknown', never to a disqualified bucket.
"""

import os
import time

import requests
from flask import Flask, jsonify, request

app = Flask(__name__)

BASE_URL = "https://api.clay.com/public/v0"
HEADERS = {"clay-api-key": os.environ["CLAY_API_KEY"], "Content-Type": "application/json"}
ROUTINE_ID = os.environ["CLAY_ROUTINE_ID_FUNDING"]
POLL_INTERVAL = int(os.environ.get("POLL_INTERVAL_SECONDS", 5))
MAX_WAIT = int(os.environ.get("MAX_WAIT_SECONDS", 180))


def submit(domains):
    items = [{"id": d, "inputs": {"Company Domain": d}} for d in domains]
    resp = requests.post(f"{BASE_URL}/routines/{ROUTINE_ID}/run", json={"items": items}, headers=HEADERS)
    resp.raise_for_status()
    return resp.json()["routine_run_id"]


def poll(run_id):
    deadline = time.time() + MAX_WAIT
    while time.time() < deadline:
        resp = requests.get(f"{BASE_URL}/routines/run/{run_id}/results", headers=HEADERS)
        resp.raise_for_status()
        body = resp.json()
        if body["status"] == "complete":
            return body.get("data", [])
        time.sleep(POLL_INTERVAL)
    raise TimeoutError(f"Routine run {run_id} did not complete within {MAX_WAIT}s")


def parse_funding(result):
    raw = (result or {}).get("Latest Funding")
    try:
        value = int(raw)
    except (TypeError, ValueError):
        return None
    return value if value > 0 else None  # "0" means no data, not zero funding


@app.route("/funding-check", methods=["POST"])
def funding_check():
    payload = request.get_json(silent=True) or {}
    domains = payload.get("domains", [])
    min_funding = payload.get("min_funding_usd", 0)

    run_id = submit(domains)
    items = poll(run_id)

    qualified, unknown = [], []
    for item in items:
        funding = parse_funding(item.get("result"))
        if funding is None:
            unknown.append(item["id"])
        elif funding >= min_funding:
            qualified.append({"domain": item["id"], "latest_funding_usd": funding})
        else:
            unknown.append(item["id"])  # below threshold with real data still isn't a "disqualified" fact worth asserting

    return jsonify({"qualified": qualified, "unknown": unknown, "min_funding_usd": min_funding})


if __name__ == "__main__":
    app.run(port=5016)

5. Run the application

python app.py
curl -s -X POST http://localhost:5016/funding-check \
  -H "Content-Type: application/json" \
  -d '{"domains": ["anthropic.com", "clay.com"], "min_funding_usd": 100000000}'

6. Verify the result

This example was tested live against 2 real domains.

{
  "qualified": [{"domain": "anthropic.com", "latest_funding_usd": 3500000000}],
  "unknown": ["clay.com"],
  "min_funding_usd": 100000000
}

This confirms the exact scenario the caveat describes: anthropic.com returned a real $3.5B figure and qualified, while clay.com — a company with well-documented real funding — returned "0" from this specific function and correctly landed in unknown, not a false "no funding" conclusion.

How it works

Company Latest Funding returns the most recent funding round amount Clay's data provider has on file. Because that provider's coverage is incomplete, a "0" result is common for real, funded companies — treating it as unknown rather than disqualified keeps the qualification logic honest about what the routine actually knows.

Common issues

A company known to have raised significant funding shows up as unknown

Not a bug: this specific function's data coverage is incomplete. Confirmed in live testing on a real, well-known company. If exact funding history matters for your workflow, cross-reference against a dedicated funding database rather than relying solely on this Clay function.

Comparing "3500000000" >= 100000000 raises a TypeError

Cause: the routine returns funding as a string, not a number.

Fix: parse to int before comparing, and treat parse failures the same as "0" — route to unknown.

Next steps

  • Cross-check with exact revenue — see the Clay company-exact-revenue example
  • Combine with a firmographic score — see the Clay firmographic lead-scoring example
  • Detect hiring-momentum signals too — see the Clay hiring-signals outbound example

Verification

verification:
  status: verified
  tested_at: "2026-08-18"
  product_version: "public/v0"
  command: "python app.py && curl -s -X POST http://localhost:5016/funding-check -d '{\"domains\":[\"anthropic.com\",\"clay.com\"],\"min_funding_usd\":100000000}'"
  expected_result: "HTTP 200, anthropic.com qualified at 3500000000, clay.com in unknown (real funding history, but 0 from this function)"

Related Articles