{
  "openapi": "3.0.1",
  "info": {
    "title": "Portugal Public Contracts & Tenders (BASE)",
    "description": "Structured, filterable Portuguese public procurement data (contracts, tender announcements, contract modifications) from the official IMPIC / Portal BASE open data on dados.gov.pt. Weekly refresh. Unofficial.",
    "version": "0.1",
    "x-build-id": "SG5lmdZiGZxZ5pKDY"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/goncalocalvo~portugal-public-contracts-base/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-goncalocalvo-portugal-public-contracts-base",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/acts/goncalocalvo~portugal-public-contracts-base/runs": {
      "post": {
        "operationId": "runs-sync-goncalocalvo-portugal-public-contracts-base",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor and returns information about the initiated run in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/runsResponseSchema"
                }
              }
            }
          }
        }
      }
    },
    "/acts/goncalocalvo~portugal-public-contracts-base/run-sync": {
      "post": {
        "operationId": "run-sync-goncalocalvo-portugal-public-contracts-base",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "inputSchema": {
        "type": "object",
        "properties": {
          "datasetType": {
            "title": "Dataset",
            "enum": [
              "contracts",
              "announcements",
              "modifications"
            ],
            "type": "string",
            "description": "Which dataset to query. 'contracts' = awarded/signed contracts with buyer, awardee, value, CPV and location. 'announcements' = tender notices published in Diário da República, with deadline and base price. 'modifications' = amendments to existing contracts (new price, new duration, reason).",
            "default": "contracts"
          },
          "dateFrom": {
            "title": "Published from",
            "type": "string",
            "description": "Earliest publication date, format YYYY-MM-DD. Default: 30 days before 'Published to'. Data older than 10 years before today is not served; an older date is moved forward automatically."
          },
          "dateTo": {
            "title": "Published to",
            "type": "string",
            "description": "Latest publication date, format YYYY-MM-DD. Default: today. The data is a weekly snapshot, so the most recent days may not be available yet; check 'snapshot_date' in the output."
          },
          "cpvPrefixes": {
            "title": "CPV code prefixes",
            "type": "array",
            "description": "Keep records whose CPV code starts with any of these prefixes (2 to 8 digits). Examples: '72' = IT services, '45' = construction works, '33' = medical equipment, '79' = business services, '09' = fuels. Leave empty for all CPVs.",
            "items": {
              "type": "string"
            }
          },
          "keywords": {
            "title": "Keywords (Portuguese)",
            "type": "array",
            "description": "Keep records whose object or description contains ANY of these words or phrases. Matching ignores case and accents ('reabilitacao' matches 'Reabilitação'). Use Portuguese terms, e.g. 'software', 'limpeza', 'empreitada'. Leave empty for no keyword filter.",
            "items": {
              "type": "string"
            }
          },
          "district": {
            "title": "District",
            "type": "string",
            "description": "District of the place of execution as written in BASE, e.g. 'Lisboa', 'Porto', 'Faro'. Case and accents are ignored. Works for 'contracts' and 'modifications' only: the announcements dataset has no location field, and the run returns an error item if this is set together with 'announcements'."
          },
          "municipality": {
            "title": "Municipality",
            "type": "string",
            "description": "Municipality (concelho) of the place of execution, e.g. 'Loulé', 'Vila Nova de Gaia'. Case and accents are ignored. Works for 'contracts' and 'modifications' only (same restriction as 'district')."
          },
          "minValue": {
            "title": "Minimum value (EUR)",
            "minimum": 0,
            "type": "number",
            "description": "Minimum value in euros, without VAT. Applies to the contract price (contracts), the base price (announcements) or the new price (modifications). Records with no value are excluded when this is set."
          },
          "maxValue": {
            "title": "Maximum value (EUR)",
            "minimum": 0,
            "type": "number",
            "description": "Maximum value in euros, without VAT. Same field as 'Minimum value'. Records with no value are excluded when this is set."
          },
          "contractingAuthority": {
            "title": "Contracting authority",
            "type": "string",
            "description": "Public buyer to filter by: either its 9-digit tax number (NIF/NIPC, exact match, e.g. '600000010') or part of its name (case and accents ignored, e.g. 'Câmara Municipal de Almada')."
          },
          "maxItems": {
            "title": "Maximum items",
            "minimum": 1,
            "maximum": 50000,
            "type": "integer",
            "description": "Maximum number of records to return (1 to 50,000). Newest publication dates come first. Each returned record is one paid 'record' event, so this also caps the cost of the run. In monitor mode use a high value (1000 or more): a truncated monitor run repeats the same records next time.",
            "default": 100
          },
          "includeBidders": {
            "title": "Include bidders",
            "type": "boolean",
            "description": "Contracts only. If true, each contract includes a 'bidders' list (tax number and name of the entities that submitted a bid). Bidders that cannot be identified as companies or public bodies are redacted. If false, only 'bidders_count' is returned.",
            "default": false
          },
          "monitor": {
            "title": "Monitor mode (only new records)",
            "type": "boolean",
            "description": "If true, return only records that first appeared in a data snapshot newer than your previous monitor run with the same monitor name. The first run returns the normal results and sets the baseline. The source is refreshed weekly, so running this more often than weekly mostly returns a single 'no_results' item. Important: if 'maxItems' or your maximum charge limit cuts a monitor run short, the state does not advance and the next run returns, and charges, the same records again; use maxItems of 1000 or more for monitor runs. State (only the last snapshot date) is stored in your own key-value store 'base-pt-monitor-state'.",
            "default": false
          },
          "monitorKey": {
            "title": "Monitor name",
            "type": "string",
            "description": "Optional name that identifies this monitor (letters, digits, '-' and '_', up to 60 characters). Use different names to keep independent monitors. Default: derived automatically from the dataset and filters."
          }
        }
      },
      "runsResponseSchema": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "actId": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              },
              "startedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "finishedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "status": {
                "type": "string",
                "example": "READY"
              },
              "meta": {
                "type": "object",
                "properties": {
                  "origin": {
                    "type": "string",
                    "example": "API"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                }
              },
              "stats": {
                "type": "object",
                "properties": {
                  "inputBodyLen": {
                    "type": "integer",
                    "example": 2000
                  },
                  "rebootCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "restartCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "resurrectCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "computeUnits": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "options": {
                "type": "object",
                "properties": {
                  "build": {
                    "type": "string",
                    "example": "latest"
                  },
                  "timeoutSecs": {
                    "type": "integer",
                    "example": 300
                  },
                  "memoryMbytes": {
                    "type": "integer",
                    "example": 1024
                  },
                  "diskMbytes": {
                    "type": "integer",
                    "example": 2048
                  }
                }
              },
              "buildId": {
                "type": "string"
              },
              "defaultKeyValueStoreId": {
                "type": "string"
              },
              "defaultDatasetId": {
                "type": "string"
              },
              "defaultRequestQueueId": {
                "type": "string"
              },
              "buildNumber": {
                "type": "string",
                "example": "1.0.0"
              },
              "containerUrl": {
                "type": "string"
              },
              "usage": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "integer",
                    "example": 1
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "usageTotalUsd": {
                "type": "number",
                "example": 0.00005
              },
              "usageUsd": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "number",
                    "example": 0.00005
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}