DoctavianDoctavian
ClickwrapConsents

Consent Create

POST
/consents/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.

Authorization

X-Subscription-Key<token>

In: header

Header Parameters

Authorization*string

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

X-Subscription-Key*string

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

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

curl -X POST "https://example.com/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}}"}