User consent API
The WSO2 Identity Server - User Consent Management API Definition (version v1).
Download the OpenAPI definition (YAML)
Security schemes
BasicAuth: HTTP basic
OAuth2: oauth2
authorizationCode flow, token URL https://localhost:9443/oauth2/token, authorization URL https://localhost:9443/oauth2/authorize
1 scopes
| Scope | Description |
|---|---|
internal_login | Grants access to self-service operations for the authenticated user |
me
Consent management operations for the authenticated user.
List consent records
GET /me/consents
Retrieve consent records with optional filtering. Returns the authenticated user's own consents, or those the user authorizes, based on the relation parameter.
Permission required:
* None
Scope required:
* internal_login
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
relation | query | string | Relation of the authenticated user to the retrieved consents. SUBJECT returns consents given by the user, AUTHORIZER returns consents the user is listed as an authorizer of, ANY returns both. Allowed values: | |
serviceId | query | string | Filter consents by service identifier. | |
state | query | string | Filter consents by state. Allowed values: | |
purposeId | query | string | Filter consents by purpose UUID. | |
purposeVersionId | query | string | Filter consents by specific purpose version UUID. | |
filter | query | string | Filter consents by custom properties using dot notation | |
attributes | query | string | Specifies the required attributes in the response as a comma-separated string. Supported values: | |
limit | query | integer (int32) | Maximum number of records to return. Default is 10. Default: |
Responses
| Code | Description | Schema |
|---|---|---|
200 | Consents retrieved successfully. | array of ConsentSummary |
400 | Invalid input request | Error |
401 | Unauthorized | |
500 | Internal Server Error | Error |
Create a consent record
POST /me/consents
Record consent for specified purposes and elements. The authenticated user creates and gives consent simultaneously. The consent is immediately recorded as ACTIVE or REJECTED based on the provided state.
Permission required:
* None
Scope required:
* internal_login
Request body (required): application/json
Consent to be created.
Schema: ConsentInput
6 properties
| Name | Type | Required | Description |
|---|---|---|---|
serviceId | string | Yes | Identifier of the service the consent is given for. |
language | string | Language code for the consent. | |
purposes | array of ConsentPurposeInput | Yes | List of purposes the user is consenting to. |
state | string | Initial state of the consent. Use ACTIVE when the user accepts (default). Use REJECTED when the user explicitly declines an optional policy — this records that the user saw and skipped this version so it is not shown again until a new version is published. Allowed values: | |
expiryTime | integer (int64) | Milliseconds since epoch until which the consent is valid. If omitted, the consent does not expire. | |
properties | object | Optional free-form key-value properties for this consent. |
Responses
| Code | Description | Schema |
|---|---|---|
201 | Consent created successfully. | ConsentCreateResponse |
400 | Invalid input request | Error |
401 | Unauthorized | |
409 | Conflict | Error |
500 | Internal Server Error | Error |
Get a consent record
GET /me/consents/{consent-id}
Retrieve a specific consent record by consent ID. The authenticated user must either be the subject of the consent, or be listed in the consent's authorization list; returns 403 otherwise.
Permission required:
* None
Scope required:
* internal_login
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
consent-id | path | string | Yes | UUID of the consent receipt. |
Responses
| Code | Description | Schema |
|---|---|---|
200 | Consent retrieved successfully. | ConsentResponse |
401 | Unauthorized | |
403 | Resource Forbidden | Error |
404 | Resource Not Found | Error |
500 | Internal Server Error | Error |
Revoke a consent
POST /me/consents/{consent-id}/revoke
Revokes the consent. The authenticated user must either be the subject of the consent, or be listed in the consent's authorization list; returns 403 otherwise. Idempotent — if the consent is already revoked, returns 200 with no error.
Permission required:
* None
Scope required:
* internal_login
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
consent-id | path | string | Yes | UUID of the consent receipt. |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | |
401 | Unauthorized | |
403 | Resource Forbidden | Error |
404 | Resource Not Found | Error |
500 | Internal Server Error | Error |
Authorize a consent
POST /me/consents/{consent-id}/authorize
Authorizes a PENDING consent. The authenticated user must either be the subject of the consent, or be listed in the consent's authorization list; returns 403 otherwise. When all required users have approved, the consent transitions to ACTIVE state. If any user rejects, the consent transitions to REJECTED state.
Permission required:
* None
Scope required:
* internal_login
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
consent-id | path | string | Yes | UUID of the consent receipt. |
Request body (required): application/json
Authorization decision.
Schema: AuthorizationRequest
1 property
| Name | Type | Required | Description |
|---|---|---|---|
state | string | Authorization decision. Allowed values: |
Responses
| Code | Description | Schema |
|---|---|---|
200 | Authorization recorded successfully. | |
400 | Invalid input request | Error |
401 | Unauthorized | |
403 | Resource Forbidden | Error |
404 | Resource Not Found | Error |
409 | Conflict | Error |
500 | Internal Server Error | Error |
Get the current state of a consent object
GET /me/consents/{consent-id}/validate
Returns the current state of a consent record, performing a lazy expiry check. The authenticated user must either be the subject of the consent, or be listed in the consent's authorization list; returns 403 otherwise.
Permission required:
* None
Scope required:
* internal_login
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
consent-id | path | string | Yes | UUID of the consent receipt. |
Responses
| Code | Description | Schema |
|---|---|---|
200 | Consent status retrieved successfully. | ConsentValidationResponse |
401 | Unauthorized | |
403 | Resource Forbidden | Error |
404 | Resource Not Found | Error |
500 | Internal Server Error | Error |
Schemas
ConsentInput
Type: object
6 properties
| Name | Type | Required | Description |
|---|---|---|---|
serviceId | string | Yes | Identifier of the service the consent is given for. |
language | string | Language code for the consent. | |
purposes | array of ConsentPurposeInput | Yes | List of purposes the user is consenting to. |
state | string | Initial state of the consent. Use ACTIVE when the user accepts (default). Use REJECTED when the user explicitly declines an optional policy — this records that the user saw and skipped this version so it is not shown again until a new version is published. Allowed values: | |
expiryTime | integer (int64) | Milliseconds since epoch until which the consent is valid. If omitted, the consent does not expire. | |
properties | object | Optional free-form key-value properties for this consent. |
ConsentPurposeInput
Type: object
2 properties
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Yes | UUID of the purpose. |
elements | array of ElementRef | Yes | Consent elements (PII categories) included in this consent purpose. |
ConsentSummary
Type: object
8 properties
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Unique identifier of the consent. | |
subjectId | string | Identifier of the user who gave consent. | |
serviceId | string | Identifier of the service the consent was given for. | |
state | string | Current state of the consent. Allowed values: | |
timestamp | integer (int64) | Milliseconds since epoch when the consent was created. | |
purposes | array of ConsentPurposeSummary | List of purposes included in the consent. Returned only when requested via | |
authorizations | array of AuthorizationResponse | Authorization records associated with this consent. Returned only when requested via | |
properties | object | Properties associated with this consent. Returned only when requested via |
ConsentCreateResponse
Type: object
3 properties
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Unique identifier of the created consent. | |
subjectId | string | Identifier of the user who gave consent. | |
serviceId | string | Identifier of the service the consent was given for. |
ConsentResponse
Type: object
10 properties
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Unique identifier of the consent. | |
subjectId | string | Identifier of the user who gave consent. | |
serviceId | string | Identifier of the service the consent was given for. | |
state | string | Current state of the consent. Allowed values: | |
language | string | Language code for the consent. | |
timestamp | integer (int64) | Milliseconds since epoch when the consent was created. | |
expiryTime | integer (int64) | Milliseconds since epoch until which the consent is valid. Null if no expiry. | |
purposes | array of ConsentPurposeResponse | List of purposes included in the consent. | |
authorizations | array of AuthorizationResponse | Authorization records associated with this consent. | |
properties | object | Properties associated with this consent. |
ConsentPurposeResponse
Type: object
7 properties
| Name | Type | Required | Description |
|---|---|---|---|
id | string | UUID of the purpose. | |
name | string | Name of the purpose. | |
type | string | Purpose type classification. | |
versionId | string | UUID of the purpose version consented to. | |
version | string | Human-readable version label. | |
elements | array of ConsentedElement | Consent elements included in this purpose. | |
properties | object | Key-value properties from the consented purpose version. |
ConsentPurposeSummary
Type: object
Minimal consented purpose information for list responses.
5 properties
| Name | Type | Required | Description |
|---|---|---|---|
id | string | UUID of the purpose. | |
name | string | Name of the purpose. | |
type | string | Purpose type classification. | |
versionId | string | UUID of the purpose version consented to. | |
version | string | Human-readable version label. |
ConsentedElement
Type: object
3 properties
| Name | Type | Required | Description |
|---|---|---|---|
id | string | UUID of the consent element. | |
name | string | Name of the consent element. | |
displayName | string | Display name of the consent element. |
ConsentValidationResponse
Type: object
2 properties
| Name | Type | Required | Description |
|---|---|---|---|
state | string | Current state of the consent. Allowed values: | |
expiryTime | integer (int64) | Milliseconds since epoch until which the consent is valid. Null if no expiry. |
AuthorizationRequest
Type: object
1 property
| Name | Type | Required | Description |
|---|---|---|---|
state | string | Authorization decision. Allowed values: |
AuthorizationResponse
Type: object
3 properties
| Name | Type | Required | Description |
|---|---|---|---|
userId | string | Username of the user who performed this authorization. | |
state | string | Current state of this authorization. Allowed values: | |
updatedTime | integer (int64) | Milliseconds since epoch when this authorization was last updated. |
Error
Type: object
4 properties
| Name | Type | Required | Description |
|---|---|---|---|
code | string | Yes | |
message | string | Yes | |
description | string | ||
traceId | string |
Was this page helpful?