# HTTP API Scraper - Any JSON API to Dataset with Pagination (`goldstandardweb/http-api-to-dataset`) Actor

Call any JSON API with your own keys, follow page, offset, cursor or next-link pagination, and save every record as a row. JSONPath picks the records; keys stay secret.

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

## Pricing

Pay per event

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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 API Scraper - Any JSON API to Dataset with Pagination

**Point it at any JSON API, tell it how the API pages its results (page number, offset, cursor, next-page link or Link header), and get every record as its own row in an Apify dataset, ready for Excel, Google Sheets, CSV or your code. Your API keys go in encrypted fields and never show up in the log or the results. One flat price per record: 1,000 rows cost $1.25.**

- **Proof:** the sample table below comes from a real run on Nov 16, 2026 (UTC). It used the U.S. Treasury's public Fiscal Data API. It got 50 records over 2 pages, in about 6 seconds of run time on the Apify platform.
- **Guarantee:** you pay only for records that land in your dataset. Requests that fail, pages that come back empty, and records your earlier runs already returned (with **Only new records**) are **free**. Hard caps on pages, results, response size and total download mean a broken API can never run away with your budget.
- **Next step:** click **Try for free**. The example input reads 2 pages of U.S. Treasury interest rates in under a minute.

### Who it's for

- **Analysts and operations teams** who have an API key for a SaaS tool, a data provider or a public API. They want the data in a sheet without writing a script for the paging.
- **No-code builders (Make, Zapier, n8n, Clay)** whose HTTP module returns one page at a time. This Actor follows all the pages and hands back one clean row per record.
- **Developers and data engineers** who need an API-to-dataset job that is scheduled, logged and retried. It has a known cost and replaces another cron script.
- **Teams using tools that connect to Apify's MCP server** who want a whole paged API listing from one tool call, returned as flat JSON.

### What you get

One row per record, with the API's own fields as sent, plus four source columns. Other HTTP request Actors give you one row per request, holding the whole response. This one splits every page into its records.

Some text would run as a formula in a sheet, such as `=HYPERLINK(...)`. It gets a leading `'` so it opens safely in Excel and Google Sheets. Turn off **Protect spreadsheet formulas** to keep values exactly as sent.

| record_date | security_desc | avg_interest_rate_amt | \_page | \_position | \_sourceUrl |
|---|---|---|---|---|---|
| 2026-10-31 | Treasury Bills | 4.014 | 1 | 1 | ...avg_interest_rates?sort=-record_date\&page\[number]=1\&page\[size]=25 |
| 2026-10-31 | Domestic Series | 7.577 | 1 | 8 | ...avg_interest_rates?sort=-record_date\&page\[number]=1\&page\[size]=25 |
| 2026-09-30 | State and Local Government Series | 3.459 | 2 | 1 | ...avg_interest_rates?sort=-record_date\&page\[number]=2\&page\[size]=25 |

(Real rows from the example run; the Treasury API sends 11 fields per record, all of them kept. 5 rows were checked field by field against the API: 0 differences.)

Full example item:

```json
{
  "record_date": "2026-10-31",
  "security_type_desc": "Marketable",
  "security_desc": "Treasury Bills",
  "avg_interest_rate_amt": "4.014",
  "src_line_nbr": "1",
  "record_fiscal_year": "2027",
  "record_fiscal_quarter": "1",
  "record_calendar_year": "2026",
  "record_calendar_quarter": "4",
  "record_calendar_month": "10",
  "record_calendar_day": "31",
  "_sourceUrl": "https://api.fiscaldata.treasury.gov/services/api/fiscal_service/v2/accounting/od/avg_interest_rates?sort=-record_date&page%5Bnumber%5D=1&page%5Bsize%5D=25",
  "_page": 1,
  "_position": 1,
  "_fetchedAt": "2026-11-16T15:46:41.709Z"
}
```

Turn on **Flatten nested fields** and nested data becomes sheet columns (`owner.login`, `tags.0`). Or list **Fields to keep** to take only the columns you need. Each run also saves a `SUMMARY` record in its key-value store. It has the pages requested, errors, and why paging stopped for each address.

### How to use it

1. **Paste your API address** under **API URLs**, with its query parameters. Put keys in **Secret headers** (`X-API-Key: ...`), **Bearer token**, or **Secret query parameters** (`api_key=...`), never in the address.
2. **Say where the records are and how the API pages.** Set **Records path** (for example `data`, `data.items` or `$.results[*]`), or leave it empty and the log tells you which list it found. Pick the **Pagination** type and fill in the parameter it uses (for example `page`, `offset` with `limit`, or a **Next cursor path** like `meta.next_cursor`).
3. **Click Start**, then download the rows as CSV, Excel or JSON, or schedule the run with **Only new records** turned on.

Common setups:

| API style | Pagination | Settings |
|---|---|---|
| `?page=1&per_page=100` | Page number | Page parameter `page`, Page size parameter `per_page`, Page size `100` |
| `?offset=0&limit=50` | Offset | Offset parameter `offset`, Page size parameter `limit`, Page size `50` |
| `{"next_cursor": "..."}` in the response | Cursor | Cursor parameter `cursor`, Next cursor path `next_cursor` |
| `{"links": {"next": "https://..."}}` | Next-page URL | Next page URL path `links.next` |
| `Link: <...>; rel="next"` header (GitHub, many REST APIs) | Link header | nothing else needed |
| GraphQL `pageInfo { endCursor }` | Cursor, values in the JSON body | See below |

For GraphQL, use these settings:

- Method: POST
- JSON body: your query
- Put paging values in: JSON body
- Cursor parameter: `variables.after`
- Next cursor path: `data.items.pageInfo.endCursor`

### Pricing

Pay per result: **$1.25 per 1,000 records** ($0.00125 per dataset row), plus Apify's standard small Actor start fee per run. The example run (50 records) costs about $0.06.

Free: failed requests, empty pages, records left out because they are larger than 5 MB, and records skipped by **Only new records**. Set a maximum cost per run in Apify and the Actor stops cleanly when it is reached; **Max results** is a second, exact limit.

### Scheduling and integrations

- **Schedules:** run hourly or daily in Apify Schedules. With **Only new records** and a **Record ID path** (for example `id`), each run returns only records the earlier runs did not, so a schedule becomes a feed.
- **API:** start runs and read the dataset with the Apify API or the JavaScript / Python clients.
- **Make, Zapier, n8n:** use the Apify integration to start the Actor and pass the rows on.
- **Google Sheets:** export the dataset to Sheets, or use the Apify Google Sheets integration.
- **MCP:** any tool that connects to Apify's MCP server can call this Actor to fetch a whole paged API in one step.

### Tested to the Gold Standard

Gold Standard Web built this Actor and tests it with [Gold Standard QA](https://goldstandardweb.com/qa), our three-layer quality process.

- Every change must pass the full test suite before it is saved.
- We plant bugs in the code on purpose, and the tests must catch at least 90% of them.
- A reviewer who did not write the code tries to break it before each release.

[See every check we run](https://goldstandardweb.com/qa).

### FAQ

**Is this legal to use?**
It calls only the API addresses you give it, with your own keys, at the speed you set. You are responsible for following each API's terms of use. By default it also reads each site's robots.txt and refuses paths it disallows for automated access (see **Respect robots.txt**). The example input uses the U.S. Treasury Fiscal Data API, which is public, free and needs no key.

**Are my API keys safe?**
Keys in **Secret headers**, **Bearer token** and **Secret query parameters** are stored encrypted by Apify. The Actor never writes them to the log, the dataset, the run summary or its saved progress. If an API echoes a key back (in an error message or a next-page link), it is replaced with `[hidden]`. For `Authorization: Basic ...`, the credential and its password are also hidden on their own. Values shorter than 4 characters are not searched for. Your headers are sent only to the site of each API address. If the API redirects to another site, the headers are dropped. Next-page links that point to another site are not followed.

**What if the API needs a login?**
If the API takes a key or token (most do), use the secret fields. Interactive logins, CAPTCHAs and browser sessions are not supported.

**Which pagination type do I pick?**
Look at one response in your browser or the API docs: a page number or offset in the address means Page number or Offset; a token in the response means Cursor; a full "next" address in the response means Next-page URL; a `Link` header means Link header. Not sure? Start with **Max pages per URL** = 2 and check the log, which says why paging stopped.

**Why did paging stop early?**
The log and the `SUMMARY` record give the reason. It can be:

- an empty page
- a page shorter than **Page size**
- the total from **Total count path**
- no next cursor
- the same records twice. This is often a wrong page parameter name. The repeated page is not delivered or charged.
- one of your limits

**Can it call private or internal addresses?**
No. Private networks, localhost, cloud metadata addresses and internal host names are refused, also when a redirect or a DNS answer points there.

**Can I send POST requests?**
Yes: choose POST and add a JSON body, for example a search query or a GraphQL query. The page number or cursor can go into the body (**Put paging values in**).

### Limitations

- JSON APIs only (not XML, CSV or HTML pages). One response at most 50 MB; larger pages are reported, not half-read. With responses over 10 MB, give the run 1 GB of memory or more.
- GET and POST only. No interactive logins, CAPTCHAs, or proxies to get around blocks; the User-Agent identifies this Actor and cannot be changed.
- Addresses are paged one page at a time each (up to 4 addresses at once, one request at a time per host, with **Delay between requests** between them).
- Next-page links are followed only on the same site as the address you gave.
- Some API hosts disallow all automated access in robots.txt even though their API terms allow it with a key. Then the Actor stops with a clear message; turn off **Respect robots.txt** only if the provider allows your use.

### Input reference

| Field | What it does |
|---|---|
| API URLs | The JSON API addresses (up to 1,000 per run), each paged on its own |
| Method / JSON body | GET, or POST with a JSON body (GraphQL, search endpoints) |
| Records path | Where the record list is (JSONPath or dotted path); empty = found automatically |
| Pagination | None, Page number, Offset, Cursor, Next-page URL, Link header |
| Page / Offset / Cursor parameter, First page number, First offset, First cursor | The parameter names and starting values the API uses |
| Page size parameter / Page size | Records per page; a shorter page counts as the last one unless the total says otherwise |
| Next cursor path / Next page URL path / Total count path | Where the response gives the next cursor, the next address, or the total |
| Put paging values in | Query string, or the JSON body (as body paths like `variables.after`) |
| Max results / Max pages per URL | Hard limits per run (capped at 1,000,000 results and 10,000 pages per URL) |
| Secret headers / Bearer token / Secret query parameters | Your keys, stored encrypted and never shown |
| Headers | Other, non-secret headers |
| Fields to keep / Flatten nested fields / Add source columns / Protect spreadsheet formulas | Shape of each row |
| Only new records / Record ID path / History name | Return only records not returned before |
| Delay between requests / Request timeout / Max response size / Max download per run | Politeness and safety limits |
| Respect robots.txt | Check robots.txt and its Crawl-delay first (on by default) |

Requests that fail with a temporary error (429, 5xx, timeouts, dropped connections) are tried up to 4 times in all. They honor `Retry-After` up to 60 seconds.

# Actor input Schema

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

One or more JSON API addresses (endpoints), one per line, including any query parameters, for example https://api.example.com/v1/items?status=open. Each address is paged on its own. Public addresses only: private networks and internal hosts are refused.

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

GET for most APIs. POST sends the JSON body below (search endpoints, GraphQL).

## `body` (type: `object`):

Sent with POST only, for example {"query": "{ countries { code name } }"} for a GraphQL API. Stored as plain text: never put keys here, use "Secret headers" instead.

## `recordsPath` (type: `string`):

Where the list of records sits in the response, as a JSONPath or dotted path: data, data.items, $.results\[\*], message\['items']. Each record becomes one dataset row. Leave empty to find the largest list automatically (the log tells you which one it picked).

## `pagination` (type: `string`):

How the API splits results into pages. Page number: ?page=1, 2, 3. Offset: ?offset=0, 100, 200. Cursor: the response gives a token for the next page. Next-page URL: the response gives the next address. Link header: the next address is in the HTTP Link header (GitHub style).

## `pageParam` (type: `string`):

Name of the page-number parameter (Page number pagination), for example page or page\[number].

## `firstPage` (type: `integer`):

The number of the first page. Most APIs start at 1, some at 0.

## `offsetParam` (type: `string`):

Name of the offset parameter (Offset pagination), for example offset, skip or start.

## `firstOffset` (type: `integer`):

The offset of the first page, usually 0.

## `pageSizeParam` (type: `string`):

Optional. Name of the parameter that sets records per page, for example limit, per_page or page\[size]. Leave empty to use the API's default page size.

## `pageSize` (type: `integer`):

Records per page, sent with "Page size parameter". A shorter page counts as the last one, unless "Total count path" says more records are coming. 0 = not sent.

## `cursorParam` (type: `string`):

Name of the parameter that takes the next cursor (Cursor pagination), for example cursor, after or page_token.

## `firstCursor` (type: `string`):

Optional, for Cursor pagination: a value to send on the first request. Some APIs need one to start cursor paging, for example \* for Crossref. Leave empty for most APIs.

## `cursorPath` (type: `string`):

Where the response gives the next cursor (Cursor pagination), for example meta.next_cursor or pageInfo.endCursor. Paging stops when it is empty.

## `nextUrlPath` (type: `string`):

Where the response gives the next page address (Next-page URL pagination), for example next, links.next or paging.next. Only addresses on the same site are followed, so your headers never go elsewhere.

## `totalPath` (type: `string`):

Optional, for Page number and Offset pagination: where the response gives the total number of records, for example meta.total. Paging stops once that many records were read.

## `paginationIn` (type: `string`):

Where the page number, offset, cursor and page size go. JSON body needs POST; write the parameter names as body paths, for example variables.after.

## `maxResults` (type: `integer`):

Stops after this many dataset rows (one row per record). Each row is one charged result. Capped at 1,000,000.

## `maxPagesPerUrl` (type: `integer`):

Stops paging an address after this many requests. Capped at 10,000 (and 20,000 pages per run in total).

## `secretHeaders` (type: `string`):

Your own keys or tokens as HTTP headers, one per line, like X-API-Key: YOUR_KEY or Authorization: Basic .... Stored encrypted, never written to the log or the results, and sent only to the site of each API URL (never to a redirect on another site).

## `bearerToken` (type: `string`):

Shortcut for Authorization: Bearer YOUR_TOKEN. Stored encrypted and never shown in the log or the results.

## `secretQueryParams` (type: `string`):

Keys that go in the address, one per line, like api_key=YOUR_KEY. Stored encrypted, added to every request, and left out of the log and the \_sourceUrl field.

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

Other HTTP headers that are not secret, for example {"Accept-Language": "en-US"}. Stored as plain text: put keys in "Secret headers".

## `fields` (type: `array`):

Optional. Keep only these fields of each record, as paths: id, name, stats.users, tags\[0]. Empty = keep the whole record.

## `flatten` (type: `boolean`):

Turn nested objects and lists into flat columns (owner.name, tags.0), which reads well in Excel and Google Sheets.

## `includeMetadata` (type: `boolean`):

Add \_sourceUrl, \_page, \_position and \_fetchedAt to each row. A record's own field with the same name is kept as is.

## `protectFormulas` (type: `boolean`):

Put a ' in front of text that starts with = + - or @ (numbers such as -4.5 are left alone), so Excel and Google Sheets show it as text instead of running it as a formula. Turn off to keep every value exactly as the API sent it.

## `onlyNew` (type: `boolean`):

Return only records not returned by an earlier run with the same settings (or the same "History name"). Useful on a schedule. Records seen before are not charged.

## `idPath` (type: `string`):

For "Only new records": the field that identifies a record, for example id or data.uuid. Empty = compare whole records (any change counts as new).

## `historyName` (type: `string`):

Optional name for the "Only new records" history (letters, digits and dashes). Runs with the same name share one history; empty = one history per set of URLs and paths.

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

Wait between two requests to the same host. Raise it if the API answers 429 (too many requests). A longer Crawl-delay in the site's robots.txt wins.

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

How long one request may take before it is retried.

## `maxResponseMB` (type: `integer`):

Largest single response read (after unzipping). Bigger pages are reported, not half-read. Capped at 50.

## `maxTotalMB` (type: `integer`):

Stops the run after downloading this much in total. Capped at 5,000.

## `respectRobotsTxt` (type: `boolean`):

Check each site's robots.txt and its Crawl-delay before calling it. Some API hosts block all automated access there even though their API terms allow it with a key; turn this off only when the provider allows your use.

## Actor input object example

```json
{
  "urls": [
    "https://api.fiscaldata.treasury.gov/services/api/fiscal_service/v2/accounting/od/avg_interest_rates?sort=-record_date"
  ],
  "method": "GET",
  "body": {},
  "recordsPath": "data",
  "pagination": "page",
  "pageParam": "page[number]",
  "firstPage": 1,
  "offsetParam": "offset",
  "firstOffset": 0,
  "pageSizeParam": "page[size]",
  "pageSize": 25,
  "cursorParam": "cursor",
  "firstCursor": "",
  "cursorPath": "",
  "nextUrlPath": "",
  "totalPath": "",
  "paginationIn": "query",
  "maxResults": 50,
  "maxPagesPerUrl": 2,
  "headers": {},
  "fields": [],
  "flatten": false,
  "includeMetadata": true,
  "protectFormulas": true,
  "onlyNew": false,
  "idPath": "",
  "historyName": "",
  "delayMs": 500,
  "timeoutSecs": 30,
  "maxResponseMB": 10,
  "maxTotalMB": 500,
  "respectRobotsTxt": true
}
```

# Actor output Schema

## `results` (type: `string`):

No description

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

No description

# 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.fiscaldata.treasury.gov/services/api/fiscal_service/v2/accounting/od/avg_interest_rates?sort=-record_date"
    ],
    "recordsPath": "data",
    "pagination": "page",
    "pageParam": "page[number]",
    "pageSizeParam": "page[size]",
    "pageSize": 25,
    "maxResults": 50,
    "maxPagesPerUrl": 2
};

// Run the Actor and wait for it to finish
const run = await client.actor("goldstandardweb/http-api-to-dataset").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.fiscaldata.treasury.gov/services/api/fiscal_service/v2/accounting/od/avg_interest_rates?sort=-record_date"],
    "recordsPath": "data",
    "pagination": "page",
    "pageParam": "page[number]",
    "pageSizeParam": "page[size]",
    "pageSize": 25,
    "maxResults": 50,
    "maxPagesPerUrl": 2,
}

# Run the Actor and wait for it to finish
run = client.actor("goldstandardweb/http-api-to-dataset").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.fiscaldata.treasury.gov/services/api/fiscal_service/v2/accounting/od/avg_interest_rates?sort=-record_date"
  ],
  "recordsPath": "data",
  "pagination": "page",
  "pageParam": "page[number]",
  "pageSizeParam": "page[size]",
  "pageSize": 25,
  "maxResults": 50,
  "maxPagesPerUrl": 2
}' |
apify call goldstandardweb/http-api-to-dataset --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,goldstandardweb/http-api-to-dataset"
        }
    }
}
```

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/3Cp4TpTd5wP3PsiG5/builds/Q5LEskEgIf5Y9I4o2/openapi.json
