API Reference

📡 API Reference

Base URL

https://api.consentkeep.com (opens in a new tab)

All requests require X-API-Key header.


POST /api/v1/consent

Log a user's consent.

Request

{
  "consent_given": true,
  "purposes": ["analytics", "functional", "marketing"],
  "origin_url": "https://example.com/cookie-policy"
}
 
Response
json
 
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "status": "logged",
  "screenshot_pending": true,
  "timestamp": "2024-01-15T10:30:00.000Z"
}
 
GET /api/v1/logs
 
Get paginated consent logs.
Parameters
Parameter	Type	Description
limit	int	Max items (default: 50, max: 100)
offset	int	Pagination offset
start_date	string	ISO date (YYYY-MM-DD)
end_date	string	ISO date (YYYY-MM-DD)
Example
bash
 
curl -X GET "https://api.consentkeep.com/api/v1/logs?limit=10&start_date=2024-01-01" \
  -H "X-API-Key: your_api_key"
 
GET /api/v1/logs/export
 
Export logs as CSV.
bash
 
curl -X GET "https://api.consentkeep.com/api/v1/logs/export" \
  -H "X-API-Key: your_api_key" \
  --output consent_logs.csv
 
CSV Columns
Column	Description
timestamp	UTC timestamp
origin_url	URL where consent was given
user_ip_hash	Hashed IP (with daily salt)
user_agent	Browser user agent
consent_given	true/false
purposes	Comma-separated list
screenshot_url	Public CDN URL
GET /api/v1/consent/:id
 
Get a single consent detail.
bash
 
curl -X GET "https://api.consentkeep.com/api/v1/consent/550e8400..." \
  -H "X-API-Key: your_api_key"
 
Response
json
 
{
  "id": "550e8400...",
  "consent_given": true,
  "purposes": ["analytics"],
  "origin_url": "https://example.com",
  "screenshot_url": "https://cdn.consentkeep.com/xxx.png",
  "timestamp": "2024-01-15T10:30:00.000Z"
}