Back to course
Clay 101

Learn how to build go-to-market plays on the new Clay

Progress

Welcome to the New Clay
✔
1
Welcome to the New Clay
Find Companies and People with Search
✔
2
Find Companies and People with Search
Organize Your Data with Audiences
✔
3
Organize Your Data with Audiences
Enrich and Transform with Workflows
✔
4
Enrich and Transform with Workflows
Act: Sequencer, Ads, CRM Send
✔
5
Act: Sequencer, Ads, CRM Send
Find Local Businesses and Lookalikes
✔
6
Find Local Businesses and Lookalikes
Add Signals to a Segment
✔
7
Add Signals to a Segment
AI Knowledge Hub
✔
8
AI Knowledge Hub
Reuse Logic with Functions
✔
9
Reuse Logic with Functions
Use Clay Through MCP
✔
10
Use Clay Through MCP
Build a Claygent
✔
11
Build a Claygent

Learn and master Clay with Clay university

Featured in Clay University

All courses
/
Clay 101
/
Reuse Logic with Functions
Lesson
9
/
11
About this lesson
00:00

Reuse Logic with Functions

A Function is a reusable piece of logic you can use anywhere in your workspace. Next, you'll learn when to save your work as a Function and how to add one of Clay's own managed Functions to your workspace.

♻️ Why Functions Matter

If you have any programming background, you already know why functions matter.

Say you work in a niche industry that needs a specific kind of enrichment logic or persona identification, and you've built a workflow that walks through every step and every fallback. Save it as a Function and you can reuse it again and again without rebuilding it from scratch.

Functions also make AI better at building. When you build through the API or CLI, you can tell the AI to use the right Functions for the right tasks, which raises the odds of a better first draft.

The building pattern looks like this:

  1. Build from scratch, with a sharp eye on accuracy and on the logic of what you're building.
  2. Fine-tune, troubleshoot, and refine until it's right.
  3. Save it as a Function so every future build is faster and better.

🧰 Adding a Clay-Managed Function

You don't have to start from an empty library. Clay now offers Functions it has been using internally, which you can add to your workspace.

  1. Open Functions and click Browse Clay managed functions. You'll see options like Estimate Company IT Spend, Find Recent Company Developments, Get Company Hierarchy, Get Funding and Expansion Events, Validate Company Domain, and Generate ICP Fit.
  2. Pick one. Estimate Company IT Spend is a good example, because IT spend isn't an easy data point to get. It pulls estimates from a few data enrichment providers, then estimates the figure with AI using OpenAI at the end.
  3. Set it up as managed. Under Required API keys, add your own keys if you want to.
  4. Choose where it's available. Under Routines, Users exposes it through the Clay public API, the CLI, and MCP clients like ChatGPT. Exposing it everywhere is usually the right call. Claygent lets Claygents use it as a tool, which is worth turning on too.
  5. Choose who can use it. Roles go from Admin to Sales rep. Leave Sales rep off if you don't want reps using it, including through the MCP.
  6. Set Access permissions and finish.

You can also modify a managed Function, or duplicate it as a custom Function and make it your own.

Getting really good at using Functions effectively is one of the best investments you can make in Clay.

🚀 What's Next

You now know when to save your logic as a Function and how to add, configure, and customize a Clay-managed one.

Next, we'll look at the Clay MCP, which is how you share Functions and enrichments with the rest of your team.

Next up
Clay 101

Use Clay Through MCP

View next lesson