How Indian businesses can build AI features that respect personal data, test for bias and stay aligned with the principles of the Digital Personal Data Protection Act, 2023.
Most AI features in business software touch personal data sooner or later. A support chatbot reads a customer's order history, a resume screener reads candidates' CVs, a school app summarises student progress reports. Every one of those prompts carries names, phone numbers, addresses or worse, and every one of them can end up in a log file, a vendor's system or a training dataset that nobody remembers creating.
In India this is no longer only a question of good practice. The Digital Personal Data Protection Act, 2023 (DPDP Act) sets out how organisations may collect and process digital personal data, and AI systems are not exempt. Alongside legal duties sits a broader responsibility: models can treat people unfairly, and users deserve to know when a machine is involved. This article walks through the practical engineering decisions that keep an AI feature on the right side of both.
Know where personal data enters your AI pipeline
Before you can protect personal data, you need a map of where it flows. In a typical AI feature, personal data can enter at several points:
- Prompts at runtime: user messages, retrieved records and documents inserted into the context window.
- Retrieval indexes: vector databases built from CRM notes, emails, tickets or uploaded files.
- Fine-tuning or training data: historical records used to adapt a model to your domain.
- Logs and analytics: request and response bodies stored for debugging or quality review.
- Third-party processors: the model provider, hosting company and any monitoring tools that see the data.
Draw this as a simple data-flow diagram for each feature. For every arrow, note what personal data travels, where it is stored, for how long and who can access it.
Consent and purpose limitation, in plain terms
At a high level, the DPDP Act is built around a few principles that matter directly to AI work. Personal data should be processed for a lawful purpose, generally on the basis of consent that is free, specific, informed and unambiguous, or for certain legitimate uses the Act recognises. The person (the "Data Principal") should be told what data is collected and why. Data should be limited to what is needed for that purpose, kept accurate, protected with reasonable security safeguards and not kept longer than necessary. People also have rights, such as accessing information about their data, seeking correction and erasure, and having grievances addressed.
For AI engineering, the most important implication is purpose limitation. If a customer shared their phone number to receive delivery updates, quietly using their support conversations to train a sales model is a different purpose. Ask, for every new AI use of existing data: was this purpose covered when the data was collected? If not, you may need fresh consent or a different approach, such as anonymised or synthetic data.
The rules made under the Act, and how they are interpreted, continue to develop. Treat this section as orientation, not legal advice, and consult legal counsel before launching AI features that process personal data at scale.
Minimise what the model sees
The cheapest personal data to protect is the data you never send. Practical techniques include:
- Redact before the prompt: replace phone numbers, email addresses, Aadhaar-like numbers and PAN with placeholders before text reaches the model, and re-insert values afterwards only if the output really needs them.
- Retrieve narrowly: fetch only the fields needed for the task. An order-status answer needs the order state and expected date, not the customer's full profile.
- Respect access control in retrieval: a user should only be able to retrieve documents they could already open in your application. Filter the vector search by tenant and user permissions.
- Check vendor terms: confirm whether your model provider stores prompts, for how long, in which region, and whether they are used for training. Choose settings and contracts that match your obligations.
A simple redaction step can be a few lines of code. It will not catch everything, but it removes the most common identifiers from logs and prompts:
import re
PATTERNS = {
"EMAIL": re.compile(r"[\w.+-]+@[\w-]+\.[\w.-]+"),
"PHONE": re.compile(r"(?:\+91[\s-]?)?[6-9]\d{9}\b"),
"PAN": re.compile(r"\b[A-Z]{5}\d{4}[A-Z]\b"),
}
def redact(text: str) -> str:
for label, pattern in PATTERNS.items():
text = pattern.sub(f"[{label}]", text)
return text
print(redact("Call me on +91 9876543210 or mail asha@example.com"))
# Call me on [PHONE] or mail [EMAIL]
Test for bias before and after launch
Bias in AI systems is rarely intentional. It comes from skewed historical data, from proxies such as pin code or college name standing in for caste, religion or income, and from language models that perform better in English than in Hindi, Tamil or Hinglish. In decisions that affect people, such as lending, hiring, admissions or insurance, the consequences are serious.
A workable bias-testing routine for a small team looks like this:
- Define the groups that matter for your use case, such as gender, language, region or age band.
- Build a paired test set: the same input with only the group-related detail changed, for example identical CVs with different names, or the same question in English and Hindi.
- Compare outcomes: approval rates, scores, refusal rates, answer quality and tone across groups.
- Keep a human in the loop for consequential decisions. Let the model assist, rank or summarise, but have a person make and own the final call.
- Re-run the tests whenever you change the model, the prompt or the data source.
Be transparent with users
People should know when they are talking to an AI and what it can and cannot do. Label chatbots clearly, explain in your privacy notice which AI providers process data on your behalf, and give users a way to reach a human. When an AI output informs a decision about someone, keep enough information to explain it later: which model and prompt version were used, which records were retrieved and who approved the result.
Transparency also applies internally. Maintain a short register of AI features listing purpose, data used, model provider, owner and the date of the last review.
Logging and retention without creating a liability
Logs are essential for debugging and quality review, but full prompt and response logs are also one of the largest stores of personal data in an AI system. Set a deliberate policy:
- Log metadata (timestamps, model, token counts, latency, prompt version) by default.
- Store full text only when needed, redacted where possible, with restricted access.
- Set retention periods per log type and delete automatically when they expire.
- Make sure erasure requests reach AI-related stores too: logs, vector indexes and evaluation datasets.
- Record who accessed sensitive logs, and review that access periodically.
A responsible AI checklist
| Area | Question to answer before launch |
|---|---|
| Data map | Do we know every place personal data enters, is stored and leaves? |
| Purpose | Is this AI use covered by the purpose for which the data was collected? |
| Minimisation | Are we redacting identifiers and retrieving only the fields we need? |
| Vendors | Have we checked the provider's storage, region and training terms? |
| Bias | Have we run paired tests across the groups relevant to this feature? |
| Human review | Does a person own consequential decisions? |
| Transparency | Is the AI clearly labelled and described in the privacy notice? |
| Retention | Do logs and indexes have retention limits and support erasure? |
| Legal review | Has legal counsel reviewed the feature against the DPDP Act? |
How NextWebGen can help
NextWebGen builds web and mobile applications with AI features, and we design data flows, redaction, access control, logging and retention into the software from the start rather than bolting them on later. If you are planning an AI feature that handles customer, student or employee data, talk to our team about building it responsibly; we will work alongside your legal adviser on the compliance questions.



