Skip to main content

User consent API

Download OpenAPI (YAML)Version v1

Base URL: https://localhost:9443/t/<TENANT_DOMAIN>/api/users/v1

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
ScopeDescription
internal_loginGrants 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

NameInTypeRequiredDescription
relationquerystring

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: SUBJECT, AUTHORIZER, ANY. Default: SUBJECT

serviceIdquerystring

Filter consents by service identifier.

statequerystring

Filter consents by state.

Allowed values: PENDING, ACTIVE, REJECTED, REVOKED, EXPIRED

purposeIdquerystring

Filter consents by purpose UUID.

purposeVersionIdquerystring

Filter consents by specific purpose version UUID.

filterquerystring

Filter consents by custom properties using dot notation properties.<key>, and by timestamp (milliseconds since epoch). Properties support 'sw' (starts with), 'co' (contains), 'ew' (ends with), and 'eq' (equals) operations. timestamp supports 'ge' (greater than or equals) and 'le' (less than or equals) operations. Combine multiple conditions with the 'and' logical operator. Examples: filter=properties.region eq EU, filter=timestamp ge 1744000000000 and timestamp le 1766383796000

attributesquerystring

Specifies the required attributes in the response as a comma-separated string. Supported values: purposes, authorizations, properties. Example: attributes=purposes,properties

limitqueryinteger (int32)

Maximum number of records to return. Default is 10.

Default: 10

Responses

CodeDescriptionSchema
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
NameTypeRequiredDescription
serviceIdstringYes

Identifier of the service the consent is given for.

languagestring

Language code for the consent.

purposesarray of ConsentPurposeInputYes

List of purposes the user is consenting to.

statestring

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: ACTIVE, REJECTED. Default: ACTIVE

expiryTimeinteger (int64)

Milliseconds since epoch until which the consent is valid. If omitted, the consent does not expire.

propertiesobject

Optional free-form key-value properties for this consent.

Responses

CodeDescriptionSchema
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

NameInTypeRequiredDescription
consent-idpathstringYes

UUID of the consent receipt.

Responses

CodeDescriptionSchema
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

NameInTypeRequiredDescription
consent-idpathstringYes

UUID of the consent receipt.

Responses

CodeDescriptionSchema
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

NameInTypeRequiredDescription
consent-idpathstringYes

UUID of the consent receipt.

Request body (required): application/json

Authorization decision.

Schema: AuthorizationRequest

1 property
NameTypeRequiredDescription
statestring

Authorization decision.

Allowed values: APPROVED, REJECTED. Default: APPROVED

Responses

CodeDescriptionSchema
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

NameInTypeRequiredDescription
consent-idpathstringYes

UUID of the consent receipt.

Responses

CodeDescriptionSchema
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
NameTypeRequiredDescription
serviceIdstringYes

Identifier of the service the consent is given for.

languagestring

Language code for the consent.

purposesarray of ConsentPurposeInputYes

List of purposes the user is consenting to.

statestring

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: ACTIVE, REJECTED. Default: ACTIVE

expiryTimeinteger (int64)

Milliseconds since epoch until which the consent is valid. If omitted, the consent does not expire.

propertiesobject

Optional free-form key-value properties for this consent.

ConsentPurposeInput​

Type: object

2 properties
NameTypeRequiredDescription
idstringYes

UUID of the purpose.

elementsarray of ElementRefYes

Consent elements (PII categories) included in this consent purpose.

ElementRef​

Type: object

1 property
NameTypeRequiredDescription
idstringYes

UUID of the consent element.

ConsentSummary​

Type: object

8 properties
NameTypeRequiredDescription
idstring

Unique identifier of the consent.

subjectIdstring

Identifier of the user who gave consent.

serviceIdstring

Identifier of the service the consent was given for.

statestring

Current state of the consent.

Allowed values: PENDING, ACTIVE, REJECTED, REVOKED, EXPIRED

timestampinteger (int64)

Milliseconds since epoch when the consent was created.

purposesarray of ConsentPurposeSummary

List of purposes included in the consent. Returned only when requested via attributes.

authorizationsarray of AuthorizationResponse

Authorization records associated with this consent. Returned only when requested via attributes.

propertiesobject

Properties associated with this consent. Returned only when requested via attributes.

ConsentCreateResponse​

Type: object

3 properties
NameTypeRequiredDescription
idstring

Unique identifier of the created consent.

subjectIdstring

Identifier of the user who gave consent.

serviceIdstring

Identifier of the service the consent was given for.

ConsentResponse​

Type: object

10 properties
NameTypeRequiredDescription
idstring

Unique identifier of the consent.

subjectIdstring

Identifier of the user who gave consent.

serviceIdstring

Identifier of the service the consent was given for.

statestring

Current state of the consent.

Allowed values: PENDING, ACTIVE, REJECTED, REVOKED, EXPIRED

languagestring

Language code for the consent.

timestampinteger (int64)

Milliseconds since epoch when the consent was created.

expiryTimeinteger (int64)

Milliseconds since epoch until which the consent is valid. Null if no expiry.

purposesarray of ConsentPurposeResponse

List of purposes included in the consent.

authorizationsarray of AuthorizationResponse

Authorization records associated with this consent.

propertiesobject

Properties associated with this consent.

ConsentPurposeResponse​

Type: object

7 properties
NameTypeRequiredDescription
idstring

UUID of the purpose.

namestring

Name of the purpose.

typestring

Purpose type classification.

versionIdstring

UUID of the purpose version consented to.

versionstring

Human-readable version label.

elementsarray of ConsentedElement

Consent elements included in this purpose.

propertiesobject

Key-value properties from the consented purpose version.

ConsentPurposeSummary​

Type: object

Minimal consented purpose information for list responses.

5 properties
NameTypeRequiredDescription
idstring

UUID of the purpose.

namestring

Name of the purpose.

typestring

Purpose type classification.

versionIdstring

UUID of the purpose version consented to.

versionstring

Human-readable version label.

ConsentedElement​

Type: object

3 properties
NameTypeRequiredDescription
idstring

UUID of the consent element.

namestring

Name of the consent element.

displayNamestring

Display name of the consent element.

ConsentValidationResponse​

Type: object

2 properties
NameTypeRequiredDescription
statestring

Current state of the consent.

Allowed values: PENDING, ACTIVE, REJECTED, REVOKED, EXPIRED

expiryTimeinteger (int64)

Milliseconds since epoch until which the consent is valid. Null if no expiry.

AuthorizationRequest​

Type: object

1 property
NameTypeRequiredDescription
statestring

Authorization decision.

Allowed values: APPROVED, REJECTED. Default: APPROVED

AuthorizationResponse​

Type: object

3 properties
NameTypeRequiredDescription
userIdstring

Username of the user who performed this authorization.

statestring

Current state of this authorization.

Allowed values: APPROVED, REJECTED, REVOKED, EXPIRED

updatedTimeinteger (int64)

Milliseconds since epoch when this authorization was last updated.

Error​

Type: object

4 properties
NameTypeRequiredDescription
codestringYes
messagestringYes
descriptionstring
traceIdstring

Was this page helpful?