Doctavian
ClickwrapConsents

Consent Create

This endpoint creates a consent object and initiates a session to capture user agreement to specific terms or conditions (e.g., terms of service, privacy policies). The consent object is used to store both session-related metadata and consent details. This endpoint is important because it generates a unique session ID which is used to edit and link the consent to the user’s interaction in consent edit request, ensuring continuity and security.

POST
/consents/create

Header Parameters

Authorizationstring

JWT token to authenticate the request on behalf of a specific Microsoft user or a backend service principal.

Default"Bearer {{authToken}}"
Value in"Bearer {{authToken}}"
X-Subscription-Keystring

Unique API key used to identify and authorize access to a specific environment

Default"{{apiKey}}"
Value in"{{apiKey}}"
externalContext?string

External reference ID used for contextual tracking.

consentobject

Response Body

curl -X POST "https://demo.headless.mavenmule.com/clickwrap/consents/create" \  -H "Authorization: Bearer {{authToken}}" \  -H "X-Subscription-Key: {{apiKey}}" \  -H "Content-Type: application/json" \  -d '{    "externalContext": "12345",    "consent": {      "termDefinitionId": "{{termDefinitionId}}"    }  }'

{
  "result": {
    "statusCode": 201,
    "message": "Created",
    "data": [
      {
        "consent": {
          "sessionId": "{{sessionId}}",
          "sessionStartDatetime": "{{sessionStartDatetime}}",
          "sessionExpirationDatetime": "{{sessionExpirationDatetime}}"
        },
        "termDefinition": {
          "text": "{{termText}}"
        }
      }
    ]
  },
  "externalContext": "{{externalContextId}}",
  "origin": "{{originEnvironment}}",
  "dateTime": "{{responseTimestamp}}",
  "userId": "{{userId}}"
}