Article type: How-to guide (one task: one CSV of open UK public-sector tenders for one CPV code, from Find a Tender and Contracts Finder, soonest deadline first)
Prerequisites: Python 3.9 or later with
requests(pip install requests). No API key or account: both services publish their notices through open APIs. An Apify account only if you use the hosted version at the end.Tested on: 19 November 2026, against the live Find a Tender and Contracts Finder APIs.
If you sell to the UK public sector, opportunities are published in two places: Find a Tender for higher-value contracts, and Contracts Finder for lower-value ones in England. Both have search pages, but checking two sites for your category every few days gets old. Both also publish every notice as open data in the same format (OCDS, the Open Contracting Data Standard), so one Python script can read both, keep the tenders that are still open, filter by CPV code (the EU classification of what's being bought: 72 is IT services, 45 construction) and write one CSV.
All the data in this post comes from two endpoints:
GET https://www.find-tender.service.gov.uk/api/1.0/ocdsReleasePackages?updatedFrom=...&updatedTo=...&limit=100GET https://www.contractsfinder.service.gov.uk/Published/Notices/OCDS/Search?publishedFrom=...&publishedTo=...&stages=tender&limit=100
Each returns up to 100 OCDS "releases" (one version of one notice) and, while there are more, a links.next URL for the next page. No key, no login.
How do I get open tenders from Find a Tender and Contracts Finder?
Save this as uk_tenders.py and run python uk_tenders.py for IT services, or pass another CPV prefix (python uk_tenders.py 45):
import csv
import sys
import time
from datetime import datetime, timedelta, timezone
from urllib.robotparser import RobotFileParser
import requests
CPV = sys.argv[1] if len(sys.argv) > 1 else "72" # CPV prefix: 72 = IT services, 45 = construction
DAYS = 7
UA = "uk-tenders-csv-tutorial/1.0 (python-requests)"
SOURCES = {
"find-a-tender": ("https://www.find-tender.service.gov.uk/api/1.0/ocdsReleasePackages", "updatedFrom", "updatedTo", {}),
"contracts-finder": ("https://www.contractsfinder.service.gov.uk/Published/Notices/OCDS/Search", "publishedFrom", "publishedTo", {"stages": "tender"}),
}
session = requests.Session()
session.headers["User-Agent"] = UA
# robots.txt first, on both hosts (both answer 404, which means no restrictions).
for base, *_ in SOURCES.values():
robots = RobotFileParser(base.split("/", 3)[0] + "//" + base.split("/", 3)[2] + "/robots.txt")
robots.read()
if not robots.can_fetch(UA, base):
sys.exit(f"robots.txt disallows {base}")
now = datetime.now(timezone.utc).replace(microsecond=0)
since = now - timedelta(days=DAYS)
fmt = lambda d: d.strftime("%Y-%m-%dT%H:%M:%S")
def releases(source):
"""Every release in the window, following the API's next-page links, one request a second."""
base, start, end, extra = SOURCES[source]
url, params, pages = base, {start: fmt(since), end: fmt(now), "limit": 100, **extra}, 0
while url:
for attempt in range(4):
r = session.get(url, params=params, timeout=120)
if r.status_code not in (429, 503):
break
time.sleep(int(r.headers.get("Retry-After", 30))) # the service says how long to wait
r.raise_for_status()
data = r.json()
pages += 1
yield from data.get("releases", [])
url, params = (data.get("links") or {}).get("next"), None
time.sleep(1)
print(f" {source}: {pages} pages")
def cpvs(t):
"""CPV codes from the tender, its items and its lots. On Find a Tender most sit in items[].additionalClassifications."""
found = []
for part in [t] + t.get("items", []) + t.get("lots", []):
found += [part.get("classification")] + part.get("additionalClassifications", [])
return {str(c["id"])[:8] for c in found if c and c.get("id") and "cpv" in str(c.get("scheme", "cpv")).lower()}
# 1. Read both services. Keep the latest release of each procedure (ocid): amendments replace earlier versions.
latest, read = {}, {}
for source in SOURCES:
read[source] = 0
for rel in releases(source):
read[source] += 1
key = rel["ocid"]
if key not in latest or rel["date"] > latest[key][1]["date"]:
latest[key] = (source, rel)
print(f"read {read} releases since {fmt(since)} UTC; {len(latest)} distinct procedures")
def utc(deadline):
"""Deadlines come as '...Z', '...+01:00' or a bare date. Turn them all into UTC; a bare date means end of that day."""
if not deadline:
return None
if len(deadline) == 10:
deadline += "T23:59:59+00:00"
return datetime.fromisoformat(deadline.replace("Z", "+00:00")).astimezone(timezone.utc)
# 2. Open tenders only: the latest release is at tender stage and its deadline hasn't passed.
# Notices with no deadline are kept (blank), so you can check them yourself.
rows = []
for ocid, (source, rel) in latest.items():
t = rel.get("tender") or {}
tags = rel.get("tag") or []
deadline = utc((t.get("tenderPeriod") or {}).get("endDate"))
if not any(x.startswith("tender") for x in tags) or any(x.endswith("Cancellation") for x in tags):
continue
if deadline and deadline < now:
continue
codes = cpvs(t)
value = t.get("value") or t.get("minValue") or {}
rows.append({
"deadline_utc": deadline.strftime("%Y-%m-%d %H:%M") if deadline else "",
"title": t.get("title", ""),
"buyer": (rel.get("buyer") or {}).get("name", ""),
"cpv": " ".join(sorted(codes)),
"value": value.get("amount", ""),
"currency": value.get("currency", ""),
"sme_suitable": (t.get("suitability") or {}).get("sme", ""),
"published": rel["date"][:10],
"source": source,
"ocid": ocid,
"url": (f"https://www.find-tender.service.gov.uk/Notice/{rel['id']}" if source == "find-a-tender"
else f"https://www.contractsfinder.service.gov.uk/Notice/{rel['id'][:36]}"),
})
# The two services give the same notice different ocids, so match cross-posts on title + buyer + deadline.
fts_keys = {(r["title"].lower(), r["buyer"].lower(), r["deadline_utc"]) for r in rows if r["source"] == "find-a-tender"}
cross = [r for r in rows if r["source"] == "contracts-finder" and (r["title"].lower(), r["buyer"].lower(), r["deadline_utc"]) in fts_keys]
rows = [r for r in rows if r not in cross]
print(f"{len(cross)} Contracts Finder notices also on Find a Tender (dropped)")
print(f"{len(rows)} open tenders ({sum(not r['deadline_utc'] for r in rows)} of them with no deadline)")
# 3. Your CPV prefix, soonest deadline first.
mine = sorted((r for r in rows if any(c.startswith(CPV) for c in r["cpv"].split())), key=lambda r: r["deadline_utc"] or "9999")
out = f"uk_tenders_cpv{CPV}_{now:%Y-%m-%d}.csv"
with open(out, "w", newline="") as f:
w = csv.DictWriter(f, fieldnames=list(rows[0]))
w.writeheader()
w.writerows(mine)
print(f"wrote {len(mine)} tenders with a CPV code starting {CPV} to {out}")
print(f" from find-a-tender {sum(r['source'] == 'find-a-tender' for r in mine)}, contracts-finder {sum(r['source'] == 'contracts-finder' for r in mine)}")
print(f" with no value {sum(r['value'] == '' for r in mine)}; marked SME-suitable {sum(r['sme_suitable'] is True for r in mine)}")
Output on 19 November 2026 (it took about 440 seconds):
find-a-tender: 22 pages
contracts-finder: 1 pages
read {'find-a-tender': 2173, 'contracts-finder': 58} releases since 2026-11-12T14:13:44 UTC; 2036 distinct procedures
0 Contracts Finder notices also on Find a Tender (dropped)
533 open tenders (81 of them with no deadline)
wrote 31 tenders with a CPV code starting 72 to uk_tenders_cpv72_2026-11-19.csv
from find-a-tender 28, contracts-finder 3
with no value 4; marked SME-suitable 3
Some rows from uk_tenders_cpv72_2026-11-19.csv (titles shortened, most columns left out):
deadline_utc,title,buyer,value,currency,source
2026-11-30 12:00,"Global Vessel Data","UK Hydrographic Office",50000.0,GBP,find-a-tender
2026-11-30 17:00,"Embedded product team to develop the Alpha and Beta of the E","THE EDUCATION ENDOWMENT FOUNDATION",730000,GBP,contracts-finder
2026-12-11 12:00,"CeTPD Laboratory Information Management System","University of Dundee",250000,GBP,find-a-tender
2026-12-17 12:00,"Management Information System (MIS) for the Adult College","London Borough of Barking and Dagenham",400000,GBP,find-a-tender
Why it's built this way:
-
robots.txtfirst, then one request a second. Both hosts answerrobots.txtwith a 404, which means no restrictions, but the script still checks. The week took 23 API requests. -
Wait when asked. If a service answers HTTP 429 or 503, the script waits for the number of seconds in its
Retry-Afterheader before trying again (gotcha 6). -
Latest version wins. An amended notice is a new release of the same procedure (
ocid), so the script keeps the latest release of each. - Open means tender stage and deadline in the future. The latest release must be a tender notice, not cancelled, with a deadline after now. Notices with no deadline are kept with a blank, so you can decide.
What should I check before I trust the CSV?
-
Most notices aren't open tenders. Of the 2,173 Find a Tender releases in the week, 1,245 carried the award tag, 406 the tender tag, 219 planning and 154 tender update. On Contracts Finder,
stages=tenderreturned 58 releases on one page; without it the same week was 499 releases over 5 pages, 408 of them awards. -
CPV codes are often not where you'd look. Of the 595 tender-stage releases from Find a Tender in the week, 492 had their CPV codes only in
tender.items[].additionalClassifications, and 68 had one intender.classification. A filter that reads onlyclassificationmisses most of them, so the script reads both, on the tender, its items and its lots. -
Deadlines come in three formats. Of 653 tender-stage deadlines, 308 ended in
Z, 220 had an offset like+01:00and 1 was a bare date. 124 had no deadline at all. Comparing them as text sorts them wrongly, so the script converts each to UTC first. -
Amendments repeat a procedure. 157 of the 1,986 Find a Tender procedures in the week had more than one release. Keep the latest by its
date, or you list the same tender twice. -
The two services don't share IDs. Find a Tender
ocids startocds-h6vhtk-and Contracts Finder's startocds-b5fd17-, so the same notice posted on both can't be matched byocid. The script matches on title, buyer and deadline. In this week it found none, but keep the check. -
Find a Tender rate-limits repeat reads. Reading the same week again straight after a full read, Find a Tender answered HTTP 429 partway through. Honour
Retry-After, and don't re-read a week you already have. - Values are optional. 4 of the 31 IT tenders had no value. Values come back as whole numbers or decimals, and most are in GBP.
To widen the window, change DAYS. For awarded contracts instead of open tenders, keep releases tagged award and read awards[].suppliers.
The hosted version (Disclosure: we built this)
We built an Apify Actor, Public Tenders API: EU Tenders, Find a Tender, Contracts Finder, that reads the same two services plus TED, the EU's tenders journal, and returns every notice in one schema. It filters by CPV code (including the codes in items and lots), buyer country, region, value, keywords, buyer name, deadline, notice stage and SME suitability, and returns only the latest release per notice and stage. A notice published on both Find a Tender and Contracts Finder comes back once, as the Find a Tender row, matched by ocid or by title, buyer and deadline. It goes one request a second per service, honours Retry-After, and gives each UK source a time budget; if a source fails or is cut short, a free status row says so. With monitorMode on and a daily schedule, each run returns only new, amended, awarded or cancelled notices. It never outputs contact people's names.
What it doesn't do: it reads only those three services, so tenders published only on other portals aren't included. It doesn't send emails; results land in your dataset. Many notices publish no value, and Contracts Finder often gives region names rather than codes, so value and region filters drop those notices. It's pay per event; prices on the Actor's Pricing tab. For example (not run for this post):
{
"sources": ["find-a-tender", "contracts-finder"],
"cpvCodes": ["72"],
"publishedWithinDays": 7,
"maxResults": 0
}
Data: Find a Tender and Contracts Finder open data, read 19 November 2026, under the Open Government Licence v3.0. This post and the Actor are not affiliated with or endorsed by Find a Tender, Contracts Finder, the Cabinet Office or any buyer named.
Your Evenings
Top comments (0)