> ## Documentation Index
> Fetch the complete documentation index at: https://docs.responsibleailabs.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# India DPDP: अवलोकन

> India DPDP Act 2023 compliance का पूरा suite: सात endpoints जो PII scanning, decision gating, event logging, regulatory timers, और audit evidence के लिए हैं — पूरे integration flow के साथ।

<Info>
  **Concept:** [India DPDP guide](/concepts/india-dpdp) | **SDK:** [Python DPDP](/sdk/python/dpdp) | **Frameworks:** [Compliance overview](/api-reference/compliance-overview)
</Info>

India DPDP suite, **Digital Personal Data Protection Act, 2023** को AI systems के लिए operationalize करता है। जहां एक one-shot compliance check यह सवाल करता है कि "क्या यह text अभी compliant है?", DPDP suite एक data principal की पूरी journey को cover करता है: Indian personal data को detect करना, Act की obligations के against decisions को gate करना, उन events को record करना जो compliance को prove करते हैं, statutory deadlines को track करना, और demand पर audit-grade evidence produce करना।

सभी सात endpoints एक ही base path के तहत हैं और same envelope return करते हैं, तो आप इन्हें incrementally adopt कर सकते हैं — `scan` से शुरु करें, जब आपको stateful tracking चाहिए तब `session` और `emit` add करें, और audit के समय `evidence` के लिए पहुंचें।

```
https://api.responsibleailabs.ai/railscore/v1/compliance/dpdp
```

## DPDP चलाने के दो तरीके

RAIL एक ही DPDP capability को दो paths पर ship करता है जिनमें opposite data-flow guarantees हैं। यह page **hosted** API को document करता है।

<CardGroup cols={2}>
  <Card title="Hosted (यह API)" icon="cloud">
    आपकी application `api.responsibleailabs.ai` को content भेजती है। Multi-tenant, org-scoped, प्रति call बिल किया जाता है। इस page पर सबकुछ यहां चलता है।
  </Card>

  <Card title="Enterprise self-hosted" icon="server">
    RAIL agent आपके अपने VPC या air-gapped environment के अंदर चलता है; content आपके infrastructure को कभी नहीं छोड़ता। एक ही सात endpoints वहां single-tenant, licensed deployments के लिए mirrored हैं।
  </Card>
</CardGroup>

## सात endpoints

| Endpoint                                    | Method | Credits | यह क्या करता है                                                                                                                                                                                |
| ------------------------------------------- | ------ | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [`/scan`](/api-reference/dpdp-scan)         | POST   | 0.5     | Indian PII (Aadhaar with Verhoeff checksum, PAN, UPI, mobile, और 6 और) को detect करें, child signals (S.9) को detect करें, और purpose drift (S.4) को detect करें। Detect, mask, या block करें। |
| [`/evaluate`](/api-reference/dpdp-evaluate) | POST   | 0.3     | एक action के लिए deterministic `allow` / `block` / `require_action` gate, DPDP S.4–S.16 में mapped।                                                                                            |
| [`/emit`](/api-reference/dpdp-emit)         | POST   | 0.1     | 1–50 compliance events (consent, notice, DSR, breach) को record करें। Auto-starts regulatory timers।                                                                                           |
| [`/require`](/api-reference/dpdp-require)   | POST   | 0.3     | एक दिए गए workflow step के लिए required actions को list करें।                                                                                                                                  |
| [`/evidence`](/api-reference/dpdp-evidence) | POST   | 2.0     | एक audit-grade evidence packet generate करें (DSR response, breach notification, consent audit, SDF annual report)। Pro+ plans।                                                                |
| [`/session`](/api-reference/dpdp-session)   | POST   | 0       | एक data-principal journey के लिए एक stateful compliance session create या retrieve करें।                                                                                                       |
| [`/timers`](/api-reference/dpdp-timers)     | GET    | 0       | Regulatory deadline timers को list करें, status, type, या कितनी जल्दी due हैं के आधार पर filter करें।                                                                                          |

<Tip>
  हर DPDP route पर billing **fire-and-forget by design** है — एक billing hiccup कभी भी compliance decision को block नहीं करता। जब आपको एक चाहिए तो [`/verify`](/api-reference/overview) को use करें एक pre-flight balance check के लिए। `session` और `timers` हमेशा free हैं।
</Tip>

## कैसे pieces एक साथ fit होते हैं

एक typical integration एक single **session** को user की journey के through thread करता है। Events जो आप `emit` करते हैं वह session state को mutate करते हैं और statutory timers start करते हैं; `scan` और `evaluate` in-the-moment decisions करते हैं; `evidence` accumulated trail को read करता है जब एक auditor या regulator पूछता है।

```mermaid theme={null}
flowchart TD
    Start(["Data principal journey begins"]) --> Session["POST /session — create<br/>(purpose required)"]
    Session --> Notice["POST /emit — notice.shown"]
    Notice --> Consent["POST /emit — consent.granted"]
    Consent --> Scan["POST /scan — Indian PII detect करें<br/>+ child signals + purpose drift"]
    Scan --> Gate{"POST /evaluate<br/>allow / block / require_action?"}
    Gate -- "allow" --> Proceed["Data को process करें"]
    Gate -- "require_action" --> Require["POST /require — obligations को list करें"]
    Gate -- "block" --> Stop["Halt और remediate करें"]
    Proceed --> DSR["POST /emit — dsr.received / breach.detected"]
    DSR --> Timers["GET /timers — S.13 / breach deadlines को track करें"]
    Timers --> Evidence["POST /evidence — audit packet on demand"]
```

## Response envelope

हर endpoint same two-key envelope return करता है। `result` endpoint-specific payload को hold करता है; `credits_consumed` report करता है कि call की cost क्या थी।

```json theme={null}
{
  "result": { "...": "endpoint-specific" },
  "credits_consumed": 0.5
}
```

## Authentication

सभी routes को एक Bearer token की जरूरत है — एक API key (`rail_...`) या एक JWT। इसे हर request पर pass करें:

```bash theme={null}
-H "Authorization: Bearer YOUR_RAIL_API_KEY"
```

## एक पूरा walkthrough

नीचे का flow एक loan-application journey को end to end track करता है। यह [curl](https://curl.se) use करता है; [Python SDK](/sdk/python/dpdp) हर call को `client.dpdp.*` के रूप में mirror करता है।

<Steps>
  <Step title="एक session खोलें">
    एक session events, scans, और timers को एक data-principal journey से tie करता है। `config.purpose` required है।

    ```bash theme={null}
    curl -X POST https://api.responsibleailabs.ai/railscore/v1/compliance/dpdp/session \
      -H "Authorization: Bearer YOUR_RAIL_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "action": "create",
        "config": { "purpose": "loan_advisory", "entity_type": "data_fiduciary" }
      }'
    ```

    Response एक `session_id` return करता है जिसे आप later calls पर reuse करते हैं।
  </Step>

  <Step title="Notice और consent को record करें">
    `emit` उन events को write करता है जो बाद में prove करते हैं कि आपने अपने notice (S.5) और consent (S.6) obligations को meet किया।

    ```bash theme={null}
    curl -X POST https://api.responsibleailabs.ai/railscore/v1/compliance/dpdp/emit \
      -H "Authorization: Bearer YOUR_RAIL_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "session_id": "sess_1a2b3c",
        "events": [
          { "type": "notice.shown", "data": { "user_id": "u_42" } },
          { "type": "consent.granted", "data": { "user_id": "u_42", "purpose": "loan_advisory" } }
        ]
      }'
    ```
  </Step>

  <Step title="Content को Indian PII के लिए scan करें">
    Store या send करने से पहले model output को scan करें। `pii_action` को `detect`, `mask`, या `block` कर सकता है।

    ```bash theme={null}
    curl -X POST https://api.responsibleailabs.ai/railscore/v1/compliance/dpdp/scan \
      -H "Authorization: Bearer YOUR_RAIL_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "content": "Applicant PAN ABCDE1234F, mobile 9876543210.",
        "config": { "pii_action": "mask", "purpose": "loan_advisory" }
      }'
    ```
  </Step>

  <Step title="Decision को gate करें">
    `evaluate` action के लिए एक deterministic verdict return करता है जो आप लेने वाले हैं।

    ```bash theme={null}
    curl -X POST https://api.responsibleailabs.ai/railscore/v1/compliance/dpdp/evaluate \
      -H "Authorization: Bearer YOUR_RAIL_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "action": "make_decision",
        "context": { "user_id": "u_42", "purpose": "loan_advisory" },
        "session_id": "sess_1a2b3c"
      }'
    ```

    एक `verdict` का `require_action` आपको बताता है कि outstanding obligations के लिए `/require` को call करें।
  </Step>

  <Step title="Deadlines को track करें और evidence produce करें">
    जब एक data principal एक right exercise करता है या एक breach होता है, तब `emit` statutory timer start करता है; `timers` list करता है कि क्या approaching है; `evidence` audit packet को assemble करता है।

    ```bash theme={null}
    # एक rights request S.13 response clock को start करता है
    curl -X POST https://api.responsibleailabs.ai/railscore/v1/compliance/dpdp/emit \
      -H "Authorization: Bearer YOUR_RAIL_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{ "events": [ { "type": "dsr.received", "data": { "user_id": "u_42", "request_id": "r_9" } } ] }'

    # अगले 30 दिनों में क्या due है?
    curl "https://api.responsibleailabs.ai/railscore/v1/compliance/dpdp/timers?status=active&approaching_days=30" \
      -H "Authorization: Bearer YOUR_RAIL_API_KEY"
    ```
  </Step>
</Steps>

## Errors

DPDP routes standard HTTP status codes को use करते हैं। Validation problems `400` return करते हैं एक `error` message के साथ; `evidence` एक plan पर जो Pro से नीचे है `403` return करता है `code: TIER_INSUFFICIENT` के साथ।

```json theme={null}
{ "error": "Evidence generation requires Pro+ tier.", "code": "TIER_INSUFFICIENT" }
```

<Warning>
  DPDP suite कभी भी raw content या detected PII values को log नहीं करता — केवल analytics के लिए एक truncated, non-identifying snippet। Aadhaar, PAN, और अन्य identifiers को mask या drop किया जाता है इससे पहले कि कुछ भी written हो।
</Warning>

## अगला कहां जाएं

<CardGroup cols={2}>
  <Card title="India DPDP guide" icon="book" href="/concepts/india-dpdp">
    Suite के पीछे की concepts: obligations, lifecycle, और कौन सी endpoint Act के किस section में map होता है।
  </Card>

  <Card title="Python SDK: DPDP" icon="python" href="/sdk/python/dpdp">
    हर endpoint एक typed `client.dpdp.*` method के रूप में, plus client-side PII scanning और system audit।
  </Card>

  <Card title="Scan endpoint" icon="magnifying-glass-chart" href="/api-reference/dpdp-scan">
    Indian PII detection, child signals, और purpose drift detail में।
  </Card>

  <Card title="Evidence endpoint" icon="file-shield" href="/api-reference/dpdp-evidence">
    Audit-grade packets DSR, breach, consent, और SDF reporting के लिए।
  </Card>
</CardGroup>
