API Reference
Consent Records
Consent records are created each time a visitor interacts with the consent banner. They store what categories were accepted or rejected, the visitor's jurisdiction, and GPC/Do Not Sell signals. Use these records for compliance auditing and reporting.
Using the SDK? The getConsentState() function reads the current visitor's consent from the cookie. Use the API endpoint below for server-side compliance reporting across all visitors.
GET
List consent records
GET /sites/{id}/consent-records
Returns paginated consent records for a site with optional date filtering.
Path parameters
idstringrequiredSite ID (UUID)
Query parameters
pageintegerPage number. Default: 1
limitintegerItems per page. Default: 50, max: 100
fromstringFilter: records created after this ISO 8601 date
tostringFilter: records created before this ISO 8601 date
Response fields
| Field | Type | Description |
|---|---|---|
records | array | List of consent record objects |
total | integer | Total number of matching records |
page | integer | Current page number |
limit | integer | Items per page |
curl "https://api.consentlayer.com/api/v1/sites/e1a2b3c4-d5e6-7f89-0a1b-2c3d4e5f6789/consent-records?page=1&limit=10&from=2025-01-01T00:00:00Z" \
-H "Authorization: Bearer cl_key_live_a8f2b9c4d1e6f3a7"const params = new URLSearchParams({
page: '1',
limit: '10',
from: '2025-01-01T00:00:00Z',
});
const res = await fetch(
`https://api.consentlayer.com/api/v1/sites/${siteId}/consent-records?${params}`,
{ headers: { Authorization: 'Bearer cl_key_live_a8f2b9c4d1e6f3a7' } },
);
const data = await res.json();import requests
res = requests.get(
f"https://api.consentlayer.com/api/v1/sites/{site_id}/consent-records",
headers={"Authorization": "Bearer cl_key_live_a8f2b9c4d1e6f3a7"},
params={"page": 1, "limit": 10, "from": "2025-01-01T00:00:00Z"},
)
data = res.json()Response 200
{
"records": [
{
"id": "cr-1234-abcd-ef56-7890",
"siteId": "e1a2b3c4-d5e6-7f89-0a1b-2c3d4e5f6789",
"visitorId": "v-anon-5678",
"jurisdiction": "EU",
"categories": {
"essential": true,
"statistics": true,
"marketing": false
},
"gpc": false,
"doNotSell": false,
"createdAt": "2025-03-20T14:22:00.000Z"
}
],
"total": 1542,
"page": 1,
"limit": 10
}