API REFERENCE

RESTful API: Geliştiriciler için tam dokümantasyon

Authentication with a public API key, JSON responses, 500 req/min rate limit. Every endpoint is documented in detail with cURL, JavaScript and PHP examples.

Getting Started

Base URL and Authentication

All API calls are made over HTTPS via the base URL below. HTTP requests are redirected to HTTPS with a 301 redirect.

Base URL

https://cerez.io/api/v1

OpenAPI 3.1 Specification

Machine-readable OpenAPI 3.1 definition of all endpoints. Import it into Postman, Insomnia, code generators and interactive clients.

Download openapi.json

Authentication: Public API Key

SDK API herkese açık (public) API key ile çalışır: GET isteklerinde URL yolunda, POST isteklerinde istek gövdesinde gönderilir. Bu anahtar tarayıcıdaki SDK tarafından kullanılır, istemci tarafında görünür olması normaldir. Authorization: Bearer header kullanılmaz. API key'inizi admin panel > Kurulum sayfasından alabilirsiniz.

curl https://cerez.io/api/v1/banner/YOUR_API_KEY
Security: The secret key is not used in these API calls and is never placed on the client; it is only for account management in the admin panel. To restrict access, you can define a per-domain IP allowlist (CIDR).
POST

/api/v1/heartbeat

Increments the pageview counter and marks the domain as active. The SDK calls this endpoint once per page load.

Body Parameters

ParameterTypeDescription
api_keystringPublic API key
session_idstringSession ID (for unique pageview tracking)
page_urlstringCurrent page URL
referrerstringdocument.referrer value (optional)

Response

{
  "success": true,
  "pageview_count_month": 42183,
  "plan_limit": 100000,
  "usage_percent": 42.18
}
SDK API

All SDK Endpoints

All /api/v1 endpoints that work with the public API key. For each one's full request and response schema, see the machine-readable OpenAPI 3.1 definition.

Cookies and Consent

MethodEndpointDescription
GET/banner/{api_key}Banner configuration (language, theme, categories)
POST/consent/logConsent logging (fallback path: /consent-log)
GET/consent/state/{api_key}Server-side consent lookup (server-side GTM)
GET/consent/group/{api_key}Cross-domain consent synchronization
POST/preferencesUniversal preference center save

Accessibility

MethodEndpointDescription
GET/a11y/{api_key}Accessibility widget configuration
POST/a11y/feature-usedAccessibility feature usage telemetry
POST/a11y/easy-readAI text simplification (Easy Read)
POST/a11y/ci-reportCI/CD accessibility gate report

TCF and Vendor List

IAB TCF is currently closed to customers: the /tcf endpoint returns enabled: false and no TC String is produced. No timeline has been set for IAB registration.

MethodEndpointDescription
GET/tcf/{api_key}IAB TCF configuration and GVL metadata
GET/gvl.jsonGlobal Vendor List (24-hour edge cache)

Telemetry and System

MethodEndpointDescription
POST/heartbeatPageview and liveness signal
POST/interactionsInteraction telemetry (off by default per KVKK)
POST/telemetryAnonymous SDK performance metrics
GET/metaVersion and capability discovery (public, read-only)

Response Envelopes

For historical reasons, SDK endpoints use different response envelopes; these shapes are preserved for backward compatibility. Parse responses according to the table below.

EnvelopeEndpoints
{ ... } (no envelope, direct object)GET /banner, GET /a11y, GET /tcf, GET /gvl.json
{ "status": "ok" }POST /consent/log, POST /heartbeat, POST /a11y/feature-used
{ "success": true }POST /preferences, POST /a11y/ci-report
{ "ok": true }POST /telemetry
{ "found": ... }GET /consent/state, GET /consent/group
{ "data": ..., "meta": ... }All Management API endpoints (/api/mgmt/v1)

API Version

Güncel API ve SDK sürümleri ile TCF/GVL meta verisini çalışma zamanında GET /api/v1/meta uç noktasından alabilirsiniz (public, salt-okunur).

GET /api/v1/meta

{
  "api_version": "1.0.0",
  "sdk_version": "2.6.2",
  "products": ["cookie", "accessibility"],
  "tcf": { "gvl_version": 123, "policy_version": 5 },
  "docs": "https://cerez.io/kaynaklar/api-referans"
}

OpenAPI 3.1 Specification

All 18 SDK endpoints in machine-readable form (Postman import / client generation).

Management API

Management API (server-to-server)

A separate API for programmatic server-side access. The SDK API (public api_key) is for the banner and consent; the Management API uses the secret_key to read your domain data (cookie inventory, consent records, statistics, accessibility score) and also has write endpoints for webhooks, data subject requests and starting scans.

Base URL

https://cerez.io/api/mgmt/v1

Authentication: Bearer secret_key

Secret key'inizi Authorization: Bearer header'ında gönderin. Secret key'i admin panel > Kurulum > API'den alın ve YALNIZCA güvenli sunucu ortamında saklayın; istemci tarafına asla koymayın.

curl https://cerez.io/api/mgmt/v1/domain \
  -H "Authorization: Bearer YOUR_SECRET_KEY"
Tüm başarılı yanıtlar { "data": ..., "meta": ... } zarfında döner. Hatalar RFC 9457 application/problem+json ile döner. Rate limit: 60 istek/dakika.

Endpoints

MethodEndpointDescription
GET/domainPlan, subscription and settings
GET/cookiesCookie categories and scanned cookies
GET/stats?period=30Accept/reject rate, device breakdown, daily series
GET/consents?from&to&cursorConsent records (cursor-paginated, KVKK/GDPR evidence)
GET/a11y/scoreLatest WCAG scan score and violation breakdown
GET/consents/receipt?visitor_id=Consent evidence for a single visitor (KVKK/GDPR)
POST/scanTrigger a cookie scan (synchronous, up to 3 pages)
GET/scan/{id}Scan status and result
GET/scan/{id}/diffDifference from the previous full scan (added, removed, changed)
GET/webhooksWebhook list (secret masked)
POST/webhooksCreate webhook (url + events)
DELETE/webhooks/{id}Delete webhook
POST/webhooks/{id}/testSend a test event
GET/dsar/export?visitor_id=Export data subject data (GDPR Art. 15)
POST/dsar/erasureAnonymize data subject data (two-step)

Successful Response 200 OK

GET /api/mgmt/v1/domain

{
  "data": {
    "id": 42,
    "site_name": "Örnek",
    "domain_url": "https://example.com",
    "products": ["cookie", "accessibility"],
    "subscriptions": [
      { "product": "cookie", "plan_slug": "cookie_pro", "status": "active" }
    ],
    "settings": { "kvkk_enabled": true, "consent_expiry_days": 180 }
  },
  "meta": { "api": "mgmt/v1", "generated_at": "2026-06-30T12:00:00+00:00" }
}

Webhooks HMAC-SHA256

When low-frequency events occur, a signed POST is sent to your registered endpoints: scan.completed, cookies.new_found, scan.error. High-volume consent events are not sent via webhook.

Example payload and headers

POST https://ornek.com/webhooks/cerez
X-Cerez-Event: scan.completed
X-Cerez-Timestamp: 1782475200
X-Cerez-Signature: sha256=3a7b...e0

{
  "event": "scan.completed",
  "created_at": "2026-06-30T12:00:00+00:00",
  "domain_id": 42,
  "data": { "total_cookies": 31, "new_cookies": 2 }
}

Signature verification (receiver side)

The signature is derived from the timestamp and the raw body. Verify with a constant-time comparison and confirm the timestamp is not older than 5 minutes (replay protection).

// Node.js
const crypto = require('crypto');
const expected = 'sha256=' + crypto
  .createHmac('sha256', WEBHOOK_SECRET)
  .update(timestamp + '.' + rawBody)
  .digest('hex');
const ok = crypto.timingSafeEqual(
  Buffer.from(expected), Buffer.from(signatureHeader)
);
// PHP
$expected = 'sha256=' . hash_hmac('sha256', $timestamp . '.' . $rawBody, $secret);
$ok = hash_equals($expected, $signatureHeader);

DSAR (Data Subject Requests) KVKK m.11 / GDPR m.15-17

Helps you respond to access and erasure requests for a visitor's data. Erasure = anonymization: direct identifiers (visitor_id, external_id, user_agent, region) are removed; consent proof (action, categories, TCF string, timestamps) is PRESERVED. You verify the visitor's identity.

Anonymization is two-step (accidental-deletion protection)

# 1. Önizleme (confirm_token yok), hiçbir şey değişmez
curl -X POST https://cerez.io/api/mgmt/v1/dsar/erasure \
  -H "Authorization: Bearer YOUR_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "visitor_id": "3f2b8c1e-9d4a-4b7e-a1c2-0e5f6a7b8c9d" }'
# -> { "data": { "dry_run": true, "matched_count": 3, "confirm_token": "..." } }

# 2. Uygula (önizlemeden gelen confirm_token ile)
curl -X POST https://cerez.io/api/mgmt/v1/dsar/erasure \
  -H "Authorization: Bearer YOUR_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "visitor_id": "3f2b8c1e-9d4a-4b7e-a1c2-0e5f6a7b8c9d", "confirm_token": "..." }'
# -> { "data": { "dry_run": false, "affected_count": 3 } }

If the record count changes between preview and apply, the token becomes invalid (409). Access and erasure are written to the audit log on every successful call. This tool helps you meet your compliance obligations; consult qualified counsel for legal validity.

OpenAPI 3.1 Specification

Machine-readable OpenAPI 3.1 definition of the Management API (Postman/codegen).

Management API openapi.json
Rate Limiting

Request Limits

Applied per IP address. When the limit is exceeded, the response includes a header indicating the wait time.

500
requests / minute / IP
5 dk
banner cache duration
90 gün
API log retention period
Limit exceeded: A 429 Too Many Requests is returned. The Retry-After header specifies the wait time in seconds. Exponential backoff (1s, 2s, 4s, 8s...) is recommended for burst protection. For a custom rate limit increase on the Enterprise plan, contact the sales team.
Error Codes

HTTP Status Codes

Code Description Typical Cause
200 OK Request successful
202 Accepted Accepted (telemetry / interaction, async)
304 Not Modified Not modified (ETag; gvl.json)
402 Payment Required Active subscription required (product disabled)
403 Forbidden Outside the IP whitelist or plan limit exceeded
404 Not Found API key or resource not found
422 Unprocessable Validation error; check the errors field in the response
429 Too Many Requests Rate limit exceeded (500/min)
502 Bad Gateway Upstream service (AI / scan) temporary error
503 Service Unavailable Service temporarily unavailable; Retry-After

Error Response Format

{
  "success": false,
  "error": {
    "code": "INVALID_API_KEY",
    "message": "API key bulunamadı veya devre dışı",
    "details": { "field": "api_key" }
  }
}
Webhook

Event Notifications Live

Webhook desteği Management API üzerinden kullanılabilir. Düşük frekanslı olaylarda kayıtlı adresinize HMAC-SHA256 ile imzalı bir POST gönderilir. Kurulum ve imza doğrulama için Management API bölümüne bakın.

scan.completed

Triggered when a cookie scan completes (total and new cookie counts)

cookies.new_found

Triggered when new cookies are found in a scan

scan.error

Triggered when a scan fails

FAQ

The questions on your mind

What is the difference between the SDK and the API?
Short answer: The SDK runs in the browser and renders the banner automatically. The API is designed for server-to-server integration; it is used in scenarios such as custom dashboards, mobile apps or server-side consent logging. Most customers use only the SDK.
Is there a batch endpoint?
Short answer: There is no batch endpoint yet. The POST /api/v1/consent/log endpoint takes a single call. Batch support is on the roadmap.
How does the IP whitelist work?
Short answer: Open the IP Restriction toggle under Admin panel > Installation and enter the allowed IPs (CIDR notation supported: 192.168.1.0/24). Requests outside the whitelist receive a 403 Forbidden. SDK requests coming from the browser are always accepted.
Is there webhook support?
Short answer: Yes. Webhooks are available through the Management API. Events are sent as POST requests signed with HMAC-SHA256; supported event types are scan.completed, cookies.new_found and scan.error. See the Management API section for setup.
What happens if the rate limit is exceeded?
Kısa yanıt: 429 Too Many Requests döner. Retry-After header'ı kaç saniye beklemeniz gerektiğini belirtir. Burst protection için exponential backoff (1s, 2s, 4s, 8s...) önerilir. Enterprise planında özel rate limit yükseltilebilir.

Want to test the API?

Get your API key with the 14-day free trial, copy the code and start integrating.