Intempt Docs
Developer DocsAPI Reference

Consent

Record user consent decisions (accept/reject) for a project. Consent is evaluated in real time and affects tracking and downstream features.

POST /v1/{orgName}/projects/{projectName}/consents/data

Records a user's consent decision for a project. Consent is evaluated in real time and affects tracking, communications, and downstream features.


Path Parameters

ParameterTypeRequiredDescription
orgNamestringYesOrganization slug/name — routes the request to the correct organization
projectNamestringYesProject slug/name — consent is recorded under this project

Query Parameters

ParameterTypeRequiredDescription
apiKeystringYesIntempt API key. Format: identifier.secret

Request Body

Content-Type: application/json

Required Fields

FieldTypeDescription
actionstringConsent decision: accept or reject
validUntilnumberExpiration timestamp in milliseconds, or "unlimited" for no expiry
sourcestringOrigin of the consent — e.g. "web", "desktop", or "mobile"
sourceIdstringThe source recording this consent — same source ID used in Track Data
profileIdstringThe user's profile ID this consent belongs to

Optional Fields

FieldTypeDescription
categorystringSpecific consent category (e.g. "analytics", "marketing"). If omitted, action applies to all consent types.
emailstringUser email for identification and communication
messagestringCustom note for context or debugging

Examples

const response = await fetch(
  "https://api.intempt.com/v1/{orgName}/projects/{projectName}/consents/data?apiKey=YOUR_API_KEY",
  {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({
      action: "accept",
      validUntil: Date.now() + 365 * 24 * 60 * 60 * 1000,
      source: "desktop",
      sourceId: "YOUR_SOURCE_ID",
      profileId: "YOUR_PROFILE_ID",
      category: "analytics",
      email: "user@example.com",
      message: "User accepted analytics consent on cookie banner"
    })
  }
);

Records analytics consent from a desktop web user with 1-year validity.

const response = await fetch(
  "https://api.intempt.com/v1/{orgName}/projects/{projectName}/consents/data?apiKey=YOUR_API_KEY",
  {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({
      action: "reject",
      validUntil: "unlimited",
      source: "mobile",
      sourceId: "YOUR_SOURCE_ID",
      profileId: "YOUR_PROFILE_ID",
      category: "marketing",
      message: "User declined marketing notifications in app settings"
    })
  }
);

Records a marketing consent rejection from a mobile app user with unlimited validity.


Responses

200 OK

{}

400 Bad Request

An invalid or incomplete request returns an empty body with a 400 status — no error detail is included in the response.

On this page