# Diários Oficiais Municipais: Busca Unificada (Querido Diário) (`scrapewise/diarios-municipais-busca`) Actor

Search official gazette excerpts across thousands of Brazilian municipalities by term, city and date via the public Querido Diário API.

- **URL**: https://apify.com/scrapewise/diarios-municipais-busca.md
- **Developed by:** [Scrapewise Data](https://apify.com/scrapewise) (community)
- **Stats:** 2 total users, 1 monthly users, 60.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.28 / 1,000 gazette match delivereds

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?

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

## Diários Municipais Busca

Full-text search results from official gazettes of thousands of Brazilian municipalities via the public Querido Diário API, for anyone who needs to monitor more than one city at once.

**Use cases**

- A law firm with clients across multiple states monitors mentions of company names in every municipal gazette at once.
- A journalist investigating a topic searches for a term across all covered cities in a state.
- A company with branches in many municipalities tracks local ordinances and appointments that affect it.

**Example input**

```json
{
  "termos": "dispensa de licitação",
  "territorioIds": "4106902",
  "dataInicial": "2026-08-01",
  "dataFinal": "2026-09-04",
  "maxItems": 100
}
```

**Example output**

Real run on 11/09/2026 with `"termos": "nomeação CPF"` (3 rows, `trecho` shortened, `coletado_em` and `url_origem` omitted):

```json
{"cidade": "Joanópolis", "data": "2026-08-14", "trecho": "Municipal, Considerando o Proc. Administrativo 2.621/2026 do sistema 1doc; RESOLVE: Art. 1º Exonerar, a partir desta data, a Sra. MARIANGELA BARBOSA ALVES AISAKA, brasileira, maior, portadora do CPF nº ***.***.***-**, do Cargo Político de SE...", "pdf_url": "https://data.queridodiario.ok.org.br/3525508/2026-08-14/d44a749dff39fb6510b95b2af5d91d5f9fb92630.pdf"}
{"cidade": "Tanque d'Arca", "data": "2026-08-28", "trecho": "designação e nomeação de Gestores Escolares no âmbito da Rede Municipal de Ensino de Tanque d'Arca/AL. ONSIDERANDO o resultado final do Processo Seletivo Público para Gestores Escolares da Rede Municipal de Ensino de Tanque d'Arca/AL, reali...", "pdf_url": "https://data.queridodiario.ok.org.br/2700000/2026-08-28/9c698d867e9339d6d38c56d8f5ae388662311a4a.pdf"}
{"cidade": "Senhor do Bonfim", "data": "2026-08-21", "trecho": "PREFEITURA MUNICIPAL DE SENHOR DO BONFIM - BAHIA GABINETE DO PREFEITO Decreto 479/2026. de 20 de agosto de 2026. \"Dispõe sobre...", "pdf_url": "https://data.queridodiario.ok.org.br/2930105/2026-08-21/acf2ab44f067c5be09ad21bc1af24ea9f1c4261e.pdf"}
```

`trecho` is the excerpt of the gazette that best matches your terms, cleaned of PDF bullets. Brazilian taxpayer numbers of individuals (CPF) are always masked as `***.***.***-**`.

**Price:** US$ 1.50 per 1,000 results, no monthly fee.

**How to use**

- Via API: call the Actor's `run-sync-get-dataset-items` endpoint with your input JSON.
- Via schedule: run daily or weekly to keep a rolling alert across all the cities you operate in.
- Via integration: connect through n8n, Make or Zapier's native Apify nodes to push matches into Slack or a spreadsheet.

**Limitations**

- Coverage depends on which municipalities Querido Diário has indexed; not every Brazilian city is covered yet.
- For some large cities the search index only exposes the gazette's table of contents as the excerpt; open `pdf_url` for the full act.
- The Querido Diário API is run by a non-profit and sometimes answers 503; the Actor retries, and if the API stays down it ends with a status message saying so and charges only for the results already delivered. Open an issue if a run fails or the API schema changes.

This Actor collects only publicly available government gazette data and respects the site's terms of service.

### Em português

Busca termo em diários oficiais de milhares de municípios brasileiros de uma vez, via API pública do Querido Diário, devolvendo cidade, data, trecho e link do PDF. Serve para escritório de advocacia com clientes em várias cidades, jornalista investigativo, ou empresa com filiais em várias cidades. Preço: US$ 1,50 por 1.000 resultados, sem mensalidade.

# Actor input Schema

## `termos` (type: `string`):

e.g. 'pregão presencial' or a person/company name.

## `territorioIds` (type: `string`):

Comma-separated 7-digit IBGE codes to restrict the search to specific cities. Leave empty to search all covered municipalities.

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

Defaults to 30 days before today if empty.

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

Defaults to today if empty.

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

Maximum number of results to return.

## Actor input object example

```json
{
  "termos": "licitação",
  "maxItems": 30
}
```

# Actor output Schema

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

No description

## `resultsCsv` (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 = {
    "termos": "licitação"
};

// Run the Actor and wait for it to finish
const run = await client.actor("scrapewise/diarios-municipais-busca").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 = { "termos": "licitação" }

# Run the Actor and wait for it to finish
run = client.actor("scrapewise/diarios-municipais-busca").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 '{
  "termos": "licitação"
}' |
apify call scrapewise/diarios-municipais-busca --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,scrapewise/diarios-municipais-busca"
        }
    }
}
```

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/IWVwrjcaBgvAtLhhY/builds/owfQ5mVUhLZi2JYZ9/openapi.json
