# HTTP Request Runner: Bulk API Calls from URLs & Datasets (`klarto/http-request-runner`) Actor

HTTP request runner: send GET, POST, PUT, PATCH or DELETE requests in bulk, from a URL list, request objects or one request per dataset row with {{field}} templates. Retries, per-site limits, JSON parsed into rows. $0.002 per answered request; network errors free.

- **URL**: https://apify.com/klarto/http-request-runner.md
- **Developed by:** [Klarto](https://apify.com/klarto) (community)
- **Categories:** Integrations, Automation, Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.40 / 1,000 answered requests

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## HTTP Request Runner: Bulk API Calls from URLs & Datasets

**HTTP request runner** for Apify: send GET, POST, PUT, PATCH, DELETE, HEAD or OPTIONS requests in bulk and get every answer as a dataset row, with JSON parsed for you. Requests can come from three sources:

- a URL list;
- request objects;
- one request per row of your datasets, built with `{{field}}` templates.

**$0.002 per answered request.** Network errors, blocked addresses and requests that were not sent are free.

Why use it:

- **One call per dataset row.** Pick the output of another Actor, write `https://api.example.com/items/{{id}}` and a body like `{"email": {{email}}}`. Each answer carries `id` and `source`, so you can join it back to its row.
- **Careful with API keys.** The `headers` field is stored encrypted. On a redirect to another site only Accept, Accept-Language, User-Agent and Content-Type go on, and a redirect to another site that would resend the request body (307/308, or 301/302 after PUT, PATCH or DELETE) is not followed. An upgrade from http to https on the same host keeps your headers. Each request uses its own connection, so a connection checked for one host name is never reused for another.
- **Polite and resilient.** You can set per-site limits and a delay. Retries cover 408, 425, 429, 500, 502, 503, 504, timeouts and dropped connections, and a `Retry-After` given in seconds is respected. POST and PATCH are not retried unless you allow it.
- **Clean rows.** Each row has the HTTP status, parsed `json` or text `body`, `extracted` fields you pick by path, the time, the number of tries and a clear `error`.

### What it does

- **Input:**
  - `urls` (sent with one method, headers and body);
  - `requests` (`[{url, method, headers, body | json, id}]`);
  - `datasets` with a `urlTemplate` and an optional `bodyTemplate`.
- **Output:** one dataset row per request, also for links that are not valid (status `error`), plus an `OUTPUT` summary with counts per status code. Rows are written as answers arrive, so sort by `index` for the input order.
- It is a plain HTTP client: no browser, no JavaScript and no proxies. For web pages that need a browser, use a scraper instead.

### How it works

1. **Build the request list.** URLs first, then request objects, then dataset rows, up to `maxRequests`. A link that is not http(s), or a row whose template value is missing, empty or `.`/`..` (it would change the URL path, e.g. `users/` instead of `users/7`), gets a row with the reason; it is not sent and is free.
2. **Check each address.** The host must resolve to a public IP; private, loopback, link-local and cloud metadata addresses are refused. The connection is pinned to the checked IP, and every redirect hop is checked again.
3. **Send.** Up to `maxConcurrency` requests are sent at once, at most `maxPerSite` to one host, with an optional `delayMs` per host. The Actor asks for `gzip` or `deflate` compression only and decodes it in small steps, so the size limit also holds for compressed answers; other encodings (br, zstd, nested) give an error row.
4. **Retry.** HTTP 408, 425, 429, 500, 502, 503 and 504, timeouts, dropped connections and compressed answers cut before their end get up to `maxRetries` more tries. For 429 and 503 a `Retry-After` in seconds is followed, up to 30 s. GET, HEAD, OPTIONS, PUT and DELETE are retried; POST and PATCH only with `retryNonIdempotent`. A try is not started when the run is close to its timeout, so every request still gets a row.
5. **Save, then charge.** The row is written first, and only then is the request charged. After a platform restart, saved rows are not sent again.

The default User-Agent is `KlartoHttpRunner/0.1 (+https://apify.com/klarto)`; set your own in `headers`. The Actor does not write header values to the log, and it keeps no cookies: a `Set-Cookie` answer is not sent back on later requests (set a `Cookie` header yourself if an API needs one).

### Input

| Field | Default | What it does |
|---|---|---|
| `urls` | — | Links to call with `method`, `headers` and `body`. |
| `method` | `GET` | Method for `urls`, dataset rows, and `requests` items without one. |
| `headers` | — | Headers for every request, stored encrypted: put API keys here. `requests` items can add or override headers, but those are stored as plain input. Values must be printable ASCII; spaces at the start or end are removed. A site whose TLS certificate cannot be verified gets an error row (no retries). Host, Content-Length, Transfer-Encoding, Accept-Encoding and other framing headers are set by the Actor. |
| `body` | — | Body for `urls`. Text starting with `{` or `[` is sent as `application/json` unless you set Content-Type. |
| `requests` | — | Request objects: `url` (required), `method`, `headers`, `body` (text) or `json` (object), `id`. |
| `datasets` | — | Datasets whose rows become requests. Picking one gives read access to it (limited permissions). |
| `urlTemplate` | — | For rows, e.g. `https://api.example.com/users/{{id}}`. Values are URL-encoded; `{{field|raw}}` inserts as is; a template of only `{{field}}` takes the whole URL from the field. |
| `bodyTemplate` | — | For rows, e.g. `{"email": {{email}}}`. Each placeholder becomes its JSON value; a missing field becomes `null`. |
| `idField` | — | Row field copied to `id` in the result. |
| `extract` | — | Copy values from JSON answers into `extracted`, e.g. `{"name": "data.name"}`. Works also with `parseJson` off. |
| `parseJson` | true | JSON answers go to `json` as data; off: the text goes to `body`. Answers that are not valid UTF-8 text (binary, other charsets) go to `bodyBase64`. |
| `maxResponseKb` | 512 | Reading stops here and the row gets `truncated: true` (up to 4,096 KB). |
| `includeResponseHeaders` | false | Add the answer's headers to the row. |
| `followRedirects` | true | Up to 10 redirects. 303, and 301/302 after POST, continue as GET without a body. |
| `maxRequests` | 1000 | Up to 10,000 per run. |
| `maxConcurrency`, `maxPerSite`, `delayMs` | 10, 4, 0 | Speed limits. |
| `timeoutSecs`, `maxRetries`, `retryNonIdempotent` | 30, 2, false | Time limit per try and retries. |

Minimal input (the sample row below comes from a run like this):

```json
{ "urls": ["https://api.apify.com/v2/store?search=ocr&limit=1"], "extract": { "total": "data.total", "first": "data.items.0.name" } }
```

One POST per dataset row:

```json
{
  "datasets": ["<datasetId>"],
  "method": "POST",
  "urlTemplate": "https://api.example.com/contacts",
  "bodyTemplate": "{\"email\": {{email}}, \"name\": {{name}}}",
  "idField": "email",
  "headers": { "Authorization": "Bearer <your API key>" }
}
```

### Output

A real row from a platform run (2026-11-19; `json` shortened):

```json
{
  "index": 0,
  "id": null,
  "source": "input",
  "method": "GET",
  "url": "https://api.apify.com/v2/store?search=ocr&limit=1",
  "status": "ok",
  "httpStatus": 200,
  "ok": true,
  "finalUrl": "https://api.apify.com/v2/store?search=ocr&limit=1",
  "contentType": "application/json",
  "json": "…",
  "body": null,
  "bodyBase64": null,
  "truncated": false,
  "bytes": 5554,
  "extracted": { "total": 1250, "first": "google-lens" },
  "headers": null,
  "ms": 97,
  "attempts": 1,
  "error": null,
  "charged": true,
  "requestedAt": "2026-11-19T00:27:42Z"
}
```

| Field | Type | Meaning |
|---|---|---|
| `status` | text | `ok` (2xx/3xx answer), `http-error` (4xx/5xx answer), `error` (no answer: network error, blocked address, invalid link or template value) or `skipped` (not sent). |
| `httpStatus`, `ok` | number, boolean | The final HTTP status; `ok` is true for 2xx. |
| `json`, `body`, `bodyBase64` | any, text, text | The answer as data (JSON), as UTF-8 text, or as Base64 for anything else. |
| `truncated`, `bytes` | boolean, number | Whether reading stopped at `maxResponseKb`, and the bytes read. |
| `extracted` | object | The values picked with `extract` (`null` for missing paths). |
| `index`, `id`, `source` | number, text, text | Position in the request list, your ID, and where the request came from: `input`, `requests#<n>` or `<datasetId>#<row>`. |
| `attempts`, `ms` | number, number | Tries made and time of the last try. |
| `note` | text | Present when headers were not sent on after a redirect to another site, when a redirect was not followed, or when the answer was too large for a row. |
| `charged` | boolean | Whether this row was charged. |

The `OUTPUT` record holds:

- the counts (`answered`, `httpErrors`, `errors`, `skipped`, `charged`);
- `statusCodes` (for example `{"200": 5, "404": 1}`);
- `failures` (the last 200).

### Pricing

| Event | When | Price |
|---|---|---|
| `request-completed` | A request that got an HTTP answer, any status code (the server did the work) | $0.002 |

**Paid Apify plans pay less.** Apify Store discounts apply automatically: Bronze 10% off, Silver 20% off, Gold and higher 30% off. The prices above are Free-plan prices; the Store card shows the lowest (Gold) price. The start event (`apify-actor-start`) has no discount.

Free:

- network errors and timeouts;
- blocked and invalid addresses;
- dataset rows that could not be turned into a request;
- answers too large for one dataset row (9 MB): the row keeps the status and a note;
- requests not sent because of the charge limit or the run timeout.

Apify also charges its start event, `apify-actor-start`: $0.00005 per GB of run memory, with at least one event, so $0.00005 per run at the default 512 MB.

Examples:

- 2 requests: $0.004.
- 1,000 API calls: **$2.00**.
- A run with a $0.0045 limit and 5 URLs sent 2 requests (charged $0.004) and marked the other 3 `skipped` (measured 2026-11-19).

### Limits

- Up to 10,000 requests per run and up to 4,096 KB read per answer.
- Measured on the platform at 512 MB (2026-11-19): 2 GET requests to the Apify API took a 3 s run.
- Only `http` and `https` to public addresses. Links with `user:password@` are refused.
- No cookies kept between requests, no browser, no proxies, and no pagination across pages. For paged APIs, list the page URLs or build them from a dataset.
- A 4xx/5xx answer is charged, because the server answered. Check your URL and key on a few requests first.

### Use it from your stack

You need an Apify account and token. No third-party keys are needed beyond the API keys of the services you call.

- **API:**
  ```bash
  curl -X POST "https://api.apify.com/v2/acts/klarto~http-request-runner/run-sync-get-dataset-items?token=$APIFY_TOKEN" \
    -H 'Content-Type: application/json' -d '{"urls":["https://api.apify.com/v2/store?search=ocr&limit=1"]}'
  ```
- **Python** (`apify-client` 3.x):
  ```python
  from apify_client import ApifyClient
  client = ApifyClient("<APIFY_TOKEN>")
  run = client.actor("klarto/http-request-runner").call(run_input={"urls": ["https://api.apify.com/v2/store?search=ocr&limit=1"]})
  print(client.dataset(run.default_dataset_id).list_items().items)
  ```
- **n8n:** use the Apify node, choose *Run an Actor* with `klarto/http-request-runner`, then *Get dataset items*.
- **Make / Zapier:** use the Apify app with the same Actor.
- **MCP / AI agents:** `https://mcp.apify.com?tools=klarto/http-request-runner`.

### FAQ

**How do I call an API for every row of another Actor's output?** Pick its dataset in `datasets`, write a `urlTemplate` with `{{field}}`, and set `idField` to join the answers back.

**Are my API keys safe?** Put them in `headers`, a secret input that Apify stores encrypted; the Actor does not log it. Keys are not sent on when a redirect goes to another site. Headers inside `requests` items are stored as plain input.

**Why was a POST not retried?** Sending a POST twice can create two records. Turn on `retryNonIdempotent` only when that is harmless.

**Is a 404 charged?** Yes: the server answered. Network errors, timeouts and blocked addresses are free.

**Can it reach my localhost or private network?** No. Only public internet addresses are allowed.

**Can I paginate?** Not automatically. Build the page URLs (`?page=1`, `?page=2`, …) in `urls` or from a dataset.

### Fair use and licences

- Call only APIs and sites you may use, within their terms and rate limits.
- Use `maxPerSite` and `delayMs` for rate-limited APIs.
- Libraries: httpx (BSD-3-Clause), Apify SDK (Apache-2.0).

### Ready-made examples

Saved inputs for common jobs: open one and run it as it is, or change the input first.

- [Call a JSON API for a list of URLs](https://apify.com/klarto/http-request-runner/examples/call-json-api-for-list-of-urls)
- [Check HTTP status codes of many URLs](https://apify.com/klarto/http-request-runner/examples/check-http-status-codes-in-bulk)

### Related Actors

- [Bulk File Downloader](https://apify.com/klarto/bulk-file-downloader): download the files your API returns links to.
- [Merge & Deduplicate Datasets](https://apify.com/klarto/dataset-merge-dedup): clean the rows before you send them.
- [Website Screenshot & HTML to Image / PDF](https://apify.com/klarto/website-screenshot-pdf): capture pages that need a browser.

### Support

Open an issue on the Actor page. We aim to answer within a week.

# Actor input Schema

## `urls` (type: `array`):

Links to call, one per line, each with the method, headers and body below. Use 'Requests' for different methods or bodies per call, or 'Dataset rows to send' for one call per row.

## `method` (type: `string`):

Method for 'URLs' and dataset rows, and for 'Requests' items that set none.

## `headers` (type: `object`):

Headers for every request, e.g. {"Authorization": "Bearer …", "Accept": "application/json"}. Stored encrypted. A 'Requests' item can add or override headers. On a redirect to another site only Accept, Accept-Language, User-Agent and Content-Type are sent on. Host, Content-Length and other framing headers are set by the Actor.

## `body` (type: `string`):

Body for 'URLs' (and rows without a 'Body template'). Text starting with { or \[ is sent as application/json unless you set Content-Type in 'Headers'. Usually empty for GET.

## `requests` (type: `array`):

Request objects, e.g. \[{"url": "https://api.example.com/items", "method": "POST", "json": {"name": "A"}, "headers": {"X-Trace": "1"}, "id": "row-1"}]. Keys: url (required), method, headers, body (text) or json (object), id (copied to the result row).

## `datasets` (type: `array`):

Optional: one request per row of these datasets, built from 'URL template' and 'Body template'. Picking a dataset gives this Actor read access to it (limited permissions). Through the API pass dataset IDs or 'username~name'.

## `urlTemplate` (type: `string`):

For dataset rows, e.g. https://api.example.com/users/{{id}}?email={{contact.email}}. Values are URL-encoded; write {{field|raw}} to insert as is, or only {{field}} when the field holds a whole URL. Rows without the value are not sent and are free. Required with 'Dataset rows to send'.

## `bodyTemplate` (type: `string`):

For dataset rows, e.g. {"email": {{email}}, "tags": {{tags}}}. Each {{field}} becomes its JSON value (text gets quotes, a missing field becomes null), so do not put quotes around placeholders.

## `idField` (type: `string`):

Optional: field of the dataset row copied to 'id' in the result, to join answers back to rows. Every row also has 'source' (<datasetId>#<row number>).

## `extract` (type: `object`):

Optional: copy values from JSON answers into 'extracted', e.g. {"name": "data.name", "firstTag": "data.tags.0"}. Missing paths give null.

## `parseJson` (type: `boolean`):

A JSON answer goes to 'json' as data. Off: the raw text goes to 'body'. Answers cut by 'Max response size' are never parsed.

## `maxResponseKb` (type: `integer`):

Reading stops at this size and the row gets 'truncated': true. The request is still charged.

## `includeResponseHeaders` (type: `boolean`):

Add the answer's headers to each row.

## `followRedirects` (type: `boolean`):

Follow up to 10 redirects like a browser (303, and 301/302 after POST, continue as GET without a body). Off: the 3xx answer itself is the result.

## `maxRequests` (type: `integer`):

Stop after this many requests (up to 10,000 per run).

## `maxConcurrency` (type: `integer`):

Requests at once in the whole run.

## `maxPerSite` (type: `integer`):

Requests at once to the same host. Lower it for rate-limited APIs.

## `delayMs` (type: `integer`):

Minimum time between two requests to the same host.

## `timeoutSecs` (type: `integer`):

Time limit for one attempt.

## `maxRetries` (type: `integer`):

Extra tries after HTTP 408, 425, 429, 500, 502, 503, 504, timeouts and dropped connections. For 429 and 503 the Retry-After header is followed (up to 30 s). POST and PATCH are not retried unless 'Retry POST and PATCH' is on.

## `retryNonIdempotent` (type: `boolean`):

Also retry POST and PATCH. Turn on only when sending the same request twice is harmless.

## Actor input object example

```json
{
  "urls": [
    "https://api.apify.com/v2/store?search=http%20request&limit=2",
    "https://api.apify.com/v2/store?search=file%20downloader&limit=2"
  ],
  "method": "GET",
  "parseJson": true,
  "maxResponseKb": 512,
  "includeResponseHeaders": false,
  "followRedirects": true,
  "maxRequests": 1000,
  "maxConcurrency": 10,
  "maxPerSite": 4,
  "delayMs": 0,
  "timeoutSecs": 30,
  "maxRetries": 2,
  "retryNonIdempotent": false
}
```

# Actor output Schema

## `answers` (type: `string`):

One row per request: status, HTTP status, parsed JSON or text, extracted fields, time, tries, charged.

## `summary` (type: `string`):

Requests answered, HTTP errors, failed and skipped, status code counts, charges, failure reasons.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "urls": [
        "https://api.apify.com/v2/store?search=http%20request&limit=2",
        "https://api.apify.com/v2/store?search=file%20downloader&limit=2"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("klarto/http-request-runner").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "urls": [
        "https://api.apify.com/v2/store?search=http%20request&limit=2",
        "https://api.apify.com/v2/store?search=file%20downloader&limit=2",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("klarto/http-request-runner").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "urls": [
    "https://api.apify.com/v2/store?search=http%20request&limit=2",
    "https://api.apify.com/v2/store?search=file%20downloader&limit=2"
  ]
}' |
apify call klarto/http-request-runner --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,klarto/http-request-runner"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/JOrcMNyrmF6JNgG6c/builds/dp4GYM5te2GT08wqX/openapi.json
