# Licitações PNCP Brazil Tender Scraper (`vivid_astronaut/pncp-licitacoes`) Actor

Scraper for Brazilian licitações on PNCP: agency, object, value, dates and status by keyword, UF and modality. Pay per result.

- **URL**: https://apify.com/vivid\_astronaut/pncp-licitacoes.md
- **Developed by:** [BRAINIALL Team](https://apify.com/vivid_astronaut) (community)
- **Categories:** Lead generation, Automation, Other
- **Stats:** 2 total users, 1 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$1.50 / 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.

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

## Licitações PNCP Brazil Tender Scraper

**Scraper** for Brazilian public **licitações** on **PNCP** (Portal Nacional de Contratações Públicas). Collect federal and local tenders by keyword, UF, modality and date window. Each item includes agency, object, estimated value, opening and closing dates, status and source link. Built for growth teams, agencies and analysts who track government demand in Brazil without maintaining a portal-specific collector. Collection prefers the Brainiall engine and falls back to direct HTTP that honours `robots.txt`, rate limits and retries. Public procurement notices only.

### What it does

Provide a keyword (`query`), a state (`uf`), a modality, and/or a date window. The Actor reads PNCP result pages up to `pages` and stops at `limit` tenders. `dataInicial` defaults to 30 days ago and `dataFinal` defaults to today when omitted. Empty or blank pages are reported as errors (exit code 1). A valid empty search returns zero items and does not charge `result`. Local default is plan / dry-run. Live collection needs `--confirm` and runtime keys. Keys are never stored in files.

### Why this Actor

- **Tender fields, normalized.** Control id, agency, UF, municipality, object, estimated value, dates, modality, status and PNCP link in one item.
- **Filters that match how buyers search.** Keyword against the object, UF, modality name or code (`pregao_eletronico` / `6`), and an inclusive publication window.
- **Hard cap.** `limit` default 50 (cap 500). Page size follows the public consultation API (up to 50 per page).

### Input

| Field | Type | Default |
|-------|------|---------|
| `query` | string | — |
| `uf` | string | — |
| `modalidade` | string | — |
| `dataInicial` | string | 30 days ago (`YYYY-MM-DD`) |
| `dataFinal` | string | today (`YYYY-MM-DD`) |
| `limit` | integer | `50` |
| `pages` | integer | `1` |

Provide at least a keyword, UF or a date range.

```json
{
  "query": "limpeza",
  "uf": "SP",
  "modalidade": "pregao_eletronico",
  "dataInicial": "2024-03-01",
  "dataFinal": "2024-04-30",
  "limit": 50,
  "pages": 2
}
```

### Output

One dataset item per tender. Example taken from the Actor test fixtures:

```json
{
  "id": "00394452000103-1-000040/2024",
  "orgao": "MUNICIPIO DE CAMPINAS",
  "uf": "SP",
  "municipio": "Campinas",
  "objeto": "Registro de preços para serviços de limpeza predial",
  "valor_estimado": 1850000.5,
  "data_abertura": "2024-03-10T09:00:00",
  "data_encerramento": "2024-03-25T17:00:00",
  "modalidade": "Pregão - Eletrônico",
  "situacao": "Divulgada no PNCP",
  "link": "https://pncp.gov.br/app/editais/00394452000103/2024/40"
}
```

### Pricing

Pay-per-event from the Actor listing (USD):

| Event | USD |
|-------|-----|
| **result** (primary) | **$0.0012** per tender |
| **run-start** | **$0** |

Worked cost example:

- 50 tenders → **$0.06**
- 1,000 tenders → **$1.20**

Failed items are not billed. No monthly minimum.

### Use cases

1. **Bid monitoring** — watch PNCP licitações in a UF and modality for objects that match your catalog (cleaning, software, works).
2. **Demand research** — assemble a period of public tenders with agency, value and dates for a market brief.
3. **Lead lists** for agencies that sell to Brazilian municipalities and need the PNCP link on every row.

### FAQ

**Is this the official PNCP API?** The Actor collects public notices as published on PNCP. Honor `robots.txt` and the portal rate limits. Do not overload the source.

**What modality values work?** A name or a numeric code (for example `pregao_eletronico` or `6`). Unknown values are passed through as a filter.

**Can I download an entire year of Brazil in one run?** No. Cap is 500 records per run. Split by UF, keyword and date window.

### Limits

- 500 records per run.
- Page size follows the public consultation API (up to 50 per page).
- Empty or blank pages are reported as errors (exit code 1). A valid empty search returns zero items.
- Public procurement notices only. Do not use the data to harass agencies or bidders. Local default is plan/dry-run.

***

Built and maintained by [Brainiall](https://www.brainiall.com).

# Actor input Schema

## `query` (type: `string`):

Search term matched against the tender object (e.g. limpeza, software, obras).

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

Brazilian state abbreviation (e.g. SP, RJ, MG).

## `modalidade` (type: `string`):

Procurement modality name or code (e.g. pregao\_eletronico or 6).

## `dataInicial` (type: `string`):

Inclusive start of the publication window (YYYY-MM-DD). Defaults to 30 days ago.

## `dataFinal` (type: `string`):

Inclusive end of the publication window (YYYY-MM-DD). Defaults to today.

## `limit` (type: `integer`):

Maximum number of tenders to return.

## `pages` (type: `integer`):

Maximum number of result pages to read.

## Actor input object example

```json
{
  "limit": 50,
  "pages": 1
}
```

# Actor output Schema

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

All normalized items delivered by this run.

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

// Run the Actor and wait for it to finish
const run = await client.actor("vivid_astronaut/pncp-licitacoes").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("vivid_astronaut/pncp-licitacoes").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 vivid_astronaut/pncp-licitacoes --silent --output-dataset

```

## MCP server setup

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

```

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/LRnQZe3M9nPMQHGPA/builds/7xvqjXUDYqs7abtR8/openapi.json
