# Diário Oficial Monitor: DOU, Estados e Municípios (`allanmxr/brazil-official-gazettes`) Actor

Search and monitor Brazil's official gazettes: federal DOU, São Paulo state DOE-SP and ~380 municipal gazettes (Querido Diário). Tenders, contracts and any keyword, with excerpt, agency and links. Monitor mode returns only new hits. No login or API key.

- **URL**: https://apify.com/allanmxr/brazil-official-gazettes.md
- **Developed by:** [Allan Marcelino](https://apify.com/allanmxr) (community)
- **Categories:** Lead generation, News, Business
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 1,000 gazette hits

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?

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 Official Gazettes Monitor: DOU, State and Municipal

Search and monitor **Brazil's official gazettes** in one run: the federal **Diário Oficial da União (DOU)**, the **São Paulo state gazette (DOE-SP)** and the **municipal gazettes** of about 380 cities through Querido Diário. One flat dataset with the act title, excerpt, agency, edition, page and link, the same fields from every source.

**Em português:** busque e monitore **diários oficiais** por palavra-chave: **Diário Oficial da União (DOU)**, **Diário Oficial do Estado de São Paulo (DOE-SP)** e **diários municipais** (Querido Diário). Ideal para acompanhar licitações, pregões, contratos, nomeações, editais e qualquer termo. No **modo monitor**, cada execução devolve só o que é novo desde a última vez.

No login, no API key and no proxy needed for normal use.

### What you get

- **Three gazette families, one schema.** Federal, state (São Paulo) and municipal hits with identical fields, so they fit one table.
- **Monitor mode.** Schedule the Actor daily; each run returns only hits not seen before and you pay only for those.
- **Excerpts around the keyword**, agency and agency hierarchy, edition, page, act type and a direct link (act page, or the gazette PDF for municipal gazettes).
- **Filters:** period, states, municipalities (by name or IBGE code), DOU sections and DOU agency.
- **Several keywords per run.** Each hit says which keyword found it, and the same gazette is never returned twice.
- **Privacy by design.** CPF numbers, formatted or as 11 bare digits, are masked as `***.***.***-**` in titles and excerpts; other 11-digit numbers such as mobile phones are masked too. Names in the acts are kept. No person fields are collected.

### Use cases

- **Tender and procurement monitoring**: pregão eletrônico, dispensa de licitação, ata de registro de preços, concorrência
- Following **contracts, suppliers and public spending** of an agency or a city
- Tracking **appointments, dismissals and regulations** by keyword
- Compliance, legal and **competitive intelligence** alerts on a schedule
- Journalism and research datasets from official publications

### Como monitorar o Diário Oficial da União

Informe as palavras-chave, deixe só `dou` em `sources`, escolha as seções (`do1`, `do2`, `do3`, `doe`) e, se quiser, o órgão em `douAgency` (por exemplo `Ministério da Educação`). Ative `monitorMode` e agende a execução todo dia: cada run devolve só as publicações novas.

### Buscar licitações em diários municipais

Use `querido_diario` com `states` (por exemplo `SP`) ou `municipalities` (`Barueri/SP` ou o código IBGE de 7 dígitos) e uma palavra-chave como `pregão eletrônico` ou `dispensa de licitação`. A cobertura é de cerca de 380 municípios, veja as notas abaixo.

### Diário Oficial do Estado de São Paulo

Marque `doe_sp` para buscar nas publicações do DOE-SP (Executivo, Legislativo, Municípios, Empresarial e Jucesp) desde 29/05/2023. A busca do DOE-SP é sensível a acentos: digite a palavra como ela é publicada.

### Input

| Field | Description |
|---|---|
| `keywords` | Required. Words or phrases; one search each. |
| `exactPhrase` | Default on. Wraps each keyword in quotes for DOU and Querido Diário. DOE-SP always receives the keyword as typed. |
| `sources` | Any of `dou`, `querido_diario`, `doe_sp` (all three by default). The `maxItems` budget is shared equally; a source that runs dry hands its share to the others. |
| `dateFrom`, `dateTo` | Publication period, as `yyyy-mm-dd` or a relative value such as `7 days`. Empty means today and the 7 days before it (8 days). Relative values use the Apify format: `7 days`, `2 weeks`, `1 month`. |
| `states` | Restricts Querido Diário to the cities of these states. DOE-SP only runs when the list is empty or contains `SP`. Does not filter the DOU. |
| `municipalities` | Querido Diário only: `Name/UF` (for example `Barueri/SP`) or a 7-digit IBGE code. A name without UF that matches several cities fails the run and lists the options. |
| `douSections` | `do1`, `do2`, `do3`, `doe`. Empty means all sections. |
| `douAgency` | Main DOU agency, exactly as the portal lists it. |
| `excerptsPerGazette` | 1 to 5 excerpts per gazette (Querido Diário), default 3. |
| `monitorMode` | Return only hits not seen in earlier runs. |
| `monitorName` | Names the saved state. Empty derives it from the search settings. |
| `monitorFirstRunDays` | Days back on the first monitor run, default 3. Ignored when `dateFrom` is set. |
| `maxItems` | Total hits across all sources, default 100. |
| `proxyConfiguration` | Optional. By default the Actor starts without a proxy and climbs to datacenter and then Brazilian residential proxies only if a portal blocks it. |

#### Example input

```json
{
    "keywords": ["pregão eletrônico", "ata de registro de preços"],
    "sources": ["dou", "querido_diario"],
    "dateFrom": "7 days",
    "states": ["SP"],
    "douSections": ["do3"],
    "maxItems": 500
}
```

### Output

One flat item per hit. Fields a source does not have are `null`.

```json
{
    "id": "dou:744921082",
    "source": "dou",
    "sphere": "federal",
    "publicationDate": "2026-11-17",
    "matchedKeyword": "pregão eletrônico",
    "title": "EXTRATO DE REGISTRO DE PREÇOS",
    "excerpt": "ATA DE REGISTRO DE PREÇOS Nº010.2026/SEMSA - PREGÃO ELETRÔNICO SRP Nº 9.2026 ...",
    "excerpts": ["ATA DE REGISTRO DE PREÇOS Nº010.2026/SEMSA - PREGÃO ELETRÔNICO SRP Nº 9.2026 ..."],
    "url": "https://www.in.gov.br/web/dou/-/extrato-de-registro-de-precos-744921080",
    "pdfUrl": null,
    "textUrl": null,
    "indexedAt": null,
    "section": "DO3",
    "edition": "216",
    "isExtraEdition": false,
    "page": "262",
    "actType": "Extrato da Ata",
    "agency": "Prefeitura Municipal de Óbidos",
    "agencyPath": ["Prefeituras", "Estado do Pará", "Prefeitura Municipal de Óbidos"],
    "state": null,
    "territoryId": null,
    "territoryName": "Brasil",
    "scrapedAt": "2026-11-19T01:05:37.355834+00:00"
}
```

Field notes:

- `id` is `<source>:<sourceId>`. Querido Diário has no id of its own, so it is `territoryId/date/<file hash>`.
- `excerpt` is the first of `excerpts`, with HTML removed and whitespace collapsed.
- `url` is the act page for DOU and DOE-SP and the gazette PDF for Querido Diário (also in `pdfUrl`, with the full text in `textUrl`).
- A Querido Diário hit is a whole gazette edition (one PDF), not a single act: the title is generated by the Actor, there is no agency, page or act type, and one `gazette-hit` is charged per edition.
- `section` is the DOU section (`DO1`, `DO2`, `DO3`, `DO1_EXTRA_A`...) or the DOE-SP journal (`Executivo`, `Legislativo`...). `isExtraEdition` is set for the DOU and Querido Diário.
- DOE-SP hits have `state` `SP`, `territoryId` `35` and `territoryName` `São Paulo`. DOU hits have `territoryName` `Brasil`.
- `indexedAt` is when Querido Diário scraped the gazette.

### Monitor mode

Turn on `monitorMode` and schedule the Actor. The first run looks `monitorFirstRunDays` back (or from `dateFrom`). Later runs continue from where the previous one stopped. `dateTo` is ignored in monitor mode, and `dateFrom` only applies until the first complete read. The state lives in the named key-value store `brazil-official-gazettes-monitor`; runs with the same settings (or the same `monitorName`) share it. The state is saved after every delivered batch, and only hits that were actually delivered are marked as seen, so what did not fit in `maxItems` comes in the next run. A source that stopped because of `maxItems` keeps its old starting point and is read again from there next time.

### Coverage and limits (read this)

- **DOU:** the whole federal gazette, all sections and extra editions, no result cap found (10,750 hits were read in a single search during tests).
- **Municipal gazettes:** Querido Diário covers only about **384 active municipalities**, not all 5,570. A city that is not covered returns nothing. The city list (5,570 entries) includes cities that are not yet collected, so a valid `Name/UF` can still return zero hits.
- **DOE-SP:** São Paulo state only, publications from **29 May 2023**. Other states' gazettes are not covered. The search is accent-sensitive.
- Municipal results arrive when Querido Diário has collected and indexed the PDF, which can be a day or more after publication.
- Querido Diário is a volunteer service and can be slow: pages have 100 gazettes, and a source that does not answer a page within 45 seconds is dropped and shows as `timed out` in the status message and in the `RUN_SUMMARY` record. The other sources keep delivering and take its share.

### FAQ

**Do I need a proxy?** No. The Actor starts direct with browser-grade TLS and only climbs to Apify datacenter and Brazilian residential proxies if a portal blocks it.

**Does it collect personal data?** No person fields. CPF numbers that appear in titles and excerpts are masked.

**Why did a source return nothing?** Check the period, the keyword spelling (DOE-SP is accent-sensitive) and, for municipal gazettes, whether the city is covered. The status message and `RUN_SUMMARY` say which sources finished or failed.

**Can I search other states' gazettes?** Not directly. Querido Diário covers municipalities of many states, but state gazettes other than São Paulo's are not included.

### Pricing

Pay per event: event `gazette-hit`, charged for each hit written to the dataset. Platform usage (compute and proxy) is included.

### Notes

This Actor only reads publicly available official gazettes. You are responsible for using the data in line with Brazilian data protection law (LGPD).

### Other Actors by the same author

- [Brazil Public Tenders Scraper](https://apify.com/allanmxr/brazil-public-tenders)
- [Brazil Real Estate Scraper](https://apify.com/allanmxr/brazil-real-estate-scraper)
- [Brazil Real Estate Auctions Scraper](https://apify.com/allanmxr/brazil-real-estate-auctions)
- [Brazil Vehicle Auctions Scraper](https://apify.com/allanmxr/brazil-vehicle-auctions-scraper)

# Actor input Schema

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

Words or phrases to look for in the gazettes. One search per keyword; the same gazette never appears twice.

## `exactPhrase` (type: `boolean`):

Match each keyword as a whole phrase. DOE-SP has no phrase syntax and always receives the keyword as typed.

## `sources` (type: `array`):

Gazettes to search. The item budget (Max items) is shared equally between them.

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

First publication date, as yyyy-mm-dd or a relative value such as 7 days. Leave empty for today and the 7 days before it (the first-run period in monitor mode). In monitor mode it only applies until the first complete read.

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

Last publication date. Leave empty for today. Ignored in monitor mode.

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

Restricts Querido Diário to the cities of these states. DOE-SP only runs when this is empty or includes SP. It does not filter the DOU.

## `municipalities` (type: `array`):

Querido Diário only. Use Name/UF (for example Barueri/SP) or the 7-digit IBGE code. When set, the states filter is ignored there.

## `douSections` (type: `array`):

Empty means every section.

## `douAgency` (type: `string`):

Main agency exactly as the DOU lists it, for example Ministério da Educação.

## `excerptsPerGazette` (type: `integer`):

Querido Diário only: how many text excerpts around the keyword to return for each gazette.

## `monitorMode` (type: `boolean`):

Returns only gazettes not seen in earlier runs with the same monitor. Schedule the Actor daily and every run pays only for what is new.

## `monitorName` (type: `string`):

Names the saved state. Leave empty to derive it from the search settings.

## `monitorFirstRunDays` (type: `integer`):

How many days back the first monitor run looks. Ignored when Published from is set.

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

Total gazette hits across all sources. This is also the most you can be charged for.

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

Optional. By default the Actor starts without a proxy and climbs to Apify datacenter, then Brazilian residential proxies, only when a portal blocks it.

## Actor input object example

```json
{
  "keywords": [
    "pregão eletrônico"
  ],
  "exactPhrase": true,
  "sources": [
    "dou",
    "querido_diario",
    "doe_sp"
  ],
  "excerptsPerGazette": 3,
  "monitorMode": false,
  "monitorFirstRunDays": 3,
  "maxItems": 50
}
```

# Actor output Schema

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

All gazette hits in the default dataset.

# 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 = {
    "keywords": [
        "pregão eletrônico"
    ],
    "sources": [
        "dou",
        "querido_diario",
        "doe_sp"
    ],
    "maxItems": 50
};

// Run the Actor and wait for it to finish
const run = await client.actor("allanmxr/brazil-official-gazettes").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 = {
    "keywords": ["pregão eletrônico"],
    "sources": [
        "dou",
        "querido_diario",
        "doe_sp",
    ],
    "maxItems": 50,
}

# Run the Actor and wait for it to finish
run = client.actor("allanmxr/brazil-official-gazettes").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 '{
  "keywords": [
    "pregão eletrônico"
  ],
  "sources": [
    "dou",
    "querido_diario",
    "doe_sp"
  ],
  "maxItems": 50
}' |
apify call allanmxr/brazil-official-gazettes --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,allanmxr/brazil-official-gazettes"
        }
    }
}
```

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/fUxI3MdgcBRdYjEqU/builds/iy2gH1KeecwuZgfui/openapi.json
