SPAR APIspar.co.za ↗
Search the SPAR South Africa grocery catalog by keyword. Returns product name, description, size, and image URL for matching items.
What is the SPAR API?
The SPAR South Africa API exposes 1 endpoint — search_products — that queries the SPAR brand product catalog and returns up to 5 fields per product: product_id, name, description, size, and image_url. It covers the full SPAR grocery range including fresh food, pantry staples, beverages, and household items, letting developers build product lookup tools without maintaining their own catalog data.
curl -X GET 'https://api.parse.bot/scraper/3bdd71ec-f83f-486e-ad7d-f41d77d75337/search_products' \ -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 spar-co-za-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.
"""
SPAR South Africa Product Catalog API Client
Search the SPAR South Africa product catalog for grocery items.
Get your API key from: https://parse.bot/settings
"""
import os
import requests
from typing import Optional, Dict, List, Any
class ParseClient:
"""Client for interacting with the SPAR South Africa Product Catalog API."""
def __init__(self, api_key: Optional[str] = None):
"""
Initialize the Parse API client.
Args:
api_key: API key for authentication. If not provided, reads from PARSE_API_KEY env var.
"""
self.base_url = "https://api.parse.bot"
self.scraper_id = "3bdd71ec-f83f-486e-ad7d-f41d77d75337"
self.api_key = api_key or os.getenv("PARSE_API_KEY")
if not self.api_key:
raise ValueError(
"API key not provided. Set PARSE_API_KEY environment variable or pass api_key parameter."
)
def _call(
self, endpoint: str, method: str = "POST", **params
) -> Dict[str, Any]:
"""
Make a request to the Parse API.
Args:
endpoint: The endpoint name to call.
method: HTTP method (GET or POST).
**params: Parameters to send with the request.
Returns:
Response JSON as a dictionary.
Raises:
requests.exceptions.RequestException: If the request fails.
"""
url = f"{self.base_url}/scraper/{self.scraper_id}/{endpoint}"
headers = {
"X-API-Key": self.api_key,
"Content-Type": "application/json",
}
if method.upper() == "GET":
response = requests.get(url, headers=headers, params=params)
elif method.upper() == "POST":
response = requests.post(url, headers=headers, json=params)
else:
raise ValueError(f"Unsupported HTTP method: {method}")
response.raise_for_status()
return response.json()
def search_products(self, query: str) -> Dict[str, Any]:
"""
Search the SPAR product catalog by keyword.
Args:
query: Search term to find products by name or description (e.g., 'milk', 'bread', 'coconut').
Returns:
Dictionary containing:
- query: The search term used
- total_results: Number of matching products
- products: List of product objects with product_id, name, description, size, and image_url
"""
return self._call("search_products", method="GET", query=query)
def format_product(product: Dict[str, Any]) -> str:
"""Format a product dictionary for display."""
return (
f" • {product['name']}\n"
f" ID: {product['product_id']} | Size: {product['size']}\n"
f" Description: {product['description']}\n"
f" Image: {product['image_url']}"
)
def main():
"""Demonstrate practical usage of the SPAR Product Catalog API."""
# Initialize the client
client = ParseClient()
# Define search queries representing a typical shopping workflow
shopping_list = ["bread", "milk", "coconut"]
print("=" * 70)
print("SPAR South Africa Product Catalog Search")
print("=" * 70)
# Search for multiple items and collect results
all_results = {}
for item in shopping_list:
print(f"\nSearching for: {item.upper()}")
print("-" * 70)
try:
result = client.search_products(query=item)
# Store results for later use
all_results[item] = result
# Display search summary
print(f"Found {result['total_results']} product(s)")
# Display first 3 products
products_to_show = result["products"][:3]
for product in products_to_show:
print(format_product(product))
if result["total_results"] > 3:
print(f" ... and {result['total_results'] - 3} more products")
except requests.exceptions.RequestException as e:
print(f"Error searching for '{item}': {e}")
# Summary report
print("\n" + "=" * 70)
print("SHOPPING SUMMARY")
print("=" * 70)
total_products_found = sum(r["total_results"] for r in all_results.values())
print(f"Total items searched: {len(all_results)}")
print(f"Total products found: {total_products_found}\n")
for item, result in all_results.items():
if result["products"]:
top_product = result["products"][0]
print(
f"• {item.upper()}: {top_product['name']} ({top_product['size']})"
)
if __name__ == "__main__":
main()Search the SPAR brand product catalog by keyword. Returns matching products with their name, description, size, and image URL. The search matches against product names and descriptions. Prices are not available on this site as they vary by store location.
| Param | Type | Description |
|---|---|---|
| queryrequired | string | Search term to find products by name or description (e.g. 'milk', 'bread', 'coconut'). |
{
"type": "object",
"fields": {
"query": "string",
"products": "array of product objects with product_id, name, description, size, and image_url",
"total_results": "integer"
},
"sample": {
"query": "bread",
"products": [
{
"name": "brown bread wheat flour",
"size": "12.5kg",
"image_url": "https://www.spar.co.za/CMSWebParts/SPAR/Brands/BrandImage.aspx?thumb=false&Id=799",
"product_id": "799",
"description": "Finest quality flour for home made brown bread"
}
],
"total_results": 5
}
}About the SPAR API
What the API Returns
The search_products endpoint accepts a single query string parameter and returns a list of matching SPAR South Africa products. Each product object includes a product_id, name, description, size, and image_url. The response also includes a total_results count and echoes back the original query string for reference. Searches match against both product names and descriptions, so terms like 'coconut' will surface items whose descriptions mention the ingredient even if it is not in the product name.
Coverage and Scope
The catalog reflects SPAR's branded product range for South Africa, covering categories such as dairy, bakery, beverages, snacks, canned goods, and household products. Because SPAR South Africa prices are set at the individual store level, price data is not available in any response field — this is a fundamental characteristic of the source, not a gap in the endpoint.
Using the Data
The image_url field returns a direct link to the product image, suitable for rendering in a storefront or comparison tool. The size field carries the pack or volume information (e.g. 500ml, 1kg) as a string, which can be used for unit-based filtering in downstream logic. Product IDs are stable identifiers useful for deduplicating results or building persistent product references.
The SPAR API is a managed, monitored endpoint for spar.co.za — not a raw scraper you maintain. Every endpoint is automatically health-checked on a schedule, and when spar.co.za 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 spar.co.za 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 grocery list app that resolves typed item names to canonical SPAR product entries with images and descriptions.
- Populate a nutrition or meal-planning tool with SPAR product data keyed by ingredient keyword.
- Create a product comparison page that shows SPAR catalog entries alongside other South African retailers.
- Generate a product image gallery for SPAR items by querying category keywords and collecting image_url fields.
- Validate whether a specific branded product (e.g. SPAR house-brand bread) exists in the catalog before listing it in a menu or app.
- Feed a search autocomplete widget that resolves partial grocery terms to full SPAR product names and sizes.
| 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 SPAR South Africa offer an official developer API?+
Why are prices missing from the product results?+
Can I retrieve products by category or browse the full catalog?+
query parameter and returns matching products with name, description, size, and image_url. Category-level browsing or a full catalog dump is not covered. You can fork the API on Parse and revise it to add a category-browsing endpoint.Does the API return store locations or stock availability?+
How specific can my search query be?+
query parameter matches against product names and descriptions, so both broad terms ('milk') and more specific phrases ('low fat yoghurt') are valid. The total_results field in the response indicates how many products matched, which is useful for deciding whether to broaden or narrow the search term.