# TED Contract Expiry Radar - EU Re-Tender Leads (`woolly_neon_noz/ted-contract-expiry`) Actor

Find awarded EU public contracts (official TED API) that end in the next 3-18 months: buyer, winner, value, CPV, end date. Explicit end dates or flagged estimates from duration. NEW vs last run.

- **URL**: https://apify.com/woolly_neon_noz/ted-contract-expiry.md
- **Developed by:** [Terabit Ai](https://apify.com/woolly_neon_noz) (community)
- **Categories:** Lead generation, Business, Agents
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $6.00 / 1,000 expiring contracts

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

## TED Contract Expiry Radar - EU Re-Tender Leads

Find **awarded EU public contracts that are about to end**, so you can prepare before the buyer re-tenders.
The Actor reads the **official TED Search API v3** (Tenders Electronic Daily, the EU Official Journal supplement)
and returns contracts whose period ends in a window you choose, for example **3 to 18 months from today**.

For every contract you get the buyer, country, title, CPV codes, the winner(s) (the incumbent), award value and currency,
award and signature dates, contract start / end / duration, the **expected expiry date** and links to the TED notices.

### Why this Actor

- **Explicit end dates and honest estimates.** Many award notices only state a duration ("24 months"). The Actor
  estimates the end from the start or signature date and **flags every estimate**: `endDateIsEstimated`,
  `endDateBasis` (how it was computed) and `confidence` (HIGH / MEDIUM / LOW).
- **Duration from the contract notice.** Some countries (Croatia is one) publish the duration only in the original
  contract notice. The Actor looks that notice up for the same procedure (`durationSource = CONTRACT_NOTICE`).
- **Modification check.** Contracts that got a later modification notice (possible extension) are flagged with
  `modifiedAfterAward` and the modification notice numbers.
- **NEW vs last run.** Schedule it daily or weekly and get only the contracts you have not seen yet (`onlyNew`).
- **Official data only.** No HTML scraping, no login, no proxies. TED data may be reused commercially
  (Commission Decision 2011/833/EU, see the TED legal notice).

### Input

| Field | Example | Notes |
|---|---|---|
| `countries` | `["DE", "AT"]` | Buyer country, ISO codes (alpha-2 or alpha-3). Empty = all countries. |
| `cpvCodes` | `["72000000", "48"]` | CPV prefixes. `72000000` matches every 72xxxxxx code. |
| `keywords` | `["cloud", "SAP"]` | TED full-text search, any keyword matches. |
| `buyerName` | `"Universitätsklinikum"` | Words that must appear in the buyer name. |
| `minValueEur` | `100000` | Minimum award value in EUR (ECB rates for other currencies). |
| `expiryFromMonths` / `expiryToMonths` | `3` / `18` | Window relative to today. |
| `expiryFromDate` / `expiryToDate` | `2027-01-01` | Optional exact window (overrides months). |
| `includeEstimated` | `true` | Include end dates estimated from duration. |
| `lookupContractNotices` | `true` | Take the duration from the contract notice if needed. |
| `checkModifications` | `true` | Flag later modification notices. |
| `maxContractMonths` | `60` | How far back award notices are scanned for durations. |
| `maxScanNotices` | `3000` | Limit of notices read per search (free; only rows are charged). |
| `maxItems` | `200` | Maximum rows returned and charged. |
| `sortBy` | `expiry` | `expiry`, `value` or `published`. |
| `trackNew` / `onlyNew` / `stateKey` | | NEW tracking for scheduled runs. |

Example: IT contracts of German and Austrian buyers worth at least 250,000 EUR that end in the next 3-12 months:

```json
{ "countries": ["DE", "AT"], "cpvCodes": ["72000000"], "minValueEur": 250000, "expiryFromMonths": 3, "expiryToMonths": 12 }
```

### Output

One row per award notice that has at least one contract (lot) ending inside the window:

```json
{
  "noticeId": "182084-2025",
  "tedUrl": "https://ted.europa.eu/en/notice/-/detail/182084-2025",
  "title": "Vertrag über Cloudleistungen - Serverkapazität und Support",
  "buyerNames": ["DigitalAgentur Brandenburg GmbH"],
  "buyerCountry": "DEU",
  "mainCpv": "72000000",
  "winners": ["mitteldeutsche it GmbH"],
  "awardValue": 340000, "currency": "EUR", "awardValueEur": 340000,
  "contractSignedDate": "2025-02-28",
  "contractDuration": "2 years",
  "expectedExpiry": "2027-02-27",
  "endDateIsEstimated": true,
  "endDateBasis": "CONTRACT_SIGNATURE_PLUS_DURATION",
  "confidence": "MEDIUM",
  "daysUntilExpiry": 461,
  "maxRenewals": null,
  "frameworkAgreement": false,
  "modifiedAfterAward": false,
  "isNew": true
}
```

`endDateBasis` values:

| Value | Meaning | Confidence |
|---|---|---|
| `END_DATE_IN_AWARD_NOTICE` | End date published in the award notice | HIGH |
| `START_DATE_PLUS_DURATION` | Start date + duration from the award notice | MEDIUM |
| `CONTRACT_SIGNATURE_PLUS_DURATION` | Contract signature date + duration | MEDIUM |
| `PLANNED_START_PLUS_DURATION` | Planned start from the contract notice + duration | LOW |
| `END_DATE_IN_CONTRACT_NOTICE` | End date planned in the contract notice | LOW |
| `AWARD_DECISION_PLUS_DURATION` | Award decision date + duration | LOW |
| `PUBLICATION_DATE_PLUS_DURATION` | Notice publication date + duration (no other date known) | LOW |

Other useful fields: `allEndDates` (every lot end date in the notice), `lotsEndingInWindow`, `contractNoticeId`,
`modificationNoticeIds`, `modificationEndDates`, `valueSource`, `valueSuspicious` (value below 100, often a placeholder),
`firstSeenDate`. The `OUTPUT` record of each run contains the exact TED queries, counts, scan coverage and notes.

### How it works

1. Searches award notices (`form-type=result`) whose published contract end date is inside the window.
2. Scans award notices published in the last `maxContractMonths` (newest first) and estimates the end date from
   the duration where no end date is given.
3. Optionally reads the contract notice of the same procedure for a missing duration and checks for modification notices.
4. Filters by buyer name and value, sorts, marks NEW contracts and writes the rows.

### Limits - please read

- **Estimates are estimates.** Contracts can be extended, renewed (see `maxRenewals`), terminated early or re-tendered
  before they end. Check the notice before acting.
- **eForms only.** Structured dates and winners exist in TED search data only for notices published in eForms
  (from November 2022; mandatory since 25 October 2023). Contracts awarded earlier are not found.
- **Coverage depends on the buyer.** Some notices give neither an end date nor a duration; these are counted in
  `OUTPUT.counts.withoutAnyDuration` and cannot be returned.
- **Scan limit.** Broad searches (all countries, no CPV) may hit `maxScanNotices`; the run then says so in its status
  message and `OUTPUT.notes`. Narrow the filters or raise the limit.
- **Values** are what the buyer published. EUR conversion uses the latest ECB reference rates, not the rate at award time.

### Fair use

The Actor uses only the public TED Search API (no key needed), sends one request at a time with at least 0.5 s between
requests (TED allows 700 requests per minute per IP), backs off on HTTP 429/5xx and identifies itself with the
User-Agent `ted-contract-expiry/0.1 (+https://apify.com/woolly_neon_noz/ted-contract-expiry; ...)`.
Source: © European Union, TED (ted.europa.eu). This Actor is not affiliated with the EU Publications Office.

### For AI agents

- **What it does:** searches the official TED Search API v3 for awarded EU public contracts whose period ends in a window you choose, and returns buyer, winner, value, CPV, expected expiry (explicit or flagged estimate) and TED links.
- **Cheapest useful call:** `{"countries": ["SI"], "maxItems": 1, "lookupContractNotices": false, "checkModifications": false}` returns one contract ending in the default 3-18 month window.
- **Key inputs:** `countries`, `cpvCodes`, `keywords`, `buyerName`, `minValueEur`, `expiryFromMonths` / `expiryToMonths` (or exact dates), `includeEstimated`, `onlyNew` / `trackNew` / `stateKey`, `maxItems`.
- **Output:** dataset rows (see sample above) plus an `OUTPUT` record with queries, counts and notes.
- **Failure contract:** the run **fails** (exit code 1) on invalid input, when the TED API cannot be read, and when **no contracts match the filters and window**. A later `onlyNew` run that still matches contracts, all of which were already returned, **succeeds** with 0 new rows (validated empty follow-up, not a failed scan).

### Pricing

Pay per event: a small **Actor start** fee plus a fee **per contract row** written to the dataset. Notices that are
scanned but not returned are free. Set `maxItems` to cap the cost of a run.

### Changelog

- 0.1.3 (2026-11-23): a run with no matching contracts now fails with a clear message (exit code 1). A later `onlyNew` run that finds only already-seen contracts still succeeds. Added this "For AI agents" block.
- 0.1 (2026-11-23): first release.

# Actor input Schema

## `countries` (type: `array`):

ISO country codes of the contracting authority, e.g. HR, DE, FR, PL (alpha-3 such as HRV also works). Empty = all countries on TED (EU/EEA and others). A country filter keeps runs fast and complete.

## `cpvCodes` (type: `array`):

CPV codes or prefixes. 72000000 or 72 = all IT services; 79710000 = security services; 45 = construction. Trailing zeros are treated as a prefix, so 72000000 matches 72267100.

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

Full-text keywords searched by TED in the award notice (any keyword matches). Use the language of the notices, e.g. 'cloud', 'Reinigung', 'čišćenje'.

## `buyerName` (type: `string`):

Only contracts of buyers whose name contains these words (accent-insensitive), e.g. 'Universitätsklinikum' or 'Grad Zagreb'.

## `minValueEur` (type: `integer`):

Skip contracts below this value. Non-euro values are converted with the latest ECB reference rate. Contracts without a published value are skipped when this is set.

## `expiryFromMonths` (type: `integer`):

Contracts must end at least this many months from today.

## `expiryToMonths` (type: `integer`):

Contracts must end at most this many months from today.

## `expiryFromDate` (type: `string`):

Optional exact start of the window, YYYY-MM-DD.

## `expiryToDate` (type: `string`):

Optional exact end of the window, YYYY-MM-DD.

## `includeEstimated` (type: `boolean`):

Many award notices give only a duration (e.g. 24 months), not an end date. When on, the end is estimated as start (or signature) date + duration and the row is flagged endDateIsEstimated = true with the basis used. Off = only explicit end dates.

## `lookupContractNotices` (type: `boolean`):

Some countries (e.g. Croatia) publish the duration only in the original contract notice. When on, the Actor reads that notice of the same procedure. Rows built this way have durationSource = CONTRACT_NOTICE.

## `checkModifications` (type: `boolean`):

Checks whether a contract modification notice was published for the procedure (it may extend or shorten the contract).

## `maxContractMonths` (type: `integer`):

Award notices published up to this many months before the window are scanned for durations. Structured TED data starts with eForms (Nov 2022), so older awards are not covered.

## `maxScanNotices` (type: `integer`):

Upper limit of notices read from TED for each of the two searches (explicit end dates, durations). Scanning is free of charge but takes time; OUTPUT notes tell you when the limit was hit.

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

Maximum rows written (and charged).

## `sortBy` (type: `string`):

Order of the rows (applied before maxItems).

## `trackNew` (type: `boolean`):

Remembers which contracts were already returned for the same filters and sets isNew on each row.

## `onlyNew` (type: `boolean`):

For scheduled runs: return only contracts not returned before for the same filters. The first run returns everything (baseline).

## `stateKey` (type: `string`):

Name for the NEW-tracking memory. By default it is derived from the filters.

## Actor input object example

```json
{
  "countries": [
    "DE",
    "AT"
  ],
  "cpvCodes": [
    "72000000"
  ],
  "expiryFromMonths": 3,
  "expiryToMonths": 18,
  "includeEstimated": true,
  "lookupContractNotices": true,
  "checkModifications": true,
  "maxContractMonths": 60,
  "maxScanNotices": 3000,
  "maxItems": 200,
  "sortBy": "expiry",
  "trackNew": true,
  "onlyNew": false
}
```

# Actor output Schema

## `contracts` (type: `string`):

No description

## `summary` (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 = {
    "countries": [
        "DE",
        "AT"
    ],
    "cpvCodes": [
        "72000000"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("woolly_neon_noz/ted-contract-expiry").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 = {
    "countries": [
        "DE",
        "AT",
    ],
    "cpvCodes": ["72000000"],
}

# Run the Actor and wait for it to finish
run = client.actor("woolly_neon_noz/ted-contract-expiry").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 '{
  "countries": [
    "DE",
    "AT"
  ],
  "cpvCodes": [
    "72000000"
  ]
}' |
apify call woolly_neon_noz/ted-contract-expiry --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,woolly_neon_noz/ted-contract-expiry"
        }
    }
}
```

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/nfUVBsnofCGwYunwr/builds/jFQW6f3NuYLmzsehD/openapi.json
