# Brazil Public Contracts API (PNCP Contratos) (`br_data_hub/br-pncp-contracts`) Actor

Get Brazilian government contracts from PNCP, the official national procurement portal: buyer, supplier, object, values and dates. Filter by date, buyer, supplier, state, keywords and value.

- **URL**: https://apify.com/br_data_hub/br-pncp-contracts.md
- **Developed by:** [br_data_hub](https://apify.com/br_data_hub) (community)
- **Categories:** AI, Lead generation, Business
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.40 / 1,000 contracts

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

## Brazil Public Contracts API (PNCP Contratos)

Get **Brazilian government contracts** from **PNCP** (Portal Nacional de Contratações Públicas), the official national procurement portal where federal, state and municipal agencies must publish their contracts under Law 14.133/2021.

Use it to find who is selling to the government, monitor competitors, discover buyers for your product, or feed contract data to an AI agent.

> 🇧🇷 **Contratos públicos do PNCP via API:** busque contratos por fornecedor (CNPJ), órgão comprador, UF, valor mínimo e palavras no objeto, com link oficial para cada contrato. Ideal para inteligência de mercado em vendas para o governo. CPF de pessoa física vem mascarado. Mais detalhes em português no fim da página.

### What can you do with it?

- 🔎 **Competitive intelligence:** see what your competitors sell to the government, to whom and for how much.
- 🏛️ **Find buyers:** discover which agencies buy your kind of product or service, by state and keyword.
- 📈 **Market sizing:** sum contract values by agency, state or object over a period.
- 🤖 **AI agents:** give an agent live, structured Brazilian procurement data with a typed schema.

### What you get per contract

- Buyer agency (CNPJ, name, federal/state/municipal), unit, city and state
- Supplier name and document (company CNPJ; **individuals' CPF is masked**)
- Contract object (description), type and category
- Initial and total value in BRL
- Signature, validity and publication dates
- Direct link to the contract page on PNCP

### How to search contracts in 3 steps

1. Click **Try for free** and set a date range (up to 31 days; empty means yesterday).
2. Add filters: a **supplier CNPJ** to see one company's contracts, a **buyer CNPJ** for one agency, **states** and **keywords**.
3. Click **Start**, then export from the **Output** tab or read the results through the API.

### Input

| Field | Description |
|---|---|
| `dateFrom`, `dateTo` | Publication date range on PNCP (YYYY-MM-DD, max 31 days). Empty = yesterday. |
| `buyerCnpj` | Only one agency. Filtered by PNCP itself, so it is the fastest filter. |
| `supplierCnpj` | Only contracts won by one company. |
| `states` | Buyer states (UF), e.g. `["SP", "MG"]`. |
| `keywords` | Words in the contract object, accents and case ignored (any word matches). |
| `minValueBrl` | Minimum total value. |
| `maxItems` | Stop after this many contracts (default 100). |

#### Speed

PNCP only filters by date and buyer agency. Supplier, state, keyword and value filters are applied by the Actor while it reads every contract of the period. A full day has about 6,000 to 10,000 contracts and takes **about 2 minutes** to scan. Combine filters with `buyerCnpj` or short date ranges for fast runs.

### Output example

```json
{
  "pncpId": "59011676000123-2-000045/2026",
  "pncpUrl": "https://pncp.gov.br/app/contratos/59011676000123/2026/45",
  "buyerName": "CAMARA MUNICIPAL DE VALINHOS",
  "buyerSphere": "Municipal",
  "state": "SP",
  "supplierName": "GRUPO VECTORI",
  "object": "Aquisição de 10 (dez) licenças de software antivírus...",
  "totalValueBrl": 1499,
  "publishedAt": "2026-10-20T08:12:44"
}
```

### How much does it cost?

You pay only for contracts that match your filters. Reading and filtering the whole period is free.

This Actor does one thing: PNCP contracts. Company registry data is in **Brazil CNPJ Lookup**, from the same publisher.

**$0.002 per contract** (`contract` event, pay per event). Charged once per contract returned that matches your filters. Scanning is free.

| You get | Free tier | Bronze tier (10% off) | Gold tier (30% off) |
|---|---|---|---|
| 100 contracts | $0.20 | $0.18 | $0.14 |
| 1,000 contracts | $2.00 | $1.80 | $1.40 |
| 10,000 contracts | $20.00 | $18.00 | $14.00 |

Discounts follow your Apify subscription tier: Bronze 10%, Silver 20%, Gold and above 30%. No subscription to this Actor and no charge for platform usage: you pay only for results.
The Apify Free plan includes $5 of monthly credit, enough for about **2,500 contracts** at the list price.
You can cap the cost of any run with **Maximum cost per run**; the Actor stops when it is reached.

### Data source and limits

Official public API of PNCP (`pncp.gov.br/api/consulta`). Data and freshness follow the source; contracts signed before agencies joined PNCP may be missing. Values are as declared by each agency.

### More questions

#### How far back can I search?

Any period PNCP has, up to **31 days per run** (by publication date on PNCP). PNCP became mandatory with Law 14.133/2021, so older contracts, or contracts of agencies that had not joined PNCP yet, may be missing. For a longer period, run the Actor once per month (an Apify schedule or a loop through the API does this).

#### Can I get every contract of one company (supplier CNPJ)?

Yes, within the date range. PNCP's API cannot filter by supplier, so the Actor reads every contract published in the period and keeps the ones whose supplier document equals your CNPJ. Use the full 14-digit CNPJ (punctuation is fine): the comparison is exact, so a branch CNPJ only matches that branch. A full day takes about 2 minutes to scan, a full month much longer, so keep ranges short.

#### Why is the buyer filter so much faster?

`buyerCnpj` is sent to PNCP itself, which returns only that agency's contracts. Supplier, state, keyword and minimum value are applied by the Actor while reading. Combine the buyer filter with the others for runs of a few seconds.

#### How do keywords work?

A contract is kept when its object (`object`) contains **any** of the words, ignoring accents and case. The match is on part of the text, so `software` also finds `softwares`. Add several words for synonyms (`ambulancia`, `UTI movel`); you never need to repeat a word with and without accents.

#### Are values the contract value or what was paid?

They are the values declared by the agency on PNCP: `initialValueBrl` (value at signature) and `totalValueBrl` (global value, including amendments when the agency updates it). Payments are not on PNCP. `minValueBrl` uses the total value.

#### Is personal data exposed?

When the supplier is an individual (`supplierType: "PF"`), the CPF is masked like the Receita Federal does (`***123456**`). Company CNPJs, agency names and contract data are public by law.

#### How do I open the original contract?

Every item has `pncpUrl`, the contract page on the official PNCP portal, plus `pncpId` (PNCP control number) and `purchaseId`, the tender that originated the contract.

#### What happens if PNCP is slow or down?

The Actor retries each page up to 5 times with growing pauses. If PNCP still does not answer, the run fails with a clear message, and only contracts already delivered are charged.

### Use it via API

Run it from any language and get the results as JSON. Replace `<YOUR_API_TOKEN>` with your [Apify API token](https://console.apify.com/settings/integrations).

```bash
curl -X POST "https://api.apify.com/v2/acts/br_data_hub~br-pncp-contracts/run-sync-get-dataset-items?token=<YOUR_API_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"maxItems": 100}'
```

```python
from apify_client import ApifyClient

client = ApifyClient("<YOUR_API_TOKEN>")
run = client.actor("br_data_hub/br-pncp-contracts").call(run_input={'maxItems': 100})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)
```

You can also schedule runs, send results to webhooks, or connect the Actor to Make, Zapier, n8n, Google Sheets and other [integrations](https://docs.apify.com/platform/integrations).

### Use it with AI agents (MCP)

This Actor is ready for AI agents: typed input and output schemas, pay-per-event pricing, limited permissions and short runs.

- **Apify MCP server:** add `https://mcp.apify.com/?tools=br_data_hub/br-pncp-contracts` to Claude, ChatGPT, Cursor, VS Code or any MCP client, and the agent can call this Actor as a tool.
- **Agent frameworks:** call it from LangChain, LlamaIndex, CrewAI or the OpenAI Agents SDK through the Apify integrations, or with the API call above.
- Results come as structured JSON with stable field names, documented in the **Output** tab.

### FAQ

#### Where does the data come from?

Official public API of PNCP (`pncp.gov.br/api/consulta`). Data and freshness follow the source; contracts signed before agencies joined PNCP may be missing. Values are as declared by each agency.

#### How much does it cost?

$0.002 per contract. Discounts follow your Apify subscription tier: Bronze 10%, Silver 20%, Gold and above 30%. See **How much does it cost?** above for examples.

#### Do I pay for errors or empty results?

No. Charged once per contract returned that matches your filters. Scanning is free.

#### Can I run it on a schedule or connect it to other tools?

Yes. Use Apify schedules to run it daily or weekly, webhooks to get notified, and integrations such as Make, Zapier, n8n and Google Sheets. Everything also works through the API.

#### Can AI agents use it?

Yes. It works as a tool in the Apify MCP server and in agent frameworks, and AI agents can pay per event. See **Use it with AI agents (MCP)**.

#### Is it legal to use this data?

The Actor reads only public, official sources and keeps personal data masked as the source publishes it. You are responsible for how you use the data, including LGPD compliance.

#### I found a bug or need a feature. What should I do?

Open an issue in the **Issues** tab. We answer within 14 days, usually much sooner.

### More Actors from BR Data Hub

| Actor | What it does |
|---|---|
| [Brazil CNPJ Lookup API (Consulta CNPJ)](https://apify.com/br_data_hub/br-cnpj-lookup) | Look up Brazilian companies by CNPJ: registration status, partners (masked CPF), activities, tax regime and sc |
| [Brazil Open Tenders API (Licitações Abertas)](https://apify.com/br_data_hub/br-pncp-open-tenders) | Find Brazilian government tenders that are open for proposals right now, from PNCP, the official national proc |
| [Brazil Municipalities & IBGE Codes (Municípios)](https://apify.com/br_data_hub/br-ibge-localities) | List Brazilian municipalities, search them by name (accents and typos tolerated) or resolve IBGE codes |
| [Brazil Holidays & Business Days (Feriados)](https://apify.com/br_data_hub/br-holidays) | Brazilian national and state holidays for all 27 states, with the law behind each one |
| [Brazil Banks & Pix Directory (Bancos e ISPB)](https://apify.com/br_data_hub/br-bank-pix-directory) | Every Brazilian bank and payment institution from official Banco Central lists: ISPB, COMPE bank code, short a |
| [Brazil Boleto Validator & Parser (Boleto)](https://apify.com/br_data_hub/br-boleto-parser) | Validate Brazilian boletos in bulk (digitable line or barcode, bank and utility/tax slips): check digits per f |

See all our Actors at [apify.com/br_data_hub](https://apify.com/br_data_hub).

### Usar em português

**Contratos públicos do PNCP via API.** O Portal Nacional de Contratações Públicas (PNCP) é onde órgãos federais, estaduais e municipais publicam seus contratos pela Lei 14.133/2021. Este Actor lê a API oficial do PNCP e devolve cada contrato com órgão comprador, fornecedor, objeto, valores, datas e o link oficial.

**Para que serve:** inteligência de mercado em vendas para o governo (o que os concorrentes vendem, para quem e por quanto), encontrar órgãos que compram o seu produto, dimensionar mercado por UF ou objeto e alimentar agentes de IA com dados de compras públicas.

**Como usar em 3 passos:**

1. Clique em **Try for free** e escolha o período de publicação (até 31 dias; vazio = ontem).
2. Acrescente filtros: **CNPJ do fornecedor** para ver os contratos de uma empresa, **CNPJ do órgão** para um comprador, **UFs**, **palavras no objeto** e **valor mínimo**.
3. Clique em **Start** e baixe na aba **Output** (JSON, CSV, Excel) ou leia pela API.

**Exemplo de entrada:**

```json
{ "dateFrom": "2026-10-01", "dateTo": "2026-10-07", "states": ["SP"], "keywords": ["software"], "minValueBrl": 10000, "maxItems": 100 }
```

**Campos principais:** `pncpId` e `pncpUrl` (link do contrato no PNCP), `purchaseId` (compra de origem), `contractNumber`, `type`, `category`, `object` (objeto), `buyerCnpj`, `buyerName`, `buyerSphere` (esfera), `buyerUnit`, `city`, `cityIbgeCode`, `state`, `supplierType` (PJ ou PF), `supplierDocument` (CNPJ, ou CPF mascarado), `supplierName`, `initialValueBrl`, `totalValueBrl`, `signedAt`, `validFrom`, `validTo`, `publishedAt`.

**Velocidade:** o PNCP só filtra por data e por órgão. Os filtros de fornecedor, UF, palavra e valor são aplicados pelo Actor enquanto lê o período: um dia inteiro (6 a 10 mil contratos) leva cerca de 2 minutos. Com o CNPJ do órgão, a execução leva segundos.

**O que é grátis:** você paga só pelos contratos entregues. Período sem contratos que passem nos filtros, erro de entrada ou falha do PNCP não geram cobrança.

**Quanto custa:** $0.002 por resultado (`contract`); 1.000 resultados saem por $2.00. Desconto pelo nível da assinatura Apify: Bronze 10%, Silver 20%, Gold ou acima 30%. Erros e consultas sem resultado não são cobrados. Use também pela API ou por agentes de IA no servidor MCP da Apify (`https://mcp.apify.com/?tools=br_data_hub/br-pncp-contracts`).

# Actor input Schema

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

Type the first PNCP publication date as YYYY-MM-DD, e.g. 2026-10-01. Leave empty for yesterday.

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

Type the last publication date as YYYY-MM-DD. Leave empty to use the same day as 'Published from'. Up to 31 days per run.

## `buyerCnpj` (type: `string`):

Type a government agency CNPJ to get only its contracts. PNCP filters it itself, so this is the fastest option.

## `supplierCnpj` (type: `string`):

Type a company CNPJ to get only contracts it won. PNCP has no supplier filter, so the Actor scans the whole date range: keep the range short or combine with a buyer.

## `states` (type: `array`):

Enter buyer states, e.g. SP, RJ, DF, one per line. Leave empty for all.

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

Enter words to look for in the contract object, one per line, e.g. software or ambulance. A contract matching any word is kept; accents and case are ignored.

## `minValueBrl` (type: `integer`):

Set a minimum contract value in reais, e.g. 100000, to skip smaller contracts.

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

Set the maximum number of matching contracts to return, e.g. 100.

## Actor input object example

```json
{
  "dateFrom": "",
  "dateTo": "",
  "buyerCnpj": "",
  "supplierCnpj": "",
  "states": [],
  "keywords": [],
  "maxItems": 100
}
```

# Actor output Schema

## `dataset` (type: `string`):

Dataset with all results

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("br_data_hub/br-pncp-contracts").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 = {}

# Run the Actor and wait for it to finish
run = client.actor("br_data_hub/br-pncp-contracts").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 '{}' |
apify call br_data_hub/br-pncp-contracts --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,br_data_hub/br-pncp-contracts"
        }
    }
}
```

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/hBKVZxqv6hV1E4L2D/builds/bSp1CnZ0VUOJCFwdC/openapi.json
