# Bls Economic Data Scraper (`b2b_lead_generation/bls-economic-data-scraper`) Actor

Scrape US economic data from the Bureau of Labor Statistics public API. Pull CPI inflation and unemployment rate series by series ID and year range, then export every observation as structured JSON, CSV, or Excel rows — each with series ID, period, value, source URL, and scrape timestamp.

- **URL**: https://apify.com/b2b_lead_generation/bls-economic-data-scraper.md
- **Developed by:** [B2B Lead Generation](https://apify.com/b2b_lead_generation) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.99 / 1,000 results

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

## BLS Economic Data Scraper: US CPI and unemployment series

<p align="center">
  <img src="https://imgur.com/DwyFmST.png" alt="BLS Economic Data Scraper" style="max-width:100%; border-radius:14px; width:680px;" />
</p>

BLS Economic Data Scraper collects US Consumer Price Index (CPI) and unemployment series as clean, structured data. No login required. Each observation lands as one dataset row, ready to export as JSON, CSV, or Excel from Apify.

Pass one or more series ids, with an optional year range, and the actor returns every matching observation in a flat, ready-to-use shape.

### Use cases

- **Inflation tracking**: archive CPI-U all items (`CUUR0000SA0`) on a schedule and export CSV
- **Labor market checks**: track the unemployment rate (`LNS14000000`) beside prices
- **Research extracts**: take a short year window for a notebook or warehouse load
- **Dashboard feeds**: drop the Apify dataset into a sheet or BI tool
- **Dated snapshots**: keep `source_url` and `scraped_at` with every economic series row

### Input

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| seriesIds | array | CUUR0000SA0, LNS14000000 | Series ids to include. Pass a single id, or several ids with an optional year filter. |
| startYear | string | empty | First year, four digits. Leave blank with endYear to take the most recent observations. |
| endYear | string | empty | Last year, four digits. Set both years or neither. Spans over 10 years are split. |
| maxItems | integer | 100 | Cap on dataset rows, including error rows. Hard maximum 1000. |
| requestDelaySecs | number | 1.0 | Delay between operations, in seconds. Minimum 1. |
| timeoutSecs | integer | 300 | Overall run time limit in seconds. Maximum 3600. |
| requestTimeoutSecs | integer | 30 | Per-operation timeout in seconds. |
| proxyConfiguration | object | `{"useApifyProxy": false}` | Optional proxy. Default is none. |

#### Example input

```json
{
  "seriesIds": ["CUUR0000SA0", "LNS14000000"],
  "startYear": "2024",
  "endYear": "2024",
  "maxItems": 100,
  "requestDelaySecs": 1.0,
  "timeoutSecs": 300,
  "requestTimeoutSecs": 30,
  "proxyConfiguration": { "useApifyProxy": false }
}
```

### What data does this actor extract?

One flat row per observation, plus `seriesID`, `source_url`, `scraped_at`, and `mode`. Failed queries become error rows with `error`, `input`, and `status` so the run keeps going.

| Field | Description |
|-------|-------------|
| seriesID | Series identifier for the observation. |
| year | Year string for the observation. |
| period | Period code, such as M08. |
| periodName | Period label, such as August. |
| latest | Latest flag when present, otherwise empty. |
| value | Observation value, kept as text. |
| footnotes | Footnote objects for the observation. |
| source_url | Reference URL recorded with the row. |
| scraped_at | UTC time the row was produced. |
| mode | `series` for a single-series result, `multi` for a multi-series result. |
| error | Message on a failed query. |
| input | Series id or query label that failed. |
| status | HTTP status, or 404 when the series id is reported unknown. |

#### Example output

```json
{
  "seriesID": "CUUR0000SA0",
  "year": "2026",
  "period": "M08",
  "periodName": "August",
  "latest": "true",
  "value": "334.980",
  "footnotes": [{}],
  "scraped_at": "2026-10-12T00:00:00+00:00",
  "mode": "series"
}
```

### Limits and terms

Figures published by the Bureau of Labor Statistics are US government work. Duplicate rows (same series, year, and period) are dropped, and the run stops at `maxItems`.

An empty series list finishes successfully and logs a warning. An unknown series id writes one error row and the run continues.

### FAQ

**Do I need to log in?**

No. There is no account or sign-in step.

**How fresh is the series data?**

The dataset reflects the latest values available when the actor runs. `scraped_at` is the UTC run time. `latest` marks the period flagged as the newest.

**Can I export CSV from Apify?**

Yes. The dataset exports as JSON, CSV, or Excel.

**What happens if a series id is wrong?**

The run stays up. That query becomes one error row with `status` 404 when the id is reported unknown, and later series still run.

#### Trademark Notice

BLS Economic Data and related names, logos, and trademarks belong to their respective owners. Their use in this documentation is solely to identify the source of the data and does not imply affiliation, sponsorship, endorsement, or partnership.

#### Disclaimer

Disclaimer: This Actor is an independent tool and is not affiliated with, endorsed by, sponsored by, or otherwise officially associated with BLS Economic Data or its owners. All data is collected from publicly available sources. Users are responsible for complying with the source's terms of use, rate limits, and attribution or licensing requirements.

#### Is web scraping legal?

This Actor only collects publicly available data, without logging in or bypassing any access controls. Scraping public data is generally legal, but how you use it matters:

- **Personal data:** If the results include personal data (for example names, emails, or profile details), laws such as the GDPR in the EU and the CCPA in California may apply. Only collect and store personal data when you have a legitimate reason.
- **Copyright:** Some content (articles, images, descriptions) may be protected by copyright. Do not republish full copyrighted content without permission.
- **Terms of use:** Respect the source's terms, stated rate limits, and any attribution or non-commercial-use requirements.
- **Legal advice:** This is general information, not legal advice. If you're unsure, consult a lawyer.

To learn more, read Apify's guide: [Is web scraping legal?](https://blog.apify.com/is-web-scraping-legal/)

# Actor input Schema

## `seriesIds` (type: `array`):

BLS series IDs to pull. One ID with no year filter uses the public v1 GET. Two or more IDs, or any year filter, use the public v1 multi-series POST. Defaults to CPI-U all items (CUUR0000SA0) and the unemployment rate (LNS14000000).

## `startYear` (type: `string`):

First calendar year to request, such as 2024. Leave blank to take the recent observations BLS returns. If you set a start year, also set an end year. A span longer than 10 years is split into separate queries.

## `endYear` (type: `string`):

Last calendar year to request, such as 2024. Leave blank when start year is blank. Both years are sent together on the verified multi-series POST.

## `registrationKey` (type: `string`):

Optional BLS registration key. This actor does not send it. Only the public v1 GET and POST endpoints are called, which do not need a key. The value is never written to the dataset or the log.

## `maxItems` (type: `integer`):

Maximum dataset rows for this run, including error rows. The hard cap is 1000.

## `requestDelaySecs` (type: `number`):

Seconds to wait between BLS requests. Minimum is 1.0 so the run stays inside the public v1 pace.

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

Stop scheduling new BLS requests after this many seconds. Default is 300. Maximum is 3600.

## `requestTimeoutSecs` (type: `integer`):

How long to wait for a single BLS HTTP response before retrying. Default is 30 seconds.

## `proxyConfiguration` (type: `object`):

Optional proxy for BLS requests. Default is no proxy. Turn on Apify Proxy only if your IP is already at the daily query cap.

## Actor input object example

```json
{
  "seriesIds": [
    "CUUR0000SA0",
    "LNS14000000"
  ],
  "startYear": "2024",
  "endYear": "2024",
  "maxItems": 100,
  "requestDelaySecs": 1,
  "timeoutSecs": 300,
  "requestTimeoutSecs": 30,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `datasetUrl` (type: `string`):

Default dataset URL for this run, with one row per BLS observation or error.

## `overviewUrl` (type: `string`):

Table view of series id, period, value, and mode.

# 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 = {
    "seriesIds": [
        "CUUR0000SA0",
        "LNS14000000"
    ],
    "proxyConfiguration": {
        "useApifyProxy": false
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("b2b_lead_generation/bls-economic-data-scraper").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 = {
    "seriesIds": [
        "CUUR0000SA0",
        "LNS14000000",
    ],
    "proxyConfiguration": { "useApifyProxy": False },
}

# Run the Actor and wait for it to finish
run = client.actor("b2b_lead_generation/bls-economic-data-scraper").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 '{
  "seriesIds": [
    "CUUR0000SA0",
    "LNS14000000"
  ],
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}' |
apify call b2b_lead_generation/bls-economic-data-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,b2b_lead_generation/bls-economic-data-scraper"
        }
    }
}
```

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/WnRXHdxdR9y3MpPaG/builds/aW9YZAb09s3q4eYFT/openapi.json
