# Brazil Government Procurement Scraper (PNCP) (`scrapebr/brazil-pncp-procurement-scraper`) Actor

Extract Brazilian public tenders & contract awards from PNCP (ComprasNet) by state, modality, agency & keyword. Clean normalized JSON.

- **URL**: https://apify.com/scrapebr/brazil-pncp-procurement-scraper.md
- **Developed by:** [Scrape Br](https://apify.com/scrapebr) (community)
- **Categories:** Lead generation, Developer tools, Automation
- **Stats:** 2 total users, 0 monthly users, 100.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.50 / actor start

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

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

## 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

## Brazil Government Procurement Scraper (PNCP / ComprasNet Tenders & Contracts)

Extract **Brazilian public procurement** data — **tenders (editais/licitações), contract awards, and price-registration records** — from the official **PNCP** (Portal Nacional de Contratações Públicas, the national portal mandated by Lei 14.133/2021, successor to ComprasNet). Filter by **state (UF)**, **modality**, **agency CNPJ**, **date range**, and **keywords**. Output is clean, normalized JSON. For data engineers, market-intelligence teams, suppliers tracking opportunities, and researchers.

> Built on PNCP's **official public API** (no scraping of login-walled pages), so results are stable and complete. Data is public under Brasil's **Lei de Acesso à Informação** and licensed **CC BY 4.0** (commercial reuse allowed with attribution). **No personal data** is collected — see *Compliance*.

### What it does
- **Tenders** (`tenders`): published procurement notices by publication date — object, agency, unit/UF, estimated value, modality, dates, status, legal basis.
- **Contracts** (`contracts`): signed contract awards — who won (legal-entity supplier), values, validity period, category.
- **Open tenders** (`open_tenders`): tenders currently accepting proposals.
- Normalizes Brazilian fields into a clean, English-keyed schema (PT values preserved): decoded sphere (Federal/Estadual/Municipal), UF + município + IBGE code, BRL values, ISO dates, and a direct PNCP link per record.
- Client-side **keyword filter** (accent/case-insensitive) over the object text — PNCP has no full-text search.

### Input
| Field | Type | Required | Description |
|---|---|---|---|
| `dataType` | enum | – | `tenders` (default) · `contracts` · `open_tenders` |
| `dateFrom` | string `YYYY-MM-DD` | for tenders/contracts | Start of the publication-date range |
| `dateTo` | string `YYYY-MM-DD` | ✅ | End of range (proposal horizon for `open_tenders`) |
| `modalities` | string[] | – | Lei 14.133 modality codes for tenders. `6`=Pregão Eletrônico (default), `4`=Concorrência Eletrônica, `8`=Dispensa, `9`=Inexigibilidade, … |
| `uf` | string | – | 2-letter state filter, e.g. `SP`, `SC` |
| `cnpjOrgao` | string | – | Keep only one agency, by 14-digit CNPJ |
| `keywords` | string[] | – | Keep records whose object contains ANY term |
| `maxResults` | integer | – | Cap total records (default 500) |
| `includeRaw` | boolean | – | Attach the full original PNCP record under `_raw` (PII-stripped). Default off |

### Output (one record per Dataset item)
```json
{
  "recordType": "tender",
  "pncpId": "83021808000182-1-000200/2026",
  "object": "CONTRATAÇÃO DE EMPRESA ESPECIALIZADA … TELECOMUNICAÇÃO …",
  "agency": { "cnpj": "83021808000182", "name": "MUNICIPIO DE CHAPECO", "sphere": "Municipal", "power": "Não aplicável" },
  "unit": { "name": "Prefeitura Municipal de Chapecó", "uf": "SC", "municipality": "Chapecó", "ibgeCode": "4204202" },
  "modality": { "id": 6, "name": "Pregão - Eletrônico" },
  "status": { "id": 1, "name": "Divulgada no PNCP" },
  "values": { "estimated": 1342860.0, "awarded": null, "currency": "BRL" },
  "dates": { "published": "2026-05-01T00:00:12", "proposalClose": "2026-05-19T08:55:01" },
  "sourceUrl": "https://pncp.gov.br/app/editais/83021808000182/2026/200",
  "_source": "Portal Nacional de Contratações Públicas (PNCP) — CC BY 4.0"
}
````

Contract records add `supplier` (legal-entity only — see Compliance), `contractType`, validity dates, and `valorGlobal`/`valorInicial`.

### Example input

```json
{ "dataType": "tenders", "dateFrom": "2026-05-01", "dateTo": "2026-05-31", "modalities": ["6"], "uf": "SC", "keywords": ["telecom", "internet"], "maxResults": 200 }
```

### Data source, freshness & compliance

- **Source:** [PNCP](https://www.gov.br/pncp) official consulta API. **Licence: CC BY 4.0** — commercial reuse permitted with attribution (each record carries `_source`).
- **Freshness:** live per run (PNCP updates continuously).
- **🔒 No personal data (LGPD):** only public procurement catalog data. Government contracts can be awarded to a *natural person* (`tipoPessoa = PF`); in that case the supplier's CPF and name are **personal data and are stripped** — the record marks `supplier.redactedForPrivacy: true`. Only **legal-entity (PJ)** supplier CNPJ + company name are returned. The publishing-system user field is never emitted.
- **Tip:** keyword queries scan more pages on the 50-records/page tenders endpoint — narrow with `uf` + a tight date range for speed. Very large pulls can take a few minutes; the actor throttles politely to respect PNCP's servers.

### FAQ

**What's the difference between PNCP and ComprasNet?** ComprasNet (Compras.gov.br) is the legacy federal procurement portal. Under Lei 14.133/2021, publication migrated to **PNCP** — the national portal that aggregates federal, state and municipal procurement. This actor reads PNCP, so you get the broadest coverage (some legacy-only auctions may appear solely on ComprasNet).

**Can I get licitações as Excel or CSV?** Yes — results land in an Apify Dataset, which exports to **CSV, Excel (XLSX), JSON, HTML or XML** with one click (or via API). No parsing needed.

**Is this data legal to use commercially?** Yes. PNCP data is public under Brasil's Lei de Acesso à Informação and licensed **CC BY 4.0** (commercial reuse with attribution — every record carries a `_source` field). The actor collects **no personal data** (LGPD): natural-person suppliers are automatically redacted.

**How fresh is the data?** Live — each run queries the official PNCP API directly. New tenders typically appear on PNCP within minutes of publication.

**Can I monitor new tenders automatically?** Yes — add an Apify **Schedule** (e.g., daily, with yesterday→today as the date range and your keywords/UF) and connect a webhook or integration (Sheets, Slack, Make, n8n) to the run results.

### Maintenance

Weekly automated health-check; endpoint-change monitoring. Issues & requests via the Apify Store contact.

***

*Published by **ScrapeBR Studio** — Brazilian public-data actors. Data © the Brazilian Government via PNCP (CC BY 4.0); this actor is an independent tool and is not affiliated with or endorsed by the Brazilian Government.*

# Actor input Schema

## `dataType` (type: `string`):

What to fetch from PNCP. 'tenders' = published procurement notices (by publication date). 'contracts' = signed contract awards (who won, how much). 'open\_tenders' = tenders currently accepting proposals.

## `dateFrom` (type: `string`):

Start of the publication-date range. Required for 'tenders' and 'contracts'. Ignored for 'open\_tenders'.

## `dateTo` (type: `string`):

End of the publication-date range (for 'open\_tenders' this is the proposal-closing horizon). Required.

## `modalities` (type: `array`):

Lei 14.133 modality codes (used for 'tenders'/'open\_tenders'; ignored for 'contracts'). 1=Leilão Eletrônico, 2=Diálogo Competitivo, 3=Concurso, 4=Concorrência Eletrônica, 5=Concorrência Presencial, 6=Pregão Eletrônico (most common), 7=Pregão Presencial, 8=Dispensa, 9=Inexigibilidade. Defaults to \[6].

## `uf` (type: `string`):

Optional 2-letter state filter, e.g. SP, RJ, SC, MG.

## `cnpjOrgao` (type: `string`):

Optional — keep only records for one public agency, by its 14-digit CNPJ (digits only).

## `keywords` (type: `array`):

Optional — keep only records whose object text contains ANY of these terms (accent/case-insensitive). Client-side filter (PNCP has no full-text search).

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

Cap total records returned (bounds runtime + cost). Default 500.

## `includeRaw` (type: `boolean`):

Attach the full original PNCP record under `_raw` (personal data of natural-person suppliers is stripped). Default off for cleaner output.

## Actor input object example

```json
{
  "dataType": "tenders",
  "dateFrom": "2026-05-01",
  "dateTo": "2026-05-31",
  "modalities": [
    "6"
  ],
  "maxResults": 200,
  "includeRaw": false
}
```

# Actor output Schema

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

All normalized PNCP tender/contract records pushed by this run, as a JSON array (English keys, Portuguese values preserved; LGPD PII-stripped).

# 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 = {
    "dateFrom": "2026-05-01",
    "dateTo": "2026-05-31",
    "maxResults": 200
};

// Run the Actor and wait for it to finish
const run = await client.actor("scrapebr/brazil-pncp-procurement-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 = {
    "dateFrom": "2026-05-01",
    "dateTo": "2026-05-31",
    "maxResults": 200,
}

# Run the Actor and wait for it to finish
run = client.actor("scrapebr/brazil-pncp-procurement-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 '{
  "dateFrom": "2026-05-01",
  "dateTo": "2026-05-31",
  "maxResults": 200
}' |
apify call scrapebr/brazil-pncp-procurement-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Brazil Government Procurement Scraper (PNCP)",
        "description": "Extract Brazilian public tenders & contract awards from PNCP (ComprasNet) by state, modality, agency & keyword. Clean normalized JSON.",
        "version": "0.1",
        "x-build-id": "wL4dWXujfs6DkICm9"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/scrapebr~brazil-pncp-procurement-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-scrapebr-brazil-pncp-procurement-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/scrapebr~brazil-pncp-procurement-scraper/runs": {
            "post": {
                "operationId": "runs-sync-scrapebr-brazil-pncp-procurement-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/scrapebr~brazil-pncp-procurement-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-scrapebr-brazil-pncp-procurement-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",
                "required": [
                    "dateTo"
                ],
                "properties": {
                    "dataType": {
                        "title": "Data type",
                        "enum": [
                            "tenders",
                            "contracts",
                            "open_tenders"
                        ],
                        "type": "string",
                        "description": "What to fetch from PNCP. 'tenders' = published procurement notices (by publication date). 'contracts' = signed contract awards (who won, how much). 'open_tenders' = tenders currently accepting proposals.",
                        "default": "tenders"
                    },
                    "dateFrom": {
                        "title": "Date from (publication, YYYY-MM-DD)",
                        "type": "string",
                        "description": "Start of the publication-date range. Required for 'tenders' and 'contracts'. Ignored for 'open_tenders'."
                    },
                    "dateTo": {
                        "title": "Date to (YYYY-MM-DD)",
                        "type": "string",
                        "description": "End of the publication-date range (for 'open_tenders' this is the proposal-closing horizon). Required."
                    },
                    "modalities": {
                        "title": "Modalities (tender types)",
                        "type": "array",
                        "description": "Lei 14.133 modality codes (used for 'tenders'/'open_tenders'; ignored for 'contracts'). 1=Leilão Eletrônico, 2=Diálogo Competitivo, 3=Concurso, 4=Concorrência Eletrônica, 5=Concorrência Presencial, 6=Pregão Eletrônico (most common), 7=Pregão Presencial, 8=Dispensa, 9=Inexigibilidade. Defaults to [6].",
                        "default": [
                            "6"
                        ],
                        "items": {
                            "type": "string"
                        }
                    },
                    "uf": {
                        "title": "State (UF)",
                        "type": "string",
                        "description": "Optional 2-letter state filter, e.g. SP, RJ, SC, MG."
                    },
                    "cnpjOrgao": {
                        "title": "Agency CNPJ",
                        "type": "string",
                        "description": "Optional — keep only records for one public agency, by its 14-digit CNPJ (digits only)."
                    },
                    "keywords": {
                        "title": "Keywords",
                        "type": "array",
                        "description": "Optional — keep only records whose object text contains ANY of these terms (accent/case-insensitive). Client-side filter (PNCP has no full-text search).",
                        "items": {
                            "type": "string"
                        }
                    },
                    "maxResults": {
                        "title": "Max results",
                        "minimum": 1,
                        "maximum": 20000,
                        "type": "integer",
                        "description": "Cap total records returned (bounds runtime + cost). Default 500.",
                        "default": 500
                    },
                    "includeRaw": {
                        "title": "Include raw PNCP record",
                        "type": "boolean",
                        "description": "Attach the full original PNCP record under `_raw` (personal data of natural-person suppliers is stripped). Default off for cleaner output.",
                        "default": false
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
