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.
Consent
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
| Parameter | Type | Required | Description |
|---|---|---|---|
orgName | string | Yes | Organization slug/name — routes the request to the correct organization |
projectName | string | Yes | Project slug/name — consent is recorded under this project |
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
apiKey | string | Yes | Intempt API key. Format: identifier.secret |
Request Body
Content-Type: application/json
Required Fields
| Field | Type | Description |
|---|---|---|
action | string | Consent decision: accept or reject |
validUntil | number | Expiration timestamp in milliseconds, or "unlimited" for no expiry |
source | string | Origin of the consent — e.g. "web", "desktop", or "mobile" |
sourceId | string | The source recording this consent — same source ID used in Track Data |
profileId | string | The user's profile ID this consent belongs to |
Optional Fields
| Field | Type | Description |
|---|---|---|
category | string | Specific consent category (e.g. "analytics", "marketing"). If omitted, action applies to all consent types. |
email | string | User email for identification and communication |
message | string | Custom note for context or debugging |
Examples
Accept Analytics Consent — Desktop
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.
Reject Marketing Consent — Mobile
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.
