İçeriğe atla
API REFERENCE

RESTful API: Complete documentation for developers

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

The SDK API uses a public API key: passed in the URL path for GET requests and in the request body for POST requests. This key is used by the browser-side SDK, so it is expected to be visible on the client. The Authorization: Bearer header is not used. You can get your API key from admin panel > Installation.

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
GET/a11y/{api_key}/ai-labelsAI-generated alt-text and aria-label suggestions
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

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

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

You can fetch the current API and SDK versions along with TCF/GVL metadata at runtime from the GET /api/v1/meta endpoint (public, read-only).

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 pull your domain data (cookie inventory, consent records, statistics, accessibility score). Read-only.

Base URL

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

Authentication: Bearer secret_key

Send your secret key in the Authorization: Bearer header. Get the secret key from admin panel > Installation > API and store it ONLY in a secure server environment; never place it on the client.

curl https://cerez.io/api/mgmt/v1/domain \
  -H "Authorization: Bearer YOUR_SECRET_KEY"
All successful responses are wrapped in { "data": ..., "meta": ... }. Errors are returned as RFC 9457 application/problem+json. Rate limit: 60 requests/minute.

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/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": "vis_a1b2c3" }'
# -> { "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": "vis_a1b2c3", "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 support is available through the Management API. For low-frequency events a POST signed with HMAC-SHA256 is sent to your registered endpoint. See the Management API section for setup and signature verification.

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 currently no batch endpoint. The POST /api/v1/consent/log endpoint is for single calls. Batch support is on the Q4 2026 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?
Short answer: A 429 Too Many Requests is returned. The Retry-After header indicates how many seconds you need to wait. Exponential backoff (1s, 2s, 4s, 8s...) is recommended for burst protection. The rate limit can be raised on the Enterprise plan.

Want to test the API?

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

⚡ YASAL ZORUNLULUK 2025/10 Cumhurbaşkanlığı Genelgesi: Kamu, belediye, banka, üniversite, hastane, okullar için 21 Haziran 2026'ya WCAG 2.2 A zorunlu · Ceza: 5.000–25.000 TL/tespit