{
  "openapi": "3.1.0",
  "info": {
    "title": "IndiaConsent DPDP API",
    "version": "1.0.0",
    "description": "Enterprise-grade consent management and privacy infrastructure API for India's Digital Personal Data Protection (DPDP) Act, 2023. Enables Data Fiduciaries and AI agents to capture, verify, and revoke consent artifacts, manage Data Principal rights, and process grievances.",
    "contact": {
      "name": "IndiaConsent API Support",
      "email": "support@indiaconsent.com",
      "url": "https://www.indiaconsent.com"
    },
    "license": {
      "name": "Proprietary",
      "url": "https://www.indiaconsent.com/privacy"
    }
  },
  "servers": [
    {
      "url": "https://demo.indiaconsent.com/api/v1",
      "description": "Demo Environment API Server"
    },
    {
      "url": "https://api.indiaconsent.com/v1",
      "description": "Production API Server"
    },
    {
      "url": "https://sandbox.api.indiaconsent.com/v1",
      "description": "Sandbox / Test Environment"
    }
  ],
  "security": [
    {
      "OAuth2": [
        "consent:read",
        "consent:write",
        "consent:withdraw",
        "grievance:manage",
        "rights:request"
      ]
    },
    {
      "ApiKeyAuth": []
    }
  ],
  "paths": {
    "/consents": {
      "post": {
        "summary": "Capture and record consent artifact",
        "description": "Creates an immutable, cryptographically signed DPDP consent artifact capturing explicit consent from a Data Principal across declared purposes and notice translations.",
        "operationId": "createConsentRecord",
        "security": [
          {
            "OAuth2": [
              "consent:write"
            ]
          },
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateConsentRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Consent artifact created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConsentArtifact"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - Validation failed or malformed request payload",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Missing, invalid, or expired authentication token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - Insufficient permissions or scopes for this operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested statutory resource was not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Conflict - Idempotency conflict or duplicate resource mutation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests - Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - Structured error with tracking ID and resolution hint",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/consents/{consentId}": {
      "get": {
        "summary": "Retrieve consent artifact by ID",
        "description": "Fetches the full signed consent artifact record by its unique artifact UUID.",
        "operationId": "getConsentRecord",
        "security": [
          {
            "OAuth2": [
              "consent:read"
            ]
          },
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "consentId",
            "in": "path",
            "required": true,
            "description": "The unique consent artifact UUID",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Consent artifact found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConsentArtifact"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - Validation failed or malformed request payload",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Missing, invalid, or expired authentication token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - Insufficient permissions or scopes for this operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested statutory resource was not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Conflict - Idempotency conflict or duplicate resource mutation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests - Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - Structured error with tracking ID and resolution hint",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/consents/{consentId}/withdraw": {
      "post": {
        "summary": "Withdraw or revoke consent",
        "description": "Executes real-time revocation of a previously granted consent per Section 6(4) of the DPDP Act. Emits revocation webhooks to subscribed downstream data processors within 500ms.",
        "operationId": "withdrawConsent",
        "security": [
          {
            "OAuth2": [
              "consent:withdraw"
            ]
          },
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "consentId",
            "in": "path",
            "required": true,
            "description": "The unique consent artifact UUID to revoke",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WithdrawConsentRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Consent successfully revoked",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConsentWithdrawalResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - Validation failed or malformed request payload",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Missing, invalid, or expired authentication token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - Insufficient permissions or scopes for this operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested statutory resource was not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Conflict - Idempotency conflict or duplicate resource mutation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests - Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - Structured error with tracking ID and resolution hint",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/consents/verify": {
      "post": {
        "summary": "Verify cryptographic consent artifact",
        "description": "Verifies the cryptographic signature, SHA-256 digest, and validity timestamp of a consent artifact against the tamper-proof ledger.",
        "operationId": "verifyConsentArtifact",
        "security": [
          {
            "OAuth2": [
              "consent:read"
            ]
          },
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VerifyArtifactRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Verification result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerifyArtifactResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - Validation failed or malformed request payload",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Missing, invalid, or expired authentication token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - Insufficient permissions or scopes for this operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested statutory resource was not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Conflict - Idempotency conflict or duplicate resource mutation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests - Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - Structured error with tracking ID and resolution hint",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/grievances": {
      "post": {
        "summary": "Lodge DPDP grievance redressal ticket",
        "description": "Submits a Data Principal grievance to the Data Fiduciary's designated Data Protection Officer (DPO) pursuant to Section 13 of the DPDP Act.",
        "operationId": "lodgeGrievance",
        "security": [
          {
            "OAuth2": [
              "grievance:manage"
            ]
          },
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LodgeGrievanceRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Grievance lodged successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GrievanceTicket"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - Validation failed or malformed request payload",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Missing, invalid, or expired authentication token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - Insufficient permissions or scopes for this operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested statutory resource was not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Conflict - Idempotency conflict or duplicate resource mutation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests - Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - Structured error with tracking ID and resolution hint",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/grievances/{ticketId}": {
      "get": {
        "summary": "Get grievance resolution status",
        "description": "Retrieves the current audit status, DPO response, and statutory timeline for a lodged grievance ticket.",
        "operationId": "getGrievanceStatus",
        "security": [
          {
            "OAuth2": [
              "grievance:manage"
            ]
          },
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "ticketId",
            "in": "path",
            "required": true,
            "description": "Unique grievance ticket identifier",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Grievance ticket details",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GrievanceTicket"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - Validation failed or malformed request payload",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Missing, invalid, or expired authentication token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - Insufficient permissions or scopes for this operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested statutory resource was not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Conflict - Idempotency conflict or duplicate resource mutation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests - Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - Structured error with tracking ID and resolution hint",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/rights": {
      "post": {
        "summary": "Submit Data Principal Rights request",
        "description": "Exercises statutory Data Principal rights under Sections 11 (Access/Summary), 12 (Correction/Erasure), or 14 (Nomination).",
        "operationId": "submitRightsRequest",
        "security": [
          {
            "OAuth2": [
              "rights:request"
            ]
          },
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DataPrincipalRightsRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Rights request queued for fulfillment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RightsRequestResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - Validation failed or malformed request payload",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Missing, invalid, or expired authentication token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - Insufficient permissions or scopes for this operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested statutory resource was not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Conflict - Idempotency conflict or duplicate resource mutation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests - Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - Structured error with tracking ID and resolution hint",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "OAuth2": {
        "type": "oauth2",
        "description": "Standard OAuth 2.0 authorization with granular DPDP scopes.",
        "flows": {
          "clientCredentials": {
            "tokenUrl": "https://auth.indiaconsent.com/oauth/token",
            "scopes": {
              "consent:read": "Read consent records and artifacts",
              "consent:write": "Create and capture new consent artifacts",
              "consent:withdraw": "Revoke or withdraw previously granted consent",
              "grievance:manage": "Lodge and track DPDP grievance redressal tickets",
              "rights:request": "Submit and process Data Principal Rights requests"
            }
          },
          "authorizationCode": {
            "authorizationUrl": "https://auth.indiaconsent.com/oauth/authorize",
            "tokenUrl": "https://auth.indiaconsent.com/oauth/token",
            "scopes": {
              "consent:read": "Read consent records and artifacts",
              "consent:write": "Create and capture new consent artifacts",
              "consent:withdraw": "Revoke or withdraw previously granted consent",
              "grievance:manage": "Lodge and track DPDP grievance redressal tickets",
              "rights:request": "Submit and process Data Principal Rights requests"
            }
          }
        }
      },
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key",
        "description": "API key generated from IndiaConsent enterprise dashboard."
      }
    },
    "schemas": {
      "CreateConsentRequest": {
        "type": "object",
        "required": [
          "data_principal_id",
          "purpose_ids",
          "notice_version"
        ],
        "properties": {
          "data_principal_id": {
            "type": "string",
            "description": "Masked or hashed identifier of the Data Principal",
            "example": "dp_9845012345"
          },
          "purpose_ids": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "List of specified purpose identifiers for which consent is granted",
            "example": [
              "analytics",
              "marketing_sms",
              "kyc_verification"
            ]
          },
          "notice_version": {
            "type": "string",
            "description": "Version identifier of the notice presented to the user",
            "example": "v2.1"
          },
          "language": {
            "type": "string",
            "description": "ISO 639-1 code of the language displayed (supports 22 official Indian languages)",
            "default": "en",
            "example": "hi"
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true,
            "description": "Optional contextual metadata (e.g., client IP hash, user agent)"
          }
        }
      },
      "ConsentArtifact": {
        "type": "object",
        "required": [
          "artifact_id",
          "status",
          "created_at",
          "signature",
          "checksum"
        ],
        "properties": {
          "artifact_id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique UUID of the consent artifact",
            "example": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "withdrawn",
              "expired"
            ],
            "example": "active"
          },
          "data_principal_id": {
            "type": "string",
            "example": "dp_9845012345"
          },
          "purposes": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "example": [
              "analytics",
              "marketing_sms"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "example": "2026-09-16T10:00:00Z"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "example": "2027-09-16T10:00:00Z"
          },
          "signature": {
            "type": "string",
            "description": "Cryptographic signature verifying authenticity against IndiaConsent ledger",
            "example": "3045022100e4b8...signed"
          },
          "checksum": {
            "type": "string",
            "description": "SHA-256 digest of artifact payload",
            "example": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
          }
        }
      },
      "WithdrawConsentRequest": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "description": "Reason for withdrawal",
            "example": "No longer using service"
          }
        }
      },
      "ConsentWithdrawalResponse": {
        "type": "object",
        "required": [
          "artifact_id",
          "status",
          "withdrawn_at"
        ],
        "properties": {
          "artifact_id": {
            "type": "string",
            "format": "uuid",
            "example": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
          },
          "status": {
            "type": "string",
            "example": "withdrawn"
          },
          "withdrawn_at": {
            "type": "string",
            "format": "date-time",
            "example": "2026-09-16T12:00:00Z"
          },
          "downstream_webhook_status": {
            "type": "string",
            "example": "propagated"
          }
        }
      },
      "VerifyArtifactRequest": {
        "type": "object",
        "required": [
          "artifact_id"
        ],
        "properties": {
          "artifact_id": {
            "type": "string",
            "format": "uuid",
            "example": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
          },
          "checksum": {
            "type": "string",
            "description": "Optional client-computed SHA-256 checksum to verify tamper-resistance",
            "example": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
          }
        }
      },
      "VerifyArtifactResponse": {
        "type": "object",
        "required": [
          "valid",
          "artifact_id",
          "status"
        ],
        "properties": {
          "valid": {
            "type": "boolean",
            "example": true
          },
          "artifact_id": {
            "type": "string",
            "format": "uuid",
            "example": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
          },
          "status": {
            "type": "string",
            "example": "active"
          },
          "ledger_timestamp": {
            "type": "string",
            "format": "date-time",
            "example": "2026-09-16T10:00:00Z"
          }
        }
      },
      "LodgeGrievanceRequest": {
        "type": "object",
        "required": [
          "data_principal_email",
          "issue_category",
          "description"
        ],
        "properties": {
          "data_principal_email": {
            "type": "string",
            "format": "email",
            "example": "user@example.in"
          },
          "issue_category": {
            "type": "string",
            "enum": [
              "consent_withdrawal",
              "access_request",
              "data_correction",
              "unauthorized_processing",
              "other"
            ],
            "example": "consent_withdrawal"
          },
          "description": {
            "type": "string",
            "example": "Consent was withdrawn on Sept 14 but marketing emails continue to be delivered."
          }
        }
      },
      "GrievanceTicket": {
        "type": "object",
        "required": [
          "ticket_id",
          "status",
          "created_at",
          "statutory_due_date"
        ],
        "properties": {
          "ticket_id": {
            "type": "string",
            "example": "GRV-2026-8819"
          },
          "status": {
            "type": "string",
            "enum": [
              "open",
              "investigating",
              "resolved",
              "escalated_to_dpb"
            ],
            "example": "investigating"
          },
          "dpo_assigned": {
            "type": "string",
            "example": "dpo@indiaconsent.com"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "example": "2026-09-16T09:30:00Z"
          },
          "statutory_due_date": {
            "type": "string",
            "format": "date-time",
            "example": "2026-09-23T09:30:00Z"
          }
        }
      },
      "DataPrincipalRightsRequest": {
        "type": "object",
        "required": [
          "right_type",
          "data_principal_id"
        ],
        "properties": {
          "right_type": {
            "type": "string",
            "enum": [
              "right_to_access",
              "right_to_correction",
              "right_to_erasure",
              "right_to_nomination"
            ],
            "example": "right_to_access"
          },
          "data_principal_id": {
            "type": "string",
            "example": "dp_9845012345"
          },
          "details": {
            "type": "string",
            "example": "Provide summary of personal data processed and identities of third-party fiduciaries."
          }
        }
      },
      "RightsRequestResponse": {
        "type": "object",
        "required": [
          "request_id",
          "status",
          "acknowledged_at"
        ],
        "properties": {
          "request_id": {
            "type": "string",
            "example": "DPR-2026-4421"
          },
          "status": {
            "type": "string",
            "example": "processing"
          },
          "acknowledged_at": {
            "type": "string",
            "format": "date-time",
            "example": "2026-09-16T11:00:00Z"
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "required": [
          "code",
          "message",
          "status"
        ],
        "properties": {
          "type": {
            "type": "string",
            "format": "uri",
            "example": "https://www.indiaconsent.com/errors/invalid-payload",
            "description": "RFC 7807 problem type URI"
          },
          "title": {
            "type": "string",
            "example": "Invalid Request Payload",
            "description": "Short human-readable summary of the problem type"
          },
          "status": {
            "type": "integer",
            "example": 400,
            "description": "HTTP status code"
          },
          "code": {
            "type": "string",
            "example": "INVALID_CONSENT_PAYLOAD",
            "description": "Machine-readable statutory error code"
          },
          "message": {
            "type": "string",
            "example": "The specified purpose_ids array cannot be empty under DPDP Section 6.",
            "description": "Human-readable explanation specific to this occurrence"
          },
          "hint": {
            "type": "string",
            "example": "Provide at least one purpose_id defined in your data fiduciary configuration.",
            "description": "Actionable resolution instructions for AI agents and automated clients"
          },
          "instance": {
            "type": "string",
            "example": "/consents/req_892348",
            "description": "URI reference that identifies the specific occurrence of the problem"
          }
        }
      }
    },
    "parameters": {
      "IdempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": false,
        "description": "Unique UUID v4 idempotency token to ensure mutation safety and prevent duplicate processing on network retries (RFC 9457 / IETF draft)",
        "schema": {
          "type": "string",
          "format": "uuid"
        }
      }
    }
  }
}
