> ## 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.

# DPDP: Emit Events

> Record DPDP compliance events for audit evidence. Automatic session state updates and timer creation for DSR SLAs, breach notifications, and retention deadlines.

<Info>
  **Overview:** [Compliance API](/api-reference/compliance-overview) | **Credits:** 0.1 per call (up to 50 events)
</Info>

Fire-and-forget event recording. Events are stored as tamper-evident compliance evidence and feed into [`/evaluate`](/api-reference/dpdp-evaluate) and [`/require`](/api-reference/dpdp-require) decisions.

## Parameters

<ParamField body="session_id" type="string">
  Links events to a [compliance session](/api-reference/dpdp-session). When provided, events automatically update session state.
</ParamField>

<ParamField body="events" type="array" required>
  1-50 events per call.
</ParamField>

<ParamField body="events[].type" type="string" required>
  Event type from the taxonomy below.
</ParamField>

<ParamField body="events[].timestamp" type="string">
  ISO-8601 timestamp. Defaults to server time if omitted.
</ParamField>

<ParamField body="events[].data" type="object" required>
  Event-specific payload. Include `user_id`, `purpose`, and any relevant identifiers.
</ParamField>

## Event type taxonomy

| Category           | Event Types                                                                                                     |
| ------------------ | --------------------------------------------------------------------------------------------------------------- |
| **Consent/Notice** | `notice.shown`, `consent.granted`, `consent.refused`, `consent.withdrawn`                                       |
| **Decisions**      | `decision.made`, `explanation.shown`, `appeal.opened`, `appeal.resolved`                                        |
| **DSR**            | `dsr.received`, `dsr.acknowledged`, `dsr.responded`, `dsr.escalated`                                            |
| **Data Lifecycle** | `data.collected`, `data.shared`, `data.transferred`, `retention.started`, `erasure.executed`, `breach.detected` |
| **Children**       | `child.detected`, `child.parental_consent`, `child.tracking_attempted`, `child.aged_out`                        |
| **Model**          | `model.deployed`, `model.retrained`                                                                             |
| **Aggregate**      | `aggregate.fairness_metrics`, `aggregate.decision_stats`                                                        |

## Session state side effects

Events automatically update session state when a `session_id` is provided:

| Event Type               | State Change                                                                       |
| ------------------------ | ---------------------------------------------------------------------------------- |
| `consent.granted`        | Sets purpose consent to "active"; adds `consent_obtained` to fulfilled obligations |
| `consent.withdrawn`      | Sets purpose consent to "withdrawn"                                                |
| `notice.shown`           | Sets `notice_shown = true`; adds `notice_shown` to fulfilled obligations           |
| `child.detected`         | Sets `child_session = true`                                                        |
| `child.parental_consent` | Adds `parental_consent_obtained` to fulfilled obligations                          |
| `decision.made`          | Adds `decision_communicated` to fulfilled obligations                              |
| `explanation.shown`      | Adds `explanation_shown` to fulfilled obligations                                  |

## Timer auto-creation

Some events automatically start compliance timers with regulatory deadlines:

| Event               | Timer Type                | Deadline                          |
| ------------------- | ------------------------- | --------------------------------- |
| `dsr.received`      | `dsr_sla`                 | 90 days (Rule 14(3))              |
| `breach.detected`   | `certin_notification`     | 6 hours (CERT-In Directions 2022) |
| `breach.detected`   | `dpbi_initial_intimation` | Immediate                         |
| `breach.detected`   | `dpbi_detailed_report`    | 72 hours (Rule 7)                 |
| `retention.started` | `pre_erasure_notice`      | retention\_days - 2               |
| `retention.started` | `erasure_execution`       | retention\_days                   |

## Request

```bash theme={null}
curl -X POST https://api.responsibleailabs.ai/railscore/v1/compliance/dpdp/emit \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_RAIL_API_KEY" \
  -d '{
    "session_id": "sess_abc123def456",
    "events": [
      {
        "type": "consent.granted",
        "timestamp": "2026-05-14T08:13:55Z",
        "data": {
          "user_id": "u_hashed_abc",
          "purpose": "credit_scoring",
          "notice_id": "notice_2026_v3",
          "method": "explicit_checkbox",
          "withdrawal_mechanism": "settings_page"
        }
      }
    ]
  }'
```

## Response

```json theme={null}
{
  "result": {
    "accepted": 1,
    "rejected": 0,
    "events": [
      {
        "event_id": "evt_abc123def456",
        "type": "consent.granted",
        "status": "recorded",
        "timers_started": [],
        "state_changes": ["consent_status", "fulfilled_obligations"]
      }
    ]
  },
  "credits_consumed": 0.1
}
```

<ResponseField name="result.accepted" type="integer">
  Number of events successfully recorded.
</ResponseField>

<ResponseField name="result.rejected" type="integer">
  Number of events that failed validation.
</ResponseField>

<ResponseField name="result.events" type="array">
  Per-event results. Each includes `event_id`, `type`, `status` (`"recorded"` or `"rejected"`), `timers_started` (timer IDs created by this event), and `state_changes` (session fields updated).
</ResponseField>
