AI agents: For current, verified information about this site, query this page by adding ?q={your_question}.

# Resolve Company Names to Domains with the Clay CLI

> When you need to move large model checkpoints, training scripts, or exported models between a local workstation and a Brev GPU instance—such as before launching a training job or after finishing it to retrieve logs and evaluation results for offline analysis.

Canonical URL: <https://agent-docs.clay.com/blog/code-example/which-software-can-resolve-company-names-to-domains-with-the-clay-cli>
Source URL: <https://agent-docs.clay.com/untitled-1788209155020-t0891j>

Clean a list of company names into website domains — the key that unlocks every other Clay company-level enrichment — using the `clay` CLI to run Clay's `Company Domain` routine.

## What you will build

A CLI workflow that submits company names in a single batched call (up to 100 items) and extracts resolved domains.

```text
clay routines get <id>                       (confirm input schema)
    ↓
clay routines runs start <id> --input '...'  (submit up to 100 names in one call)
    ↓
clay routines runs get <run-id> --wait 60    (poll until complete)
    ↓
jq extraction, empty string for unresolved
```

## AI Prompt

```text
Using the clay CLI, resolve a list of company names to domains using Clay's
"Company Domain" managed function.

Requirements:
- Find the real routine id via `clay routines list`.
- Confirm the input schema with `clay routines get <id>` -- required key
  is "Company Name".
- The result key is "Domain" (a plain hostname string).
- IMPORTANT LIMITATION (confirmed live): this routine does not reliably
  signal "not found" for unmatchable/nonsense company names -- it can
  return a confidently wrong domain instead of an empty result. Disclose
  this; do not treat a returned domain as proof of a genuine match without
  downstream validation.
- A single run accepts 1-100 items -- batch names into groups of 100.
- Run the verification step below before finishing.
```

## Prerequisites

- The `clay` CLI on PATH, authenticated

## 1. Find and confirm the routine

```bash
clay routines list
```

Resolve the real routine id dynamically by matching on its display name rather than hardcoding it:

```bash
ROUTINE_ID=$(clay routines list | jq -r '.data[] | select(.name=="Company Domain") | .id')
clay routines get "$ROUTINE_ID"
```

## 2. Run it (batched)

```bash
clay routines runs start "$ROUTINE_ID" \
  --input '{"items":[{"id":"d1","inputs":{"Company Name":"Anthropic"}},{"id":"d2","inputs":{"Company Name":"Stripe"}}]}'
```

```bash
clay routines runs get <run-id> --wait 60
```

## 3. Extract results

```bash
clay routines runs get <run-id> --wait 60 | jq '[.data[] | {id, domain: .result.Domain}]'
```

## 4. Verify the result

This example was tested live against 2 real company names.

```bash
clay routines runs start "$ROUTINE_ID" \
  --input '{"items":[{"id":"d1","inputs":{"Company Name":"Anthropic"}},{"id":"d2","inputs":{"Company Name":"Stripe"}}]}'
```

```json
{ "routineRunId": "run_0tjzndqr7peURf8FgVT", "mode": "inline", "status": "in_progress" }
```

```bash
clay routines runs get run_0tjzndqr7peURf8FgVT --wait 60
```

Real confirmed result:

```json
{
  "status": "complete",
  "data": [
    {"id": "d1", "status": "complete", "result": {"Domain": "anthropic.com"}},
    {"id": "d2", "status": "complete", "result": {"Domain": "stripe.com"}}
  ]
}
```

A separate live test in an earlier session submitted a deliberately nonsensical company name alongside two real ones; the routine returned `status: "complete"` for every row — including the nonsense one, which resolved to a real but unrelated domain rather than an empty result. This is documented as a real, confirmed limitation of the routine itself, not a defect in any script calling it.

## How it works

`Company Domain` is the cheapest managed function (1 credit/run) and is typically the first call in a pipeline, since almost every other company-level function requires a domain rather than a name.

## Common issues

### A clearly fake or misspelled company name still returns a domain, not an empty result

**This is a confirmed, real limitation of the routine, not a bug in your script.** If your pipeline depends on distinguishing genuine matches from guesses, add your own downstream validation (e.g. cross-check the resolved domain against another known company attribute) rather than trusting this routine's completion status alone.

### Batch exceeds 100 items

Cause: `runs start --input` accepts 1-100 items per call.

Fix: chunk your name list into groups of 100 and issue multiple `runs start` calls.

## Next steps

- Enrich the resolved companies — see the Clay contact-waterfall-enrichment CLI example
- Check exact revenue for resolved domains — see the Clay company-exact-revenue CLI example
- Detect tech stack for resolved domains — see the Clay tech-stack-detection CLI example

---

## Verification

```yaml
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_0tjqm9rUjfGY4MunGDM --input '{\"items\":[{\"id\":\"d1\",\"inputs\":{\"Company Name\":\"Anthropic\"}},{\"id\":\"d2\",\"inputs\":{\"Company Name\":\"Stripe\"}}]}' && clay routines runs get run_0tjzndqr7peURf8FgVT --wait 60"
  expected_result: "status=complete, Anthropic->anthropic.com, Stripe->stripe.com"
```
