5ka API5ka.ru ↗
Access Pyaterochka's product catalog, real-time pricing, nutritional info, special offers, and store locations via the 5ka.ru API.
What is the 5ka API?
The 5ka.ru API covers Pyaterochka's grocery catalog across 5 endpoints, giving you access to product listings, category trees, per-product nutritional values, active promotions, and physical store locations. The get_products endpoint accepts keyword search, category filtering, price sorting, and store-scoped queries, while get_product_detail returns per-100g macronutrient breakdowns including proteins, fats, carbohydrates, and calories.
No input parameters required.
curl -X GET 'https://api.parse.bot/scraper/aae3e5f6-fa2a-444d-9fb9-c4bbdf7aced1/get_categories' \ -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 5ka-ru-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.
"""
Pyaterochka (5ka.ru) API Client
This module provides a Python client for the Parse API to interact with
Pyaterochka (5ka.ru) product catalog, categories, pricing, and store information.
Get your API key from: https://parse.bot/settings
"""
import os
import requests
from typing import Optional, Any, Dict, List
class ParseClient:
"""Client for interacting with Pyaterochka Parse 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 = "ae4a3593-8723-4991-8373-5de87af48eed"
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 it directly."
)
def _call(
self, endpoint: str, method: str = "POST", **params
) -> Dict[str, Any]:
"""
Make an API call to the Parse API.
Args:
endpoint: The API endpoint name.
method: HTTP method (GET or POST).
**params: Additional parameters for the request.
Returns:
Response data as a dictionary.
"""
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 get_categories(self) -> Dict[str, Any]:
"""
Fetch all top-level product categories.
Returns:
Dictionary containing categories with 'count' and 'results' fields.
"""
return self._call("get_categories", method="GET")
def get_products(
self,
query: Optional[str] = None,
store_id: Optional[str] = None,
page: int = 1,
limit: int = 20,
category_code: Optional[str] = None,
order_by: Optional[str] = None,
) -> Dict[str, Any]:
"""
Fetch a paginated list of products with optional filters.
Args:
query: Search keyword.
store_id: Filter by store ID (SAP code).
page: Page number (default: 1).
limit: Number of items per page (default: 20).
category_code: Filter by category ID/code.
order_by: Field to sort by (e.g., 'price', '-price').
Returns:
Dictionary containing products with pagination info and 'results' field.
"""
params = {
"page": page,
"limit": limit,
}
if query:
params["query"] = query
if store_id:
params["store_id"] = store_id
if category_code:
params["category_code"] = category_code
if order_by:
params["order_by"] = order_by
return self._call("get_products", method="GET", **params)
def get_product_detail(self, product_id: str) -> Dict[str, Any]:
"""
Fetch full detail for a single product, including nutritional values.
Args:
product_id: Unique product ID (PLU).
Returns:
Dictionary containing product details including nutritional information.
"""
return self._call("get_product_detail", method="GET", product_id=product_id)
def get_special_offers(
self, store_id: Optional[str] = None, page: int = 1, limit: int = 20
) -> Dict[str, Any]:
"""
Fetch products currently on sale or promotion.
Args:
store_id: Store ID (SAP code).
page: Page number (default: 1).
limit: Number of items per page (default: 20).
Returns:
Dictionary containing promotional products with 'results' field.
"""
params = {
"page": page,
"limit": limit,
}
if store_id:
params["store_id"] = store_id
return self._call("get_special_offers", method="GET", **params)
def get_stores(self) -> Dict[str, Any]:
"""
Fetch store locations and details.
Returns:
Dictionary containing store information with 'results' field.
"""
return self._call("get_stores", method="GET")
def main():
"""Demonstrate practical usage of the ParseClient."""
# Initialize the client
client = ParseClient()
print("=" * 60)
print("Pyaterochka (5ka.ru) API Client - Practical Usage Example")
print("=" * 60)
# Step 1: Get all available stores
print("\n1. Fetching available stores...")
stores_data = client.get_stores()
stores = stores_data.get("results", [])
print(f" Found {len(stores)} stores")
if stores:
first_store = stores[0]
print(f" Example store: {first_store.get('address')} (ID: {first_store.get('id')})")
store_id = str(first_store.get("id"))
else:
store_id = None
print(" No stores found, proceeding without store filter")
# Step 2: Get product categories
print("\n2. Fetching product categories...")
categories_data = client.get_categories()
categories = categories_data.get("results", [])
print(f" Found {categories_data.get('count', 0)} categories")
if categories:
# Show first few categories
for i, category in enumerate(categories[:3]):
print(f" - {category.get('name')} (ID: {category.get('id')})")
# Step 3: Get special offers/promotions
print("\n3. Fetching special offers and promotions...")
params = {"limit": 5}
if store_id:
params["store_id"] = store_id
offers_data = client.get_special_offers(**params)
offers = offers_data.get("results", [])
print(f" Found {len(offers)} promotional items")
if offers:
print("\n Promotional Products:")
for offer in offers:
regular_price = offer.get("price_regular")
promo_price = offer.get("price_promo")
discount = (
((regular_price - promo_price) / regular_price * 100)
if regular_price
else 0
)
print(
f" - {offer.get('name')}: {promo_price} ₽ (was {regular_price} ₽, -{discount:.0f}%)"
)
# Step 4: Search for products (e.g., dairy products)
print("\n4. Searching for 'milk' products...")
search_params = {"query": "milk", "limit": 5}
if store_id:
search_params["store_id"] = store_id
search_results = client.get_products(**search_params)
products = search_results.get("results", [])
print(f" Found {search_results.get('count', 0)} products matching 'milk'")
# Step 5: Get details for each product from search
if products:
print("\n5. Fetching detailed information for search results...")
for i, product in enumerate(products[:3]):
product_id = str(product.get("id"))
print(f"\n Product {i + 1}: {product.get('name')}")
print(f" - Price: {product.get('price')} ₽")
# Get detailed information including nutritional data
try:
detail = client.get_product_detail(product_id)
nutritional = detail.get("nutritional_value", {})
if nutritional:
print(
f" - Nutritional Info (per 100g):"
)
print(
f" • Calories: {nutritional.get('calories')} kcal"
)
print(
f" • Proteins: {nutritional.get('proteins')} g"
)
print(
f" • Fats: {nutritional.get('fats')} g"
)
print(
f" • Carbohydrates: {nutritional.get('carbohydrates')} g"
)
except Exception as e:
print(f" - Could not fetch details: {e}")
# Step 6: Browse products by category with sorting
if categories:
sample_category = categories[0]
category_id = str(sample_category.get("id"))
print(f"\n6. Browsing products in category '{sample_category.get('name')}'...")
params = {"category_code": category_id, "limit": 5, "order_by": "price"}
if store_id:
params["store_id"] = store_id
category_products = client.get_products(**params)
category_results = category_products.get("results", [])
if category_results:
print(f" Found {category_products.get('count', 0)} products in this category")
print(" Top 5 cheapest products in category:")
for i, product in enumerate(category_results[:5], 1):
print(
f" {i}. {product.get('name')} - {product.get('price')} ₽"
)
else:
print(" No products found in this category")
print("\n" + "=" * 60)
print("API Usage Example Complete!")
print("=" * 60)
if __name__ == "__main__":
main()Fetch all top-level product categories.
No input parameters required.
{
"type": "object",
"fields": {
"next": "string (nullable)",
"count": "integer",
"results": "array of objects (id, parent_group, name, image_url)",
"previous": "string (nullable)"
},
"sample": {
"next": null,
"count": 100,
"results": [
{
"id": 1,
"name": "Milk & Eggs",
"image_url": "https://...",
"parent_group": null
}
],
"previous": null
}
}About the 5ka API
Product Catalog and Search
The get_products endpoint returns a paginated list of Pyaterochka products. You can filter by category_code, pass a free-text query for keyword search, sort with order_by (e.g. price or -price), and scope results to a specific store using its SAP code via store_id. Responses include product id, name, price, and a nutritional_value object. Pagination is handled through page and limit parameters, with next and previous cursor URLs returned alongside a total count.
Product Detail and Nutrition
get_product_detail accepts a single product_id (PLU code) and returns the full record for that item: id, name, price, and a structured nutritional_value object containing proteins, fats, carbohydrates, and calories. This makes it suitable for building nutrition-tracking applications or enriching a product database with macro data at scale.
Categories, Promotions, and Stores
get_categories returns the full top-level category tree, where each entry includes an id, optional parent_group, name, and image_url. The category_code returned here maps directly to the filter parameter on get_products. get_special_offers exposes products currently under promotion, returning both the regular price and a promo_price for each item; results can be filtered by store_id and paginated. get_stores returns a list of Pyaterochka locations with each store's id, address, city, and geographic coordinates (lat, lon).
The 5ka API is a managed, monitored endpoint for 5ka.ru — not a raw scraper you maintain. Every endpoint is automatically health-checked on a schedule, and when 5ka.ru 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 5ka.ru 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 price tracker that monitors Pyaterochka product prices and flags drops using
get_productswithorder_by=price. - Power a nutrition calculator app by pulling per-product macronutrient data (proteins, fats, carbohydrates, calories) from
get_product_detail. - Aggregate active promotional deals across stores using
get_special_offersfiltered bystore_idto compare promo prices. - Populate a store-locator feature with Pyaterochka branch addresses and GPS coordinates from
get_stores. - Synchronize a category-browse interface by mapping
get_categoriesresults to product listings via thecategory_codefilter onget_products. - Alert users to weekly promotions by diffing
get_special_offersresponses over time and surfacing newpromo_priceentries. - Research grocery assortment by querying
get_productswith a keyword and paginating through results to collect SKU-level data.
| 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 5ka.ru have an official public developer API?+
What does `get_special_offers` return, and can I filter it by region?+
get_special_offers returns products currently on promotion, including both the regular price and the discounted promo_price for each item. You can filter results to a specific store by passing its SAP code as store_id, which effectively gives you store-scoped deal data. Pagination is available via page and limit.Does the API expose product reviews, ratings, or user-generated content?+
Can I look up stores by city or geographic bounding box?+
get_stores returns all store locations at once with lat and lon fields for each record, but it does not accept filter parameters for city or geographic bounds. Client-side filtering by city name or proximity math against the coordinates is needed. You can fork the API on Parse and revise to add server-side geo filtering if needed.How fresh is the pricing and promotional data?+
get_special_offers regularly is advisable if you need timely deal data.