# Spain BOE Gazette Scraper (`parseforge/spain-boe-gazette-scraper`) Actor

Scrapes documents from Spain's Boletín Oficial del Estado (BOE) by date, date range, or section. Returns each document as a flat row with title, issuing body, section, and links to PDF and HTML.

- **URL**: https://apify.com/parseforge/spain-boe-gazette-scraper.md
- **Developed by:** [ParseForge](https://apify.com/parseforge) (community)
- **Categories:** Automation, Developer tools, News
- **Stats:** 1 total users, 0 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 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?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

[![ParseForge](https://raw.githubusercontent.com/ParseForge/apify-assets/main/banner.jpg)](https://apify.com/parseforge?fpr=vmoqkp)

### Spain BOE Gazette Scraper

**Scrape Spain's BOE official gazette by date or date range, up to a million documents per run.** Every document comes with its section, title, issuing body, and direct links to the PDF and HTML. No login or API key. Export to CSV, JSON, Excel, or XML.

Spain's Boletín Oficial del Estado (BOE) publishes every law, royal decree, public appointment, and official notice, but its website is built for reading one day at a time. This Actor reads the public gazette directly, filtered by date, section, or a full date range, and returns each document in one fixed schema. Legal researchers, compliance teams, and procurement analysts get the official record without manual copying.

| Who uses it | What they scrape Spain BOE Gazette for |
|---|---|
| Legal researchers | Monitor new laws and royal decrees as they are published |
| Compliance officers | Track regulatory changes that affect their industry |
| Procurement analysts | Find public sector contract announcements in section 5A |
| Journalists | Follow official appointments and government decisions |
| Data providers | Build a structured feed of BOE documents for downstream applications |

### What it does

This Actor collects BOE gazette documents by single date or date range, optionally filtered by section, and returns each one as a flat row with its metadata and links.

- 📅 **Single date or range:** collect one day with `date`, or every day from `startDate` to `endDate` inclusive.
- 🗂️ **Section filter:** limit to specific BOE sections like 1 (general provisions), 2A (appointments), or 5A (public contracts).
- 🔗 **Direct links:** each document includes the official PDF and HTML URLs from the BOE website.
- ⚙️ **Run limits:** cap the number of documents per run with `maxItems` to control output size.

Results export to CSV, JSON, Excel, or XML, or straight from the API.

### What you can do with Spain BOE Gazette data

**📜 Monitor new legislation.**

A legal researcher runs the Actor daily with section 1 to capture every new law and royal decree, then reviews the PDFs for relevant changes.

**📊 Track public procurement.**

A procurement analyst collects section 5A for the past month to build a list of open contract announcements and their issuing bodies.

**🗞️ Follow official appointments.**

A journalist scrapes section 2A each week to report on new government appointments and personnel changes.

**📁 Build a compliance archive.**

A compliance officer runs the Actor quarterly over a date range to archive all BOE documents that mention their industry, then stores the structured data.

### Why choose this scraper

| | What you get |
|---|---|
| **Official source** | Data comes directly from the BOE website, the authoritative gazette of Spain |
| **Structured output** | Each document is a flat row with section, title, department, and links |
| **Flexible dates** | Collect one day or a full range, including weekends and holidays when the BOE is empty |
| **No API key** | Uses the public BOE pages, so no registration or authentication is needed |

### How it compares

This Actor focuses on straightforward date and section collection of BOE documents, while some competitors add keyword or department filters.

| Feature | ParseForge | BOE Scraper - Spanish Official Gazette | BOE Scraper - Spain Official Gazette |
|---|---|---|---|
| Filter by date | Yes | Yes | Yes |
| Filter by section | Yes | Yes | Yes |
| Filter by department | Not listed | Yes | Yes |
| Filter by keyword | Not listed | Yes | Not listed |
| Direct PDF and HTML links | Yes | Yes | Not listed |
| Date range collection | Yes | Not listed | Not listed |

### Configure the run

Drive the Actor with a single date or a start and end date, and narrow results by BOE section. Filters run as each document is read, so only matches reach your dataset. The Input tab lists every parameter.

A first run with the defaults:

```json
{
 "date": "20240102",
 "maxItems": 10
}
```

A larger pull:

```json
{
 "date": "20240102",
 "maxItems": 200
}
```

### Pricing

Pay-per-result: **$0.004 per result** collected. You pay only for the results written to your dataset.

| Results collected | Approximate cost |
|---|---|
| 100 results | $0.40 |
| 1,000 results | $4.00 |
| 10,000 results | $40.00 |

New Apify accounts start with $5 in free credit.

### Free users

Free-plan runs return up to 10 results as a preview. [Upgrade your Apify plan](https://console.apify.com/sign-up?fpr=vmoqkp) to collect up to 1,000,000 results per run.

### Run it

1. [Create a free Apify account with $5 in credit](https://console.apify.com/sign-up?fpr=vmoqkp).
2. Open the [Spain BOE Gazette Scraper](https://apify.com/parseforge/spain-boe-gazette-scraper?fpr=vmoqkp).
3. Set your inputs and any filters, then click **Start**.
4. Export the results as CSV, Excel, JSON, or XML from the **Dataset** tab.

Run it programmatically through the [Apify API](https://docs.apify.com/api/v2) (`run-sync-get-dataset-items`) or the [ApifyClient](https://docs.apify.com/api/client/js) for JavaScript and Python.

### Use with AI agents (MCP)

Give an AI agent live access to Spain BOE Gazette through the Model Context Protocol. Add the Actor to Claude, Cursor, or any MCP client:

```bash
claude mcp add --transport http apify "https://mcp.apify.com/?tools=parseforge/spain-boe-gazette-scraper"
```

Then prompt it in plain language to run the scraper and read back the results.

### Troubleshooting

**Why am I getting no results?**

Check that the date is in YYYYMMDD format and is a valid publication day. Weekends and public holidays usually have no BOE. Also verify that your section filter, if set, matches the sections published that day.

**Why did the run stop before collecting all documents?**

The `maxItems` limit was reached. Increase it if you need more documents, up to 1,000,000.

**Why are some documents missing from my section filter?**

Make sure you used the correct section code. For example, public contracts are in 5A, not 5. The section codes are listed in the input schema.

**Why is the date range not working?**

Both `startDate` and `endDate` must be set for the range to activate. If only one is set, the Actor falls back to the single `date` field.

**Why are the PDF links not opening?**

The links point to the official BOE website. If the BOE site is temporarily down or has changed its URL structure, the links may not work. Try again later or check the BOE website directly.

### FAQ

| Question | Answer |
|---|---|
| What is the BOE? | The Boletín Oficial del Estado (BOE) is Spain's official government gazette. It publishes laws, royal decrees, public appointments, official notices, and procurement announcements. |
| How do I specify a date? | Use the `date` field for a single day in YYYYMMDD format, for example 20240102. For a range, set both `startDate` and `endDate`; the single date is then ignored. |
| Can I filter by section? | Yes. The `sections` field accepts an array of section codes like 1, 2A, 2B, 3, 4, 5A, 5B, or 5C. Leave it empty to collect all sections. |
| What does each document include? | Each row contains the document's section, title, issuing body, publication date, and direct links to the official PDF and HTML versions. |
| Is there a limit on how many documents I can collect? | You can set `maxItems` to any number from 1 to 1,000,000. The Actor stops after reaching that count. |
| Does this Actor require an API key or login? | No. It reads the public BOE website directly, so no registration or authentication is needed. |
| What happens on weekends or public holidays? | The BOE usually does not publish on weekends or public holidays. If you request such a date, the Actor returns an empty dataset. |
| Can I export the data? | Yes. You can export the results to CSV, JSON, Excel, or XML from the Apify dataset. |
| Is the data in Spanish? | Yes, the BOE publishes in Spanish. The Actor returns the original Spanish text and metadata. |
| Can I schedule this Actor to run automatically? | Yes, you can set up a schedule in Apify to run it daily, weekly, or at any interval you need. |

### Related actors

Browse the full [ParseForge collection](https://apify.com/parseforge?fpr=vmoqkp) for more scrapers.

🆘 **Need help?** Email parseforge@protonmail.com with your run ID, your input, and what you expected.

⚠️ **Disclaimer.** This Actor is unofficial and is not affiliated with, endorsed by, or sponsored by Agencia Estatal Boletín Oficial del Estado. It collects only publicly available data. You are responsible for using the collected data in compliance with the source's terms of service and applicable data-protection laws, including GDPR, CCPA, and PIPL. Do not use it to collect personal data unlawfully.

# Actor input Schema

## `date` (type: `string`):

Single publication date to collect, as YYYYMMDD (for example 20240102). Used when no date range is provided. Weekends and public holidays are usually empty.

## `startDate` (type: `string`):

First publication date of a range, as YYYYMMDD. When both Start Date and End Date are set, every day in the range is collected and the single Date above is ignored.

## `endDate` (type: `string`):

Last publication date of a range, as YYYYMMDD (inclusive). Must be on or after Start Date.

## `sections` (type: `array`):

Limit collection to specific BOE sections. Leave empty to collect every section of each day.

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

How many documents to collect per run.

## Actor input object example

```json
{
  "date": "20240102",
  "maxItems": 10
}
```

# Actor output Schema

## `results` (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 = {
    "date": "20240102",
    "maxItems": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("parseforge/spain-boe-gazette-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 = {
    "date": "20240102",
    "maxItems": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("parseforge/spain-boe-gazette-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 '{
  "date": "20240102",
  "maxItems": 10
}' |
apify call parseforge/spain-boe-gazette-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,parseforge/spain-boe-gazette-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/4h9Rbcy2nxjmWMyEZ/builds/LXbluWajGEwC6TCOr/openapi.json
