Halfords APIhalfords.com ↗
Look up compatible car batteries on Halfords by UK registration number. Returns vehicle details, battery listings, and current prices via a single endpoint.
What is the Halfords API?
The Halfords Car Battery API exposes 1 endpoint — search_batteries_by_registration — that accepts a UK vehicle registration number and returns a full catalog of compatible battery listings from halfords.com, including current prices, vehicle identification details, and a total result count. Optionally supply a UK postcode to add local store availability context to the results.
curl -X GET 'https://api.parse.bot/scraper/69d02754-79cb-430c-9b13-78d6341710fa/search_batteries_by_registration?postcode=SW1A+1AA®istration=BD51SMR' \ -H 'X-API-Key: $PARSE_API_KEY'
Typed, relational, agent-ready
A generated client with real types, enums, and the links between objects — the structure a flat JSON response can't carry. Autocompletes in your editor and reads cleanly to coding agents.
- Fully typed · autocompletes
- Objects link to objects
- Typed errors & pagination
Typed Python client. Set up the SDK in your uv project, then pull this API’s typed client:
uv add parse-sdk uv run parse init uv run parse add --marketplace halfords-com-api
uv run parse add --marketplace pulls a pinned snapshot of this canonical API — it won’t change underneath you. To customize it, subscribe and swap to your own copy.
"""Walkthrough: halfords_com_api SDK — bounded, re-runnable; every call capped."""
from parse_apis.halfords_com_api import Halfords, RegistrationRequired
client = Halfords()
# Search batteries by vehicle registration
for battery in client.battery_searches.search(registration="BD51SMR", limit=3):
print(battery.title, battery.brand, battery.price, battery.sale_price)
# Get first result for detailed inspection
item = client.battery_searches.search(registration="BD51SMR", limit=1).first()
if item:
print(item.product_id, item.title, item.url)
# Handle missing registration error
try:
client.battery_searches.search(registration="BD51SMR", limit=1).first()
except RegistrationRequired as e:
print("error:", e)
print("exercised: battery_searches.search")
Looks up a vehicle by its UK registration number and returns car battery listings from Halfords with current prices. When the registration is recognized, vehicle details are included; the battery catalog is always returned regardless of VRN match. Results are a single page of up to 48 products ordered by relevance.
| Param | Type | Description |
|---|---|---|
| postcode | string | UK postcode for local store availability context (e.g. SW1A 1AA). Optional. |
| registrationrequired | string | UK vehicle registration number (e.g. BD51SMR). Spaces are optional. |
{
"type": "object",
"fields": {
"vehicle": "object or null — vehicle details if registration was recognized",
"batteries": "array of battery product listings",
"registration": "string — the registration number queried",
"total_results": "integer — total number of matching batteries"
},
"sample": {
"data": {
"vehicle": null,
"batteries": [
{
"url": "https://www.halfords.com/motoring/batteries/car-batteries/halfords-efb096-start-stop-car-battery-5-year-guarantee-255862.html",
"brand": "Halfords",
"price": 201.99,
"title": "Halfords EFB096 Start Stop Car Battery 5 Year Guarantee",
"image_url": "https://cdn.media.halfords.com/i/washford/255862/Halfords-EFB096-Start-Stop-Car-Battery-5-Year-Guarantee",
"product_id": "255862",
"sale_price": 129
},
{
"url": "https://www.halfords.com/motoring/batteries/car-batteries/halfords-efb027-start-stop-efb-12v-car-battery-257730.html",
"brand": "Halfords Advanced",
"price": 138,
"title": "Halfords EFB027 Start/Stop EFB 12V Car Battery 5 Year Guarantee",
"image_url": "https://cdn.media.halfords.com/i/washford/257730/Halfords-EFB027-Start/Stop-EFB-12V-Car-Battery-5-Year-Guarantee",
"product_id": "257730",
"sale_price": 109.5
}
],
"registration": "BD51SMR",
"total_results": 80
},
"status": "success"
}
}About the Halfords API
What the API Returns
The search_batteries_by_registration endpoint takes a required registration string (UK VRN, spaces optional) and returns three top-level fields: vehicle (an object with details about the recognized vehicle, or null if the registration is not matched), batteries (an array of product listings with current prices), and total_results (an integer count of matching batteries). The battery catalog is always returned regardless of whether the VRN is recognized.
Input Parameters
Only one parameter is required: registration, a UK vehicle registration number such as BD51SMR. The optional postcode parameter accepts a UK postcode (e.g. SW1A 1AA) and adds local store availability context to the response. No other filters — such as brand, cold-cranking amps, or battery group size — are accepted as inputs; filtering must be done client-side on the returned batteries array.
Response Shape and Coverage
Each object in the batteries array represents a single product listing from Halfords' car battery range. The vehicle object, when present, reflects Halfords' own vehicle lookup data tied to the submitted registration. Results are returned as a single page; the total_results field tells you the full count of matching products returned in that page.
The Halfords API is a managed, monitored endpoint for halfords.com — not a raw scraper you maintain. Every endpoint is automatically health-checked on a schedule, and when halfords.com changes and a check fails, the API is automatically queued for repair and re-verified. It is built to keep working as the site underneath it changes.
This isn't an official halfords.com API — it's an independent, maintained REST wrapper over public data. Where the source has no official API (or only a limited one), Parse gives you a stable contract over a source that never promised one, and keeps it current. Need a new endpoint or field? You can revise it yourself in plain English and the agent rebuilds it against the live site in minutes — contributing the change back to the shared API is free.
Will this API break when the source site changes?+
Is this an official API from the source site?+
Can I fix or extend this API myself if I need a new endpoint or field?+
What happens if I call an endpoint that has an issue?+
- Build a vehicle-aware battery finder tool that pre-fills compatible options from a user's number plate
- Track Halfords car battery prices over time by polling the endpoint for specific registrations
- Compare battery availability and pricing for a fleet of vehicles identified by their UK VRNs
- Populate a garage management app with battery product options matched to stored vehicle registrations
- Cross-reference total_results counts across different vehicle types to identify coverage gaps in Halfords' battery range
- Surface store-local battery availability by passing a postcode alongside each registration lookup
| Tier | Price | Credits/month | Rate limit |
|---|---|---|---|
| Free | $0/mo | 100 | 5 req/min |
| Hobby | $30/mo | 1,000 | 20 req/min |
| Developer | $100/mo | 5,000 | 100 req/min |
One credit = one API call regardless of which marketplace API you call. Exceeding the rate limit returns a 429 response. Authenticate with the X-API-Key header.
Does Halfords have an official developer API?+
What does the vehicle field contain, and when is it null?+
vehicle field returns an object containing details about that vehicle. If the registration is not matched — for example, if it is invalid or not found in the lookup — vehicle returns null. The batteries array is always populated regardless of that outcome.Does the API return results across multiple pages?+
total_results field indicates how many battery listings were returned. There are no pagination parameters such as page or offset. You can fork this API on Parse and revise it to add paginated browsing if your use case requires it.Can I filter batteries by specifications like brand, voltage, or cold-cranking amps?+
batteries array. You can fork this API on Parse and revise it to add server-side filtering endpoints against those fields.