Esc to close · ⌘K / Ctrl-K opens search anywhere
Combine residency, zero-retention and client-side redaction to process personal data responsibly.
india_only + zero-retention + redactionSovereigntyIntermediate15 min
The Digital Personal Data Protection Act, 2023 governs how you process the personal data of people in India. BharatRouter gives you three technical controls that map directly onto DPDP principles — you still own the obligations, but the gateway makes them enforceable.
data_policy: "india_only" keeps inference with India-resident providers and fails closed (no_route) rather than leaving India.Best practice is to strip identifiers you don't actually need the model to see, then pin residency for whatever remains:
import re
from openai import OpenAI
client = OpenAI(base_url="https://api.bharatrouter.com/v1", api_key="br-...")
# Minimise: drop identifiers the model does not need to do its job.
def redact(text: str) -> str:
text = re.sub(r"\b\d{4}\s?\d{4}\s?\d{4}\b", "[AADHAAR]", text) # Aadhaar
text = re.sub(r"\b[6-9]\d{9}\b", "[PHONE]", text) # Indian mobile
text = re.sub(r"[\w.+-]+@[\w-]+\.[\w.-]+", "[EMAIL]", text) # email
return text
prompt = redact(customer_message)
r = client.chat.completions.create(
model="gemma-4-e4b-it",
messages=[{"role": "user", "content": prompt}],
extra_body={"data_policy": "india_only"}, # residency for whatever remains
)What this is — and isn’t. BharatRouter provides the technical controls; it does not make your application "DPDP-compliant" by itself. The data fiduciary for the service is Krutrim SI Designs Private Limited — see the DPDP declaration for the retention, fiduciary and grievance details.
BYOK caveat: a request routed to a non-India upstream via BYOK leaves India under your provider agreement — residency and these controls apply to platform routes, not your offshore keys.
More recipes in the Cookbook, or see the fullAPI reference.