# TED Tender Change Intelligence (`snapperwapper/ted-tender-change-intelligence`) Actor

Monitor official TED v3 notices with saved profiles and deterministic tender deltas.

- **URL**: https://apify.com/snapperwapper/ted-tender-change-intelligence.md
- **Developed by:** [snapperwapper](https://apify.com/snapperwapper) (community)
- **Categories:** Automation, Business
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-usage

## 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

## TED Tender Change Intelligence

Monitor EU procurement notices through the **official TED Search API v3** and turn saved searches into deterministic, alert-ready change records. The Actor normalizes multilingual titles and buyers, preserves stable TED notice IDs and provenance, paginates within explicit bounds, and compares each profile with its own persistent baseline.

### What it does

- Calls only `POST https://api.ted.europa.eu/v3/notices/search`—no browser, scraping, attachments, alternate source, or arbitrary URL.
- Runs one or more saved profiles with a TED expert query plus optional CPV, buyer-country, language, and publication-date filters.
- Normalizes multilingual title and buyer values while preserving all returned translations.
- Emits stable `noticeId`, dates, deadline, CPV, buyer country, value/currency, official HTML/XML links, and source metadata.
- Emits deterministic `NEW`, `CHANGED`, `DEADLINE_CHANGED`, and source-supported `CANCELLED` records with `before`, `after`, and `changedFields` evidence.
- Never treats disappearance from a bounded search result as cancellation.
- Bounds results, page size, pages per profile, timeout, and retries; an isolated profile error becomes an `ERROR` record.
- Includes a synthetic `demoMode` that performs no network request.

### Input

```json
{
  "profiles": [
    {
      "id": "renewable-energy-de",
      "query": "solar",
      "cpvCodes": ["09331000"],
      "countries": ["DEU"],
      "preferredLanguages": ["eng", "deu"],
      "publicationDateFrom": "2026-08-01",
      "publicationDateTo": "2026-08-12"
    }
  ],
  "maxResults": 1000,
  "pageSize": 100,
  "maxPagesPerProfile": 100,
  "detectChanges": true,
  "requestTimeoutSecs": 30,
  "maxRequestRetries": 3,
  "demoMode": false
}
```

| Field | Default | Meaning |
| --- | --- | --- |
| `profiles` | example energy profile | Required saved profiles. `id` must be unique. `query` is a TED expert-search expression; omitted query uses `*`. |
| `cpvCodes` | `[]` | Adds `classification-cpv = (...)` to that profile. Values use OR logic. |
| `countries` | `[]` | Adds `buyer-country = (...)`. Use TED three-letter country codes. |
| `preferredLanguages` | `[]` | Preferred ISO language codes for scalar title/buyer selection. English is the next fallback, then the first language key. |
| `publicationDateFrom`, `publicationDateTo` | omitted | Optional profile publication bounds in `YYYY-MM-DD`. |
| `maxResults` | `1000` | Global tender-row cap across profiles (1–100,000). Error rows remain visible. |
| `pageSize` | `100` | TED request page size (1–100). |
| `maxPagesPerProfile` | `100` | Explicit pagination safety bound (1–1,000). |
| `detectChanges` | `true` | Compare with profile-specific key-value state. |
| `requestTimeoutSecs` | `30` | Per-request timeout (1–120 seconds). |
| `maxRequestRetries` | `3` | Retries for timeout/network failures, HTTP 408/429, and 5xx (0–10). |
| `demoMode` | `false` | Use `fixtures/demo-response.json`; no network request. |

The Actor combines a profile's clauses with AND. For example, the input above submits:

```text
solar AND classification-cpv = (09331000) AND buyer-country = (DEU)
AND publication-date >= 20260801 AND publication-date <= 20260812
```

`query` is sent only to TED's documented v3 search API. It is not a URL and is never used to choose a host.

### Output

```json
{
  "recordType": "TENDER",
  "changeType": "DEADLINE_CHANGED",
  "source": "TED",
  "sourceApiVersion": "v3",
  "profileId": "renewable-energy-de",
  "noticeId": "123456-2026",
  "title": "Solar panels for public buildings",
  "titleTranslations": {
    "deu": ["Solarmodule für öffentliche Gebäude"],
    "eng": ["Solar panels for public buildings"]
  },
  "buyerName": "Example City",
  "buyerNameTranslations": { "eng": ["Example City"] },
  "publicationDate": "2026-08-10",
  "submissionDeadline": "2026-10-10T10:00:00.000Z",
  "previousSubmissionDeadline": "2026-09-30T10:00:00.000Z",
  "cpvCodes": ["09331000"],
  "buyerCountries": ["DEU"],
  "noticeType": "competition",
  "status": "competition",
  "estimatedValue": 200000,
  "currency": "EUR",
  "sourceUrl": "https://ted.europa.eu/en/notice/-/detail/123456-2026",
  "xmlUrl": "https://ted.europa.eu/en/notice/123456-2026/xml",
  "changedFields": ["submissionDeadline"],
  "before": { "submissionDeadline": "2026-09-30T10:00:00.000Z" },
  "after": { "submissionDeadline": "2026-10-10T10:00:00.000Z" },
  "fetchedAt": "2026-08-12T12:00:00.000Z"
}
```

Unavailable values are omitted, not invented. `ERROR` records include `profileId`, source/version, a bounded source error message, and `fetchedAt`.

### Delta semantics

Each profile is stored independently as `TED_STATE_<profileId>`:

- **NEW** — the stable TED notice ID is absent from that profile baseline.
- **DEADLINE\_CHANGED** — the normalized deadline changed; it takes priority over a simultaneous general change.
- **CHANGED** — another tracked normalized field changed.
- **CANCELLED** — the current official payload explicitly identifies a cancellation and the prior snapshot did not.
- **No output label** — current notice is unchanged. The row is still returned so `detectChanges: false` can provide snapshot extraction; with detection enabled it remains an observed current item.

A missing notice is retained in baseline and does **not** generate cancellation because TED search results are bounded/filter-dependent. Temporary API errors also do not overwrite that profile's state. Fingerprints exclude run-time timestamps and are generated from canonical sorted snapshots.

### Safe demo

The default local/no-input run uses `fixtures/demo-input.json` and a clearly synthetic `000001-2099` response. Run it locally with:

```bash
npm install
npm test
npm start
```

The demo makes no live request. For a real Actor run, submit input with `demoMode: false`.

### Scheduling and integrations

Use a stable Apify Task and key-value store, then schedule it hourly or daily. Feed `NEW`, `CHANGED`, `DEADLINE_CHANGED`, or `CANCELLED` records to webhooks, Slack, email, Google Sheets, or your own bid workflow. Retaining the same storage is required for meaningful deltas.

### Limitations and responsible use

- This is an independent product and is not endorsed by the Publications Office of the European Union.
- TED source fields vary by notice generation and document type. The Actor supports known fields but does not translate content or infer missing values.
- Cancellation is emitted only when represented by returned source status/type fields; it is never inferred from disappearance.
- TED can time out, rate-limit, change fields, or return very large result sets. Use narrow date/profile filters and the supplied bounds.
- Attachments are intentionally excluded. Review TED's current API documentation and legal/reuse notice before storing or redistributing data.
- Records are procurement intelligence, not legal advice and not a statement of eligibility, award probability, buyer intent, or completeness.

### Local verification

Tests are fixture-driven and do not call live sources. They cover multilingual parsing and fallbacks, stable identity, all supported delta types, no inferred cancellation, v3 POST pagination/body construction, deduplication, max bounds, retries, source errors, schemas, and the no-network demo entrypoint.

# Actor input Schema

## `profiles` (type: `array`):

Saved TED search profiles. Each object requires a unique id and may include a TED expert query, CPV codes, buyer countries, preferred languages, and publication date bounds.

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

Global maximum tender rows across profiles. Error rows remain visible.

## `pageSize` (type: `integer`):

Official TED v3 search page size.

## `maxPagesPerProfile` (type: `integer`):

Safety bound for each profile's pagination.

## `detectChanges` (type: `boolean`):

Compare normalized notice snapshots with profile-specific stored baselines.

## `requestTimeoutSecs` (type: `integer`):

Timeout per official TED API request in seconds.

## `maxRequestRetries` (type: `integer`):

Retries for timeouts, HTTP 408/429, network failures, and 5xx responses.

## `demoMode` (type: `boolean`):

Use the bundled synthetic response and make no network request.

## Actor input object example

```json
{
  "profiles": [
    {
      "id": "renewable-energy",
      "query": "solar",
      "cpvCodes": [
        "09331000"
      ],
      "preferredLanguages": [
        "eng"
      ]
    }
  ],
  "maxResults": 1000,
  "pageSize": 100,
  "maxPagesPerProfile": 100,
  "detectChanges": true,
  "requestTimeoutSecs": 30,
  "maxRequestRetries": 3,
  "demoMode": false
}
```

# Actor output Schema

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

Normalized TED tender records and change evidence.

# 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 = {
    "profiles": [
        {
            "id": "renewable-energy",
            "query": "solar",
            "cpvCodes": [
                "09331000"
            ],
            "preferredLanguages": [
                "eng"
            ]
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("snapperwapper/ted-tender-change-intelligence").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 = { "profiles": [{
            "id": "renewable-energy",
            "query": "solar",
            "cpvCodes": ["09331000"],
            "preferredLanguages": ["eng"],
        }] }

# Run the Actor and wait for it to finish
run = client.actor("snapperwapper/ted-tender-change-intelligence").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 '{
  "profiles": [
    {
      "id": "renewable-energy",
      "query": "solar",
      "cpvCodes": [
        "09331000"
      ],
      "preferredLanguages": [
        "eng"
      ]
    }
  ]
}' |
apify call snapperwapper/ted-tender-change-intelligence --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,snapperwapper/ted-tender-change-intelligence"
        }
    }
}

```

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/6dpttizG1XKKeF5Js/builds/sSe4lyrmDOuJqDHef/openapi.json
