Blog

How we built an API for Clay

This post is for our fellow engineers & founders doing GTM / sales.

I used to think doing enrichment was for big companies with massive outbound sales functions.

Before launching Val Town for Teams (coming this week!), we set a goal: find 10 pre‑sales customers. All of a sudden, I was spending all my time looking for teams who could be the right fit.

Our best channel was obviously new users signing up for Val Town. However, scrolling through emails and hoping we recognize someone quickly became unsustainable. (And really it only works for celebrities anyways.)

Clearbit vs Clay vs Val Town

Clearbit used to be the obvious answer, but post‑HubSpot acquisition, it's no longer an option for small new customers.

Clay is great, but we wanted to use it like an API so anyone on our team could use it programatically, without Clay knowledge or set-up.

We asked on X, the CEO explained how we could do it.

Introducing: Clay API Proxy

We turned Clay into an API / SDK on Val Town via our Clay API Proxy.

The hard part was that Clay enrichments are triggered by one webhook, but you get the results from another webhook. We wanted the developer experience to be a single request that gets back the enriched data as the response.

Here's how we built it:

  1. Your val imports and calls our clay() "sdk" function with an email or GitHub username
  2. Our proxy authenticates you as a Val Town user
  3. We generate a request id, and forward the payload to Clay with that id
  4. Clay enriches, and POSTs the result back using the id. We save the result to SQLite.
  5. While your original request is still open, we poll sqlite for it.
  6. When it returns, we give you the JSON back in the normal request/response pattern.

Enriching emails with Clay is now as simple as:

import { clay } from "https://esm.town/v/charmaine/clay-proxy/sdk.ts";

const result = await clay({
  email: "steve@val.town",
  source: "user_signup",
});

console.log(result);

Which returns:

{
  "email": "steve@val.town",
  "person": "Steve Krouse",
  "linkedin": "https://www.linkedin.com/in/stevekrouse",
  "company": "Val Town",
  "funding": "Seed round",
  "totalFunding": "$7 million",
  "employeeCount": "6"
}

How this helps

User enrichment is a big part of how we successfully found our first 10 pre-sales customers.

Our users are no longer a long list of anonymous emails. We are able to more efficiently spend our time interacting with our ICP (Ideal Customer Profile) as soon as they sign up, instead of combing through endless dashboards in search of a unicorn.

  • We see new users joining in real-time, with their enriched profiles
  • Anyone can start a thread, tag the right person, or notify everyone else that they've already reached out. For example: image.png
  • Warm intros were easy to track
  • The team then starts building intuition about: how many new users joined, are we attracting ICP, who owns follow‑ups etc.

Then what?

Once you have this data on Val Town, there's lots you can do.

Here are some templates:

We've been loving these experiments, and would love to help more engineers scale the traditional GTM function.

Pricing

Clay credits aren't free, so we can't let just anyone use our proxy. We've allowlisted a couple of friends who we know are good for it, and can bill them later. If you wanted to get started, shoot me an email at charmaine@val.town and I'll personally help you get set up.

We also have a self-hosted alternative, if you'd like to create an API for your own Clay account.