How to Query the TED Europa v3 Procurement API Without Hitting AWS WAF 405 Blocks (Python + MCP)
If you've ever tried to scrape European Union public procurement notices from https://ted.europa.eu/en/search/result with requests, httpx, or even headless Playwright, you've almost certainly hit a wall: HTTP/2 405 Method Not Allowed x-amzn-waf-action: challenge.
TED Europa protects its web frontend with strict AWS WAF gates. Most developers respond by throwing heavier browsers and expensive residential proxies at the HTML search page. You don't need a browser or a single proxy.
The EU Publications Office exposes a fast, unauthenticated, official REST JSON search API (POST https://api.ted.europa.eu/v3/notices/search) that bypasses the web UI's AWS WAF completely. Here is how to query it cleanly in Python (including cursor pagination and multilingual title extraction), plus how to hook it up to an AI agent or n8n pipeline in 2 minutes.
1. The Official Endpoint & Payload
The v3 Search API accepts a JSON POST request with:
query: A TED expert query string (CPV codes, ISO-3 country codes, publication date filters)fields: Exact metadata fields to return (keeping payloads lean)limit: Page size (up to 100)paginationMode: Use"ITERATION"for deep cursor pagination viaiterationNextToken
import datetime
import httpx
TED_SEARCH_URL = "https://api.ted.europa.eu/v3/notices/search"
since = (datetime.date.today() - datetime.timedelta(days=30)).strftime("%Y%m%d")
payload = {
"query": f"(classification-cpv = 72000000) AND (buyer-country = DEU OR buyer-country = NLD) AND publication-date >= {since}",
"fields": [
"publication-number",
"publication-date",
"notice-title",
"buyer-name",
"buyer-country",
"classification-cpv",
"contract-nature",
"notice-type",
"deadline-receipt-tender-date-lot",
],
"limit": 25,
"paginationMode": "ITERATION",
}
resp = httpx.post(TED_SEARCH_URL, json=payload, timeout=30.0)
resp.raise_for_status()
data = resp.json()
print("Total matching notices:", data["totalNoticeCount"])
for notice in data["notices"][:3]:
print(notice["publication-number"], notice.get("buyer-country"), notice.get("notice-title"))
Gotcha #1: Multilingual Nested Objects
TED Europa notices return notice-title and buyer-name as nested language dictionaries (e.g., {"deu": "...", "eng": "..."} or lists of dicts depending on the notice version). Always write a small recursive language picker that checks your preferred ISO-3 language (eng, deu, fra) and falls back gracefully:
def pick_lang(val, preferred="eng"):
if val is None or isinstance(val, str):
return val
if isinstance(val, list):
for item in val:
found = pick_lang(item, preferred)
if found:
return found
return None
if isinstance(val, dict):
for lang in (preferred, "eng", "deu", "fra"):
if val.get(lang):
return pick_lang(val[lang], preferred)
for v in val.values():
found = pick_lang(v, preferred)
if found:
return found
return None
Gotcha #2: Deep Pagination with iterationNextToken
Standard page offsets stop working cleanly on large EU datasets. Passing "paginationMode": "ITERATION" returns an iterationNextToken on each response - feed it right back into the next POST body until iterationNextToken is empty.
2. Skip the Boilerplate (Hosted API + MCP Ready)
If you want scheduled daily tender digests in n8n/Make, CSV/JSON exports, or a ready-to-use Model Context Protocol (MCP) tool for Claude / Cursor / OpenAI Agents without maintaining retry logic, schema normalization, and multilingual parsing yourself, I packaged this exact 128 MB HTTP/JSON pipeline as a hosted Apify Actor:
- Apify Store: TED Europa EU Tenders & Procurement API Scraper (MCP Ready)
- Pricing: Pay-Per-Event at $1.50 / 1,000 notices (platform compute included, zero proxies needed - a 50-tender daily check costs ~$0.075).
Quick Python Call via apify-client:
from apify_client import ApifyClient
client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("iomz/ted-europa-tenders-mcp").call(
run_input={
"cpvCodes": ["72000000"],
"countries": ["DEU", "FRA", "NLD"],
"preferredLanguage": "eng",
"maxResults": 50,
}
)
tenders = list(client.dataset(run["defaultDatasetId"]).iterate_items())
Use Directly in Claude / Cursor via MCP (mcp.apify.com). Add iomz/ted-europa-tenders-mcp to your Apify MCP server config and prompt: "Find the 20 latest EU IT services tenders (CPV 72000000) in Germany and France, summarize the buyers and deadlines, and include direct TED PDF links."
Hope this saves you hours of fighting AWS WAF 405s! Drop a comment if you run into any tricky TED v3 field names or CPV query syntax.
Comments
No comments yet. Start the discussion.