ID Gateway Consent API (0.1.0)

Download OpenAPI specification:Download

OpenAPI specification for the ID Gateway consent management endpoints.

The API provides purpose-based consent management with support for granting, revoking, and listing user consents. All endpoints require authentication via JWT bearer token.

Lifecycle defaults (configurable via env):

  • Consent TTL: CONSENT_TTL (default 365d) sets expiry for new grants and renewals.
  • Grant idempotency window: CONSENT_GRANT_WINDOW (default 5m) makes rapid repeat grants a no-op; timestamps are not updated and the existing consent is returned.

Grant consent for purposes

Grant consent for one or more purposes. If consent already exists for a purpose and is active, it's renewed with a new expiry date. If consent was previously revoked or expired, the same consent ID is reused and updated to active status. Requests arriving within the grant idempotency window (CONSENT_GRANT_WINDOW, default 5m) for an already-active consent are treated as idempotent: no timestamps are updated and the existing consent is returned.

Authorizations:
bearerAuth
Request Body schema: application/json
required
purposes
required
Array of strings (ConsentPurpose) [ 1 .. 50 ] items
Items Enum: "login" "registry_check" "vc_issuance" "decision_evaluation"

List of purposes to grant consent for

Responses

Request samples

Content type
application/json
Example
{
  • "purposes": [
    ]
}

Response samples

Content type
application/json
{
  • "granted": [
    ],
  • "message": "Consent granted for 2 purposes"
}

List user consents

Retrieve all consent records for the authenticated user, including active, expired, and revoked consents. The status field is computed based on the revoked_at and expires_at timestamps. Invalid filter values for status or purpose return a 400 bad_request error.

Authorizations:
bearerAuth
query Parameters
status
string
Enum: "active" "expired" "revoked"

Filter by consent status

purpose
string
Enum: "login" "registry_check" "vc_issuance" "decision_evaluation"

Filter by specific purpose

Responses

Response samples

Content type
application/json
{
  • "consents": [
    ]
}

Revoke consent for purposes

Revoke consent for one or more purposes. Once revoked, future operations requiring that purpose will fail until consent is re-granted. Revoking already revoked or expired consent is idempotent. Missing consents are ignored (no error). The response only includes newly revoked consents.

Authorizations:
bearerAuth
Request Body schema: application/json
required
purposes
required
Array of strings (ConsentPurpose) [ 1 .. 50 ] items
Items Enum: "login" "registry_check" "vc_issuance" "decision_evaluation"

List of purposes to revoke consent for

Responses

Request samples

Content type
application/json
Example
{
  • "purposes": [
    ]
}

Response samples

Content type
application/json
{
  • "revoked": [
    ],
  • "message": "Consent revoked for 1 purpose"
}

Revoke all consents

Revoke all consents for the authenticated user that are not already revoked. This is a bulk operation intended for cleanup and administrative purposes. Expired consents remain expired and are not marked revoked. Returns a message that includes the count of consents revoked.

Authorizations:
bearerAuth

Responses

Response samples

Content type
application/json
Example
{
  • "revoked": null,
  • "message": "Consent revoked for 3 purposes"
}

Revoke all consents for a user (admin)

Authorizations:
adminToken
path Parameters
user_id
required
string

Target user identifier

Responses

Response samples

Content type
application/json
Example
{
  • "revoked": null,
  • "message": "Consent revoked for 3 purposes"
}

consent

Delete all consents (GDPR)

Permanently delete all consent records for the authenticated user. This is a destructive operation intended for GDPR "right to erasure" (Article 17) compliance. Unlike revoke-all, this removes records entirely rather than marking them as revoked.

Use cases:

  • GDPR right to erasure requests
  • Account deletion workflows
  • Test cleanup (provides complete isolation between test scenarios)

Important: This operation is irreversible. Deleted consents cannot be recovered. For audit purposes, consider using revoke-all instead unless full erasure is required.

Authorizations:
bearerAuth

Responses

Response samples

Content type
application/json
{
  • "message": "All consents deleted"
}

gdpr

Delete all consents (GDPR)

Permanently delete all consent records for the authenticated user. This is a destructive operation intended for GDPR "right to erasure" (Article 17) compliance. Unlike revoke-all, this removes records entirely rather than marking them as revoked.

Use cases:

  • GDPR right to erasure requests
  • Account deletion workflows
  • Test cleanup (provides complete isolation between test scenarios)

Important: This operation is irreversible. Deleted consents cannot be recovered. For audit purposes, consider using revoke-all instead unless full erasure is required.

Authorizations:
bearerAuth

Responses

Response samples

Content type
application/json
{
  • "message": "All consents deleted"
}