# Clay

In Clay, PublicWWW plugs in through Clay's HTTP API with your token: check each company's site for a piece of code, or build a table of companies from one search. The API needs a paid plan.

## Does this company's site use it?

An enrichment column that asks, for every row, whether the company's site contains a code fragment - a tag manager or analytics script, a chat widget, a CMS plugin. Add an **HTTP API** column:

| Setting | Value |
| --- | --- |
| Method | `POST` |
| Endpoint | `https://api.publicwww.com/v1/search` |
| Headers | `Authorization: Bearer YOUR_TOKEN` `Content-Type: application/json` |
| Body | the JSON below, with the row's domain column inserted where it says `DOMAIN` |

```
{ "query": "site:DOMAIN \"googletagmanager.com/gtm.js\"", "per_page": 1 }
```

Read `total`: above `0`, the code is there and `results` shows the page it was found on; `0`, it was not found. `site:` limits the search to that site and, like any search, to its home page; to check every page PublicWWW has indexed, add `depth:all`:

```
{ "query": "site:DOMAIN depth:all \"googletagmanager.com/gtm.js\"", "per_page": 1 }
```

`0` means the code is not in the index, which does not prove it is absent from the live site. The rest of the query is the usual [query syntax](https://publicwww.com/docs/query-syntax/).

## A table of companies from one search

The other way round: start from the code and get the companies. One request returns up to your plan's rows per query:

```
{ "query": "\"static.hotjar.com\" site:de", "per_page": 1000 }
```

Each item of `results` is one site - `domain`, `url` and `rank` (1 is the most popular; empty for a site without a rank). Turn the list into rows, then enrich them with Clay's other sources as usual.

## Searches and speed

- Every request is a search from your plan's daily allowance, so a check per row spends one search per row. For thousands of rows the second way is cheaper: one search for the whole list, then match the domains in Clay.
- At most 10 requests a minute go through per account. Clay runs rows in parallel, so run a large table in batches; a request over the limit gets `429` with a `Retry-After` header.
- Errors and their codes: [Errors](https://publicwww.com/docs/api/errors/). Everything the API takes: [Making requests](https://publicwww.com/docs/api/requests/).

Source: https://publicwww.com/docs/api/clay/
