Urgent.News

What's breaking now, across hundreds of outlets.

Tech

How to call any API from Clay, one row at a time (with a real example)

Clay has a lot of data providers built in. But sooner or later, the data you need sits behind an API that is not in the list: a niche industry database, your own backend, a public endpoint you found in someone's docs. This post shows how to turn any HTTP API into a Clay column, using a small Apify Actor I built for that job, HTTP Request . We will build a real column as an example: which email…

Clay, a platform with numerous built-in data providers, occasionally encounters situations where the desired data is housed within an API that isn't part of the pre-existing list. This article explains how to transform any HTTP API into a Clay column, using a specific Apify Actor called HTTP Request. The example will demonstrate how to determine which email provider each company utilizes, such as Google Workspace, Microsoft 365, or another provider.

The process involves starting a run of the actor with a small JSON input that outlines a single HTTP call for each row in your Clay table. The actor executes the call, retries it if it receives a 429 or 5xx status code, and then returns a row containing the status code, the body response, and any error type if there was no response at all.

To get started, you need to connect Apify to Clay. After creating a free Apify account, you can copy your API token from the Settings > API & Integrations section. In your Clay table, click Add enrichment, search for Apify, and select Run Apify Actor. Paste the token to link your accounts and choose the Actor data_xplorer/http-request.

For the initial step, you'll need to describe the call. If your table contains a Domain column, Google provides a free DNS over HTTPS endpoint that returns MX records (mail servers) for any domain as JSON. The URL is https://dns.google/resolve?name=apify.com&type=MX. In the Input Data box, input the call and insert the Domain column where the domain should be placed (type / in Clay to select a column).

The JSON input should look like this: {"url" : "https://dns.google/resolve", "params" : {"name" : "/Domain", "type" : "MX"}}. Run the column on two or three rows first to validate the process.

Next, transform the response into a clean column. Add a Clay formula column on top of the results, and use a condition such as: "contains google.com or googlemail.com : Google Workspace", "contains outlook.com : Microsoft 365", "empty: no email on this domain", and "anything else: other". This new enrichment column is created based on an API that Clay did not originally support.

When dealing with APIs that require an API key in a header, the pattern remains the same. Simply modify the JSON input to include the key, for example: {"url" : "https://api.example.com/v1/companies", "params" : {"domain" : "/Domain"}, "headers" : {"X-API-Key" : "YOUR_API_KEY"}}. The API key will be included untouched in the API call, but it will be masked ([REDACTED]) in the stored results, so you can share runs without revealing the key.

Paste the curl command from the API documentation as a shortcut. This will allow you to input the address, method, headers, and body directly from the provided command. All these methods work for POST requests with a JSON body, and for requests you can copy using the 'Copy as cURL' option in your browser's developer tools.

Using an actor has several benefits over directly calling the API. It handles rate limits by retrying with increasing pauses on 429 or 503 responses, providing clear failure indications, and even offers the ability to route calls through a chosen country using Apify Proxy. This actor can be utilized with various tools like n8n, Make, Zapier, Python, or AI agents. As your data grows, you can export it, run it in batches, and only pay for actual responses.

When testing, start with the JSON input from the Actor's Input tab in Apify (switch to JSON view), modify it with fixed values in Clay, then replace those values with your columns. Any Clay errors related to JSON parsing are usually due to improper quoting of the inserted values. Set a run condition on the column (only when Domain is not empty) to avoid starting a run for empty rows.

For further exploration, you can find the Python script, a Clay guide, and an n8n template in the following repository: dataxplore19/http-request-api-python. The Actor page also provides a full list of options, such as redirects, response size, webhooks, and proxy settings: HTTP Request on Apify.

Rewritten by urgent.news; may contain errors — check the original.

Source: dev.to

Read the original at dev.to →

More from Dev.to on urgent.news

Get the news by email. Yesterday's most-covered stories, every morning.

See today's edition · More options

More in Tech

The Rise of Cozy Driving

Games like Over the Hill and Slow Roads change the context of driving games from racing to something more chill

  • "Cozy driving" concept gaining traction in gaming world
  • Over the Hill and Slow Roads exemplify cozy driving games
  • Cozy driving games offer narrative frameworks and zen-like experiences

More from Friday, 4 December 2026 →