# Spain Public Procurement Scraper — PLACSP Tenders & Awards (`rastriq/placsp-scraper`) Actor

Scrape Spanish public tenders from contrataciondelsectorpublico.gob.es. Extract procurement data with CPV codes, budgets, award details, winner NIF, and bid counts. Filter by region, status, and contract type. No browser needed.

- **URL**: https://apify.com/rastriq/placsp-scraper.md
- **Developed by:** [Rastriq — Structured data from the world](https://apify.com/rastriq) (community)
- **Categories:** Business, Lead generation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

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

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use 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

## Spain Public Procurement Scraper — PLACSP Tenders & Awards

Scrape all public tenders from Spain's official procurement portal ([contrataciondelsectorpublico.gob.es](https://contrataciondelsectorpublico.gob.es)) using official ATOM/CODICE XML feeds. Extract structured data on government contracts, awards, budgets, CPV codes, winner details, and bid counts — all without a browser.

> **No browser required.** Uses direct HTTP requests to download official XML feeds — fast, reliable, and cost-effective.

### Why use this scraper

- **Official source** — pulls directly from Spain's PLACSP platform, the authoritative registry for all public-sector procurement
- **Deep award data** — extracts winner name, winner NIF (tax ID), award amount, number of bids received, and SME indicator
- **Powerful filters** — narrow results by CPV code, region (CCAA/NUTS), minimum budget, and tender status
- **Two feed types** — standard tenders (perfiles) and minor contracts (contratos menores)
- **Deduplication built in** — when a tender appears across multiple months, only the latest version is kept
- **Fast and cheap** — HTTP-only extraction processes 12,000+ tenders per run at minimal cost (~$0.03 for 500 results)

### Use cases

- **Government sales prospecting** — find open tenders matching your company's CPV codes and regions
- **Procurement intelligence** — monitor awarded contracts, winning prices, and competitive dynamics
- **Market research** — analyze public spending patterns by sector, region, and contract size
- **Competitor tracking** — identify which companies win government contracts in your industry
- **Compliance and transparency** — audit public procurement data for journalistic or regulatory purposes
- **Lead generation** — build targeted lists of contracting authorities and awarded companies with NIF identifiers

### Supported data sources

| Feed type | Description | Coverage |
|-----------|-------------|----------|
| `perfiles` | Standard public tenders (contratos mayores) | Full procurement lifecycle |
| `menores` | Minor contracts (contratos menores) | Simplified procurement |

### Input parameters

| Parameter | Description | Default |
|-----------|-------------|---------|
| `monthsBack` | Months of data to download (each month ~100–300 MB ZIP) | 1 |
| `desde` / `hasta` | Date range in YYYYMM format (overrides monthsBack) | — |
| `feedType` | `perfiles` (standard) or `menores` (minor contracts) | perfiles |
| `cpvFilter` | CPV code prefix (e.g. `45` for construction, `72` for IT) | all |
| `ccaaFilter` | Region keyword in contracting authority name or NUTS code | all |
| `importeMin` | Minimum budget in EUR (tax-exclusive) | 0 |
| `estadoFilter` | Status: publicada, adjudicada, formalizada, resuelta, anulada | all |
| `maxItems` | Maximum items to return (0 = unlimited) | 0 |

### Output fields

Every result includes up to 20 structured fields:

| Field | Description |
|-------|-------------|
| `expediente` | Tender reference number |
| `objeto` | Contract description |
| `organo_contratante` | Contracting authority name |
| `nif_organo` | Contracting authority tax ID (NIF) |
| `tipo_contrato` | Contract type (Obras, Servicios, Suministros) |
| `procedimiento` | Procedure type (Abierto, Restringido, etc.) |
| `estado` | Status (Publicada, Adjudicada, Formalizada, etc.) |
| `importe_sin_iva` | Budget excluding VAT (EUR) |
| `importe_con_iva` | Budget including VAT (EUR) |
| `cpv_principal` | Main CPV classification code |
| `nuts` | NUTS region code |
| `fecha_publicacion` | Publication date |
| `fecha_limite` | Submission deadline |
| `adjudicatario` | Award winner name |
| `nif_adjudicatario` | Winner tax ID (NIF) |
| `importe_adjudicacion` | Award amount (EUR) |
| `num_ofertas` | Number of bids received |
| `es_pyme` | Whether the winner is an SME |
| `url` | Direct link to tender page |
| `source` | Data source identifier |

### Example input

```json
{
  "monthsBack": 3,
  "feedType": "perfiles",
  "cpvFilter": "45",
  "importeMin": 100000,
  "estadoFilter": "publicada"
}
````

### Example output

```json
{
  "expediente": "168/2025",
  "objeto": "Proyecto constructivo de un nuevo Punto Verde O/1.301",
  "organo_contratante": "Autoridad Portuaria de Vigo",
  "nif_organo": "Q3667002D",
  "tipo_contrato": "Obras",
  "procedimiento": "Abierto",
  "estado": "Publicada",
  "importe_sin_iva": 124084.24,
  "importe_con_iva": 150141.93,
  "cpv_principal": "45232470",
  "nuts": "ES114",
  "fecha_publicacion": "2026-06-06",
  "fecha_limite": "2026-07-13",
  "adjudicatario": "",
  "nif_adjudicatario": "",
  "importe_adjudicacion": null,
  "num_ofertas": null,
  "es_pyme": null,
  "url": "https://contrataciondelestado.es/wps/poc?uri=deeplink:detalle_licitacion&idEvl=6Au3k6h85cH10HRJw8TEnQ%3D%3D",
  "source": "placsp"
}
```

### Cost estimation

| Scenario | Months | Items | Duration | Estimated cost |
|----------|--------|-------|----------|----------------|
| Quick check | 1 | ~12,000 | ~80s | ~$0.03 |
| Quarterly scan | 3 | ~35,000 | ~4 min | ~$0.10 |
| Annual archive | 12 | ~150,000 | ~15 min | ~$0.40 |

Memory: 4,096 MB recommended (ZIP files can be 100–300 MB each).

### CPV code reference

Common CPV prefixes for filtering:

| CPV prefix | Sector |
|------------|--------|
| `45` | Construction works |
| `72` | IT and computer services |
| `71` | Architectural and engineering |
| `50` | Repair and maintenance |
| `33` | Medical equipment |
| `34` | Transport equipment |
| `79` | Business services |
| `85` | Health and social services |
| `90` | Sewage and waste services |
| `80` | Education and training |

### Notes

- Each monthly ZIP can be 50–300 MB; download time varies with server load
- Records are deduplicated by expediente (latest version kept)
- The PLACSP portal occasionally has downtime; the scraper retries on failure
- No proxy required — datacenter IPs work fine with the official ATOM feed
- For continuous monitoring, schedule runs daily or weekly via the Apify Scheduler

# Actor input Schema

## `monthsBack` (type: `integer`):

<b>How many months of procurement data to download.</b> Each month is a ~100-300 MB ZIP file.

## `desde` (type: `string`):

<b>Start month in YYYYMM format (e.g.</b> 202401). Overrides monthsBack.

## `hasta` (type: `string`):

<b>End month in YYYYMM format (e.g.</b> 202412). Required if 'desde' is set.

## `feedType` (type: `string`):

Type of procurement feed to download.

## `cpvFilter` (type: `string`):

<b>Filter by CPV code prefix (e.g.</b> 45 for construction, 72 for IT). Leave empty for all.

## `ccaaFilter` (type: `string`):

<b>Filter by region keyword in organo\_contratante or NUTS code.</b> Leave empty for all.

## `importeMin` (type: `number`):

<b>Minimum importe\_sin\_iva in EUR.</b> Set 0 for no minimum.

## `estadoFilter` (type: `string`):

Filter by tender status.

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

<b>Maximum items to return.</b> Set 0 for unlimited.

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

<b>Select proxies to be used.</b> PLACSP works without proxy from datacenter IPs.

## Actor input object example

```json
{
  "monthsBack": 1,
  "feedType": "perfiles",
  "cpvFilter": "45",
  "estadoFilter": "",
  "maxItems": 100,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# 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 = {
    "cpvFilter": "45",
    "proxyConfiguration": {
        "useApifyProxy": false
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("rastriq/placsp-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 = {
    "cpvFilter": "45",
    "proxyConfiguration": { "useApifyProxy": False },
}

# Run the Actor and wait for it to finish
run = client.actor("rastriq/placsp-scraper").call(run_input=run_input)

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

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

```

## CLI example

```bash
echo '{
  "cpvFilter": "45",
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}' |
apify call rastriq/placsp-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=rastriq/placsp-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Spain Public Procurement Scraper — PLACSP Tenders & Awards",
        "description": "Scrape Spanish public tenders from contrataciondelsectorpublico.gob.es. Extract procurement data with CPV codes, budgets, award details, winner NIF, and bid counts. Filter by region, status, and contract type. No browser needed.",
        "version": "0.1",
        "x-build-id": "GmkvSCkIxvSFcSuiF"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/rastriq~placsp-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-rastriq-placsp-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/rastriq~placsp-scraper/runs": {
            "post": {
                "operationId": "runs-sync-rastriq-placsp-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/rastriq~placsp-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-rastriq-placsp-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "properties": {
                    "monthsBack": {
                        "title": "📅 Months back",
                        "minimum": 1,
                        "type": "integer",
                        "description": "<b>How many months of procurement data to download.</b> Each month is a ~100-300 MB ZIP file.",
                        "default": 1
                    },
                    "desde": {
                        "title": "📅 From (YYYYMM)",
                        "pattern": "^\\d{6}$",
                        "type": "string",
                        "description": "<b>Start month in YYYYMM format (e.g.</b> 202401). Overrides monthsBack."
                    },
                    "hasta": {
                        "title": "📅 To (YYYYMM)",
                        "pattern": "^\\d{6}$",
                        "type": "string",
                        "description": "<b>End month in YYYYMM format (e.g.</b> 202412). Required if 'desde' is set."
                    },
                    "feedType": {
                        "title": "⚙️ Feed type",
                        "enum": [
                            "perfiles",
                            "menores"
                        ],
                        "type": "string",
                        "description": "Type of procurement feed to download.",
                        "default": "perfiles"
                    },
                    "cpvFilter": {
                        "title": "🏷️ CPV filter",
                        "type": "string",
                        "description": "<b>Filter by CPV code prefix (e.g.</b> 45 for construction, 72 for IT). Leave empty for all."
                    },
                    "ccaaFilter": {
                        "title": "📍 CCAA / region filter",
                        "type": "string",
                        "description": "<b>Filter by region keyword in organo_contratante or NUTS code.</b> Leave empty for all."
                    },
                    "importeMin": {
                        "title": "💰 Minimum budget",
                        "type": "number",
                        "description": "<b>Minimum importe_sin_iva in EUR.</b> Set 0 for no minimum."
                    },
                    "estadoFilter": {
                        "title": "🏷️ Status filter",
                        "enum": [
                            "",
                            "publicada",
                            "adjudicada",
                            "formalizada",
                            "resuelta",
                            "anulada"
                        ],
                        "type": "string",
                        "description": "Filter by tender status.",
                        "default": ""
                    },
                    "maxItems": {
                        "title": "🔢 Max items",
                        "minimum": 0,
                        "type": "integer",
                        "description": "<b>Maximum items to return.</b> Set 0 for unlimited.",
                        "default": 0
                    },
                    "proxyConfiguration": {
                        "title": "🛡️ Proxy configuration",
                        "type": "object",
                        "description": "<b>Select proxies to be used.</b> PLACSP works without proxy from datacenter IPs."
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
