# Portal BASE Contract Scraper (`scrapingmonkey/portal-base-contracts-scraper`) Actor

Scrape Portal BASE contract records. Search and collect record details. Export available fields to Excel, CSV or JSON.

- **URL**: https://apify.com/scrapingmonkey/portal-base-contracts-scraper.md
- **Developed by:** [ScrapingMonkey](https://apify.com/scrapingmonkey) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 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.
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

Extract Portal BASE contract records for tender discovery, buyer research and procurement monitoring. **Portal BASE Contract Scraper** collects public information into one complete dataset table, ready to export as Excel, CSV or JSON.

Use search filters or individual public record links, set how many results you need and start the Actor. Search finds matching records; Details retrieves the available information for records you already know.

| At a glance | Details |
|---|---|
| 📥 Input | Search filters or individual public record links |
| 📋 Collection modes | Search contract records; Get contract details |
| 📤 Output | One row per record, or a failed row for an unsuccessful input |
| 📄 Pagination | Automatic, up to `maxResults` while more records are available |
| 🔐 Website login | Not required |
| 💾 Export | One dataset view with all fields; Excel, CSV and JSON |

### What the Portal BASE scraper collects 📋

| Mode | What you receive |
|---|---|
| **Search contract records** | Matching contract records and the fields published in the search results. |
| **Get contract details** | Available public information for each supplied record. The full output example below shows its actual fields. |

The field table and complete examples below show the information this Actor returns. Optional values depend on what the source publishes for the selected record.

### How to scrape Portal BASE 🚀

1. Choose **Search contract records** or **Get contract details**.
2. Complete the search filters or individual public record links.
3. Set **Maximum results**. The minimum is 1.
4. Start the Actor and review the saved dataset.
5. Export the results or connect them to your workflow.

#### Search contract records — input example

```json
{
  "mode": "search",
  "maxResults": 10
}
```

#### Get contract details — input example

```json
{
  "mode": "details",
  "recordUrls": [
    "https://www.base.gov.pt/Base4/pt/detalhe/?type=contratos&id=15706385"
  ],
  "maxResults": 1
}
```

`maxResults` limits all saved rows for each search or supplied record, including a failed row. It does not guarantee that the source has that many matching records. A detail lookup normally returns one record, although sources with multiple revisions or establishments can return more.

### Portal BASE data fields and complete output 📦

Each result stays in one row. Every returned field appears in the same dataset view, including list fields and additional published facts. Fields unavailable for a particular record remain empty.

| Field | Included data |
|---|---|
| `result_type` | Selected collection mode. |
| `input` | Submitted search settings, record link or record number. |
| `status` | Success or failed outcome. |
| `error_code` | Failure category for an unsuccessful input. |
| `error_message` | Readable explanation for an unsuccessful input. |
| `contracted` | Contracted, when published. |
| `contracting` | Contracting, when published. |
| `contracting_procedure_type` | Contracting procedure type, when published. |
| `publication_date` | Publication date, when published. |
| `ccp` | Ccp, when published. |
| `object_brief_description` | Object brief description, when published. |
| `initial_contractual_price` | Initial contractual price, when published. |
| `signing_date` | Signing date, when published. |
| `id` | Id, when published. |
| `record_id` | Stable identifier for the source record. |
| `url` | Public source link when the website provides one. |
| `additional_fields.name` | Names of additional published fields, when present. |
| `additional_fields.value` | Their corresponding values in the same order. |
| `contract_fundamentation_type` | Contract fundamentation type, when published. |
| `contracting_procedure_url` | Contracting procedure url, when published. |
| `documents.description` | Documents / description, when published. |
| `documents.id` | Documents / id, when published. |
| `direct_award_fundamentation_type` | Direct award fundamentation type, when published. |
| `announcement_id` | Announcement id, when published. |
| `total_effective_price` | Total effective price, when published. |
| `contestants.nif` | Contestants / nif, when published. |
| `contestants.description` | Contestants / description, when published. |
| `contestants.id` | Contestants / id, when published. |
| `invitees` | Invitees, when published. |
| `observations` | Observations, when published. |
| `ambient_criteria` | Ambient criteria, when published. |
| `end_of_contract_type` | End of contract type, when published. |
| `causes_deadline_change` | Causes deadline change, when published. |
| `causes_price_change` | Causes price change, when published. |
| `increments` | Increments, when published. |
| `framework_agreement_procedure_id` | Framework agreement procedure id, when published. |
| `framework_agreement_procedure_description` | Framework agreement procedure description, when published. |
| `close_date` | Close date, when published. |
| `contracted.nif` | Contracted / nif, when published. |
| `contracted.description` | Contracted / description, when published. |
| `contracted.id` | Contracted / id, when published. |
| `cocontratantes` | Cocontratantes, when published. |
| `aquisition_state_member_ue` | Aquisition state member ue, when published. |
| `info_aquisition_state_member_ue` | Info aquisition state member ue, when published. |
| `normal` | Normal, when published. |
| `special_measures` | Special measures, when published. |
| `contracting.nif` | Contracting / nif, when published. |
| `contracting.description` | Contracting / description, when published. |
| `contracting.id` | Contracting / id, when published. |
| `execution_place` | Execution place, when published. |
| `material_criteria` | Material criteria, when published. |
| `execution_deadline` | Execution deadline, when published. |
| `centralized_procedure` | Centralized procedure, when published. |
| `contract_types` | Contract types, when published. |
| `cpvs` | Cpvs, when published. |
| `non_written_contract_justification_types` | Non written contract justification types, when published. |
| `contract_type_cs` | Contract type cs, when published. |
| `income` | Income, when published. |
| `contract_status` | Contract status, when published. |
| `group_members` | Group members, when published. |
| `regime` | Regime, when published. |
| `cpvs_type` | Cpvs type, when published. |
| `cpvs_designation` | Cpvs designation, when published. |
| `cpvs_value` | Cpvs value, when published. |
| `description` | Description, when published. |

The complete result below is included for every mode. Text and lists are not shortened. These are examples from validation runs; the source can change.

#### Search contract records — complete JSON result

```json
{
  "result_type": "search",
  "input": "{\"keywords\": null}",
  "contracted": "Viagens Abreu, S.A.",
  "contracting": "Universidade de Coimbra",
  "contracting_procedure_type": "Ao abrigo de acordo-quadro (art.º 259.º)",
  "publication_date": "29-09-2026",
  "ccp": false,
  "object_brief_description": "26Y00544 - Aquisição de viagem aérea Porto/Salzburgo/Porto para trabalhador(a) UC, de 04 a 08/10/2026, para participação e apresentação de uma comunicação no \"96th Séminaire Lotharingien de Combinatoi...",
  "initial_contractual_price": "540,01 €",
  "signing_date": "16-09-2026",
  "id": 15708466,
  "status": "success",
  "record_id": "15708466",
  "url": "https://www.base.gov.pt/Base4/pt/detalhe/?type=contratos&id=15708466",
  "additional_fields.name": [],
  "additional_fields.value": []
}
```

#### Get contract details — complete JSON result

```json
{
  "result_type": "details",
  "input": "https://www.base.gov.pt/Base4/pt/detalhe/?type=contratos&id=15706385",
  "contract_fundamentation_type": "Artigo 20.º, n.º 1, alínea a) do Código dos Contratos Públicos",
  "contracting_procedure_url": "https://www.acingov.pt/acingovprod/2/zonaPublica/zona_publica_c/donwloadProcedurePiece/MTA5MDg1NQ",
  "documents.description": [
    "Contrato 286_2026 Lote 7.pdf"
  ],
  "documents.id": [
    2631307
  ],
  "direct_award_fundamentation_type": "Não aplicável",
  "announcement_id": 444746,
  "total_effective_price": null,
  "contestants.nif": [
    "507367260",
    "-",
    "501547282",
    "501299254",
    "500572739",
    "502139498",
    "507514424",
    "500292540",
    "500548625",
    "517378264",
    "505424398",
    "500573115",
    "506325393",
    "503176605"
  ],
  "contestants.description": [
    "VTC - Viagens e Turismo Castrense, Lda.",
    "António Lopes do Vale",
    "Associação de Solidariedade Social, Cultural e Recreativa Coutoense",
    "Associação de Solidariedade Social de Farminhão - ASSF",
    "MARTINS & MARTINS, LDA",
    "Centro Soc. da Paroquia de Torredeita",
    "Sousitaxi Unipessoal, Lda",
    "UNIÃO DE SÁTÃO&AGUIAR DA BEIRA, LDA",
    "Taxisilva, Lda",
    "Mobinst, Unipessoal Lda",
    "Autotaxi Mário & Rebelo",
    "António de Almeida Marques & Filhos, Lda",
    "Táxis Grão Vasco, Lda.",
    "Ass.Solid. Social  as Costureirinhas de Cavernães"
  ],
  "contestants.id": [
    242578,
    26526,
    3940669,
    259254,
    154862,
    632602,
    974941,
    688,
    1084468,
    5046729,
    4055964,
    2166,
    4035431,
    101111
  ],
  "invitees": [],
  "observations": null,
  "publication_date": "29-09-2026",
  "ccp": false,
  "ambient_criteria": false,
  "end_of_contract_type": null,
  "causes_deadline_change": null,
  "causes_price_change": null,
  "increments": false,
  "framework_agreement_procedure_id": "Não aplicável.",
  "framework_agreement_procedure_description": "Não aplicável.",
  "close_date": null,
  "contracted.nif": [
    "502139498"
  ],
  "contracted.description": [
    "Centro Soc. da Paroquia de Torredeita"
  ],
  "contracted.id": [
    632602
  ],
  "cocontratantes": false,
  "aquisition_state_member_ue": false,
  "info_aquisition_state_member_ue": null,
  "normal": true,
  "special_measures": null,
  "contracting.nif": [
    "506697320"
  ],
  "contracting.description": [
    "Município de Viseu"
  ],
  "contracting.id": [
    1241
  ],
  "execution_place": "Portugal, Viseu, Viseu",
  "material_criteria": false,
  "execution_deadline": "320 dias",
  "centralized_procedure": false,
  "contract_types": "Aquisição de serviços",
  "cpvs": "60130000-8",
  "contracting_procedure_type": "Concurso público",
  "object_brief_description": "PAQ 131/2026 - Prestação de Serviços de Transportes de Alunos em Circuitos Especiais, e de Alunos de Educação Inclusiva e com dificuldades de locomoção, para o ano letivo 2026-2027 - EDOC/2026/34316",
  "non_written_contract_justification_types": "",
  "contract_type_cs": false,
  "income": false,
  "contract_status": null,
  "initial_contractual_price": "25.080,00 €",
  "group_members": null,
  "signing_date": "10-09-2026",
  "regime": "Código dos Contratos Públicos (DL111-B/2017) e Lei n.º 30/2021, de 21.05",
  "cpvs_type": "Principal",
  "cpvs_designation": "Serviços de transporte rodoviário de passageiros com finalidade específica",
  "cpvs_value": "25080.0 € ",
  "description": "PAQ 131/2026 - Prestação de Serviços de Transportes de Alunos em Circuitos Especiais, e de Alunos de Educação Inclusiva e com dificuldades de locomoção, para o ano letivo 2026-2027 - EDOC/2026/34316",
  "id": 15706385,
  "status": "success",
  "record_id": "15706385",
  "url": "https://www.base.gov.pt/Base4/pt/detalhe/?type=contratos&id=15706385",
  "additional_fields.name": [],
  "additional_fields.value": []
}
```

### Input settings ⚙️

| Setting | What to enter |
|---|---|
| **What to collect** (`mode`) | Choose the information you need. |
| **Maximum results per search or link** (`maxResults`) | Collect up to this many saved results for each search or record link. Minimum: 1. |
| **Keywords** (`keywords`) | Words to search for in public contract records. Leave empty to browse all available results. |
| **Contract links** (`recordUrls`) | Paste one individual public record link per line. Use this field in Details mode. |

### Portal BASE scraping use cases 🎯

#### Build a tender or contract shortlist

Search the supported procurement collection and export matching records. Keep deadlines, buyer names and original references together when reviewing opportunities.

#### Research public buyers

Compare available buyer, supplier and contract information across records. Preserve the published currency and value type when working with amounts.

#### Monitor published procurement records

Schedule repeated exports and compare stable record IDs to identify newly published notices and changes. A search result is not confirmation that bidding remains open.

### Pricing and saved-result behavior 💰

See the Actor’s **Pricing** tab for the current rate. Under dataset-item pricing:

- Each saved record is one result. Lists and additional details attached to it do not create extra rows.
- A saved `failed` row is also one billable dataset item. This includes invalid inputs, unavailable records, empty searches and exhausted retries.
- At most one failed row is saved per input. Retry attempts do not create additional dataset rows.
- `maxResults` caps all saved rows for the input. Duplicate copies of the same input are processed once.

### Portal BASE scraper API and integrations 🔌

Replace `$ACTOR_ID` with the ID shown in the Actor’s API tab and `$APIFY_TOKEN` with your Apify token.

```bash
curl -X POST "https://api.apify.com/v2/acts/$ACTOR_ID/runs?token=$APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"mode":"search","maxResults":10}'
```

Use Apify schedules for recurring collection, webhooks for completion notifications, and integrations for Google Sheets, Make, Zapier, cloud storage or your own application.

### Reliability and public-data limits ⚠️

Temporary request failures are retried up to five total attempts. Invalid record inputs save a failed row without a website request. Confirmed missing records are not retried unnecessarily. If a later request fails, records already saved remain in the dataset. Normal pagination completion does not add a failed row. Collection stops after two consecutive pages return no new records. Configuration, data-saving or request-scheduling failures stop the run.

Portal BASE controls the available records and fields. Search records can contain less information than a full public card. The Actor preserves published values and does not fill missing facts with estimates.

### Frequently asked questions ❓

#### Do I need a Portal BASE account?

No. This Actor collects the supported public information without your website login.

#### Which search filters can I use?

The input form supports keywords. Only the displayed filters are supported.

#### How many records can I collect?

Set `maxResults` to the maximum saved rows you want for each input. The minimum is 1. Collection can finish earlier when the source runs out of results or stops returning new records.

#### Why are some fields empty?

The source may not publish a value for that record or mode. Optional information remains empty.

#### Can I export all the fields?

Yes. All returned fields are included in one dataset view. Nested lists remain attached to their parent record.

### Support 🛟

For a reproducible issue, share the run ID, selected mode and a safe public example through the Actor’s support channel. Keep tokens, passwords and proxy credentials private.

# Actor input Schema

## `mode` (type: `string`):

Choose the information you need.

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

Collect up to this many saved results for each search or record link. Minimum: 1.

## `keywords` (type: `string`):

Words to search for in public contract records. Leave empty to browse all available results.

## `recordUrls` (type: `array`):

Paste one individual public record link per line. Use this field in Details mode.

## Actor input object example

```json
{
  "mode": "search",
  "maxResults": 10,
  "recordUrls": [
    "https://www.base.gov.pt/Base4/pt/detalhe/?type=contratos&id=15706385"
  ]
}
```

# Actor output Schema

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

Results and failed input outcomes, with all returned fields.

# 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 = {
    "mode": "search",
    "maxResults": 10,
    "recordUrls": [
        "https://www.base.gov.pt/Base4/pt/detalhe/?type=contratos&id=15706385"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("scrapingmonkey/portal-base-contracts-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 = {
    "mode": "search",
    "maxResults": 10,
    "recordUrls": ["https://www.base.gov.pt/Base4/pt/detalhe/?type=contratos&id=15706385"],
}

# Run the Actor and wait for it to finish
run = client.actor("scrapingmonkey/portal-base-contracts-scraper").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 '{
  "mode": "search",
  "maxResults": 10,
  "recordUrls": [
    "https://www.base.gov.pt/Base4/pt/detalhe/?type=contratos&id=15706385"
  ]
}' |
apify call scrapingmonkey/portal-base-contracts-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,scrapingmonkey/portal-base-contracts-scraper"
        }
    }
}
```

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/Qscb1pVsgEdjdnfVk/builds/DwWDOGpfFZfBQkdM3/openapi.json
