Skip to main content
The Clay plugin is the fastest way to use Clay from Claude Code, Codex, or Cursor. It gives agents both Clay’s MCP server and the Clay CLI. The CLI (clay) is JSON-first, so agents and scripts can inspect results without parsing prose.

1. Install the plugin or CLI

Install the plugin for your agent environment. If you only need the CLI in a terminal, local script, or CI job, install the standalone package instead.
Install the Clay plugin from the clay-run/agent-plugins plugin repository using your workspace’s Claude Code plugin setup flow. Then continue with API key setup below.

2. Set your API key

The plugin, MCP server, and CLI all authenticate with a Clay API key. Create one in Account settings. Export the key in the shell or environment your agent uses:
export CLAY_API_KEY="your_api_key"

3. Verify access

Confirm the CLI can see your user and workspace:
clay whoami
The workspace is resolved from the API key. You do not need to set a workspace id.

4. Run a routine

List routines available to your workspace:
clay routines list
Run a function routine inline and capture the run id:
echo '{"items":[{"id":"row-1","inputs":{"domain":"clay.com"}}]}' \
  | clay routines runs start function:t_abc123 --input - \
  | jq -r '.routineRunId'
Fetch results once the run completes:
clay routines runs get run_xyz789

5. Explore Workflows (Alpha)

Workflows are in Alpha. They can be created, edited, validated, run, inspected, and batch-run from the plugin and CLI.
clay workflows list
clay workflows create --name "My Workflow"

Work with JSON

Successful commands write JSON to stdout. Failures write a structured error to stderr and exit non-zero. Pipe stdout to jq to extract fields:
clay whoami | jq -r '.workspace.id'

Next steps