Check user consent based on context.

POST https://api.consentgrid.io/v1/consent/subjects/{type}/{subjectId}/sc/{smartConsent}?detail=false
Authorization: Bearer apiKey
Content-Type: application/json | application/x-www-form-urlencoded
GET https://api.consentgrid.io/v1/consent/subjects/{type}/{subjectId}/sc/{smartConsent}?detail=false&context.field=value
Authorization: Bearer apiKey
GET https://api.consentgrid.io/v1/my/consent/{acct}/sc/{smartConsent}?detail=false&context.field=value
cookie cgs_{accountURL}: session

The POST variant of the request accepts a JSON document with the context :

{
  "context": {
    // context is JSON object containing fields used during SmartConsent definitions
    "purpose": "marketing",
    "by": {"type":"user", "id": "..."},
    "requester": {
     "type": "user",
      "id":  "..." 
    }
  }
}

The POST variant also accepts a URL-encoded form with fields names identical to the query parameters.

The following path parameters are required:

type
Subject type, usually "user".
subjectId
The identifier of the user the consent belongs to.
smartConsent
The SmartConsent for which to check consent.

GET variants of the API accept context.* values either as query parameters or URL-encoded form values. For instance, multiple occurances of context.purposes field may represent a purposes array.

All variants accept a detail query parameter that will include consent detail information if set to true

This API will check the active user consent for the SmartConsent based on the context described in the input document. The output contains the results and optionally form and consent details :

If detail=false or not specified:

{
  "consent": "consent1",
  "value": true
}

If detail=true, the output will contain consent detail information:

{
  "consent": "consent1",
  "value": true,
  "consentDetail": [
    {
      "uri":"https://api.consentgrid.io/consents/v1/c?handle=1a78b468727647ffeefe",
      "data" {
        "templateName": "formName",
        "lastVersion": 2,
        "consentVersion": 1
      }
    },...
  ],
  ...
}

Every element of consentDetail contains a consent record for this consent, and the template used when the consent was recorded. The lastVersion is the current latest version of the template used to accept/reject the consent. The consentVersion is the version of the template used to display the end-user terms and conditions, disclosures, etc. These two can be used to check if the template has been modified since the consent has been recorded.

Example

The following calls retrieve the consent "email", with purpose "marketing":

POST /v1/consent/subjects/user/5db527864c12280001713e20.DboYzzbDQimFoE/sc/email
Content-Type: application/json

{
  "context": {
    "purpose": "marketing"
  }
}
GET /v1/consent/subjects/user/5db527864c12280001713e20.DboYzzbDQimFoE/sc/email?context.purpose=marketing