2 min read
Send the ETag back
etag = cache.get('products_etag')
headers = {'If-None-Match': etag} if etag else {}
r = requests.get(f'{BASE}/products', headers=headers, timeout=10)
if r.status_code == 304:
return cache.get('products') # unchanged
r.raise_for_status()
cache.set('products_etag', r.headers.get('ETag'))
cache.set('products', r.json()['data'])
When it helps
Conditional requests shine when you poll reference data that rarely changes. You still make the request, but a 304 skips the body, saving bandwidth and parsing on every unchanged poll.
Frequently asked questions
Do all endpoints send an ETag?
Cacheable reference endpoints do. If no ETag is present, fall back to Cache-Control and a TTL.
Does a 304 count against rate limits?
Treat it like any request. It saves bandwidth, not a request slot, so still cache and avoid tight polling.
Related reading

Quickstart: Cache the product catalogue correctly
The catalogue changes rarely, so caching it removes the API from your hot path and keeps you well under the…
Read →
Quickstart: handle rate limits on the public API
The public ring is rate-limited, and a 429 tells you exactly when to try again. Read the RateLimit-Remaining…
Read →
Quickstart: list Credicorp business-finance products
GET /public/v1/products returns the live catalogue of Credicorp business-finance products. Each item carries…
Read →
Quickstart: handle Credicorp API error responses
Every Credicorp API error uses the same envelope: { error: { type, code, message, request_id } }. Branch on…
Read →Funding for UK limited companies
Credicorp lends to your company, not to you personally — short-term working capital with no personal guarantee. See what your business could access.