[C] Consentify

API Overview

Overview of the Consentify REST API, authentication, and error handling.

Consentify exposes four public API prefixes.

Base URL

https://consentify.dev

API Tiers

TierPathAuthCORSPurpose
Gateway API/api/gatewayPublic token (ct_)Any originToken-mode widget config
Widget API/api/consent/*NoneAny originLegacy config path and consent events, used by the widget and npm SDK
SDK API/api/sdk/*NoneAny origin@consentify/core cloud-mode config and events
Developer API/api/v1/*API key or sessionNoneSite management, consent data, analytics

Authentication

The Developer API (/api/v1/*) accepts an API key sent via the x-api-key header:

curl -H "x-api-key: ck_your_api_key" https://consentify.dev/api/v1/sites

API keys are generated in the dashboard and use the ck_ prefix. Each key is tied to a user account and grants access to that user's sites only.

A dashboard session cookie also works: requests from a browser logged in to the dashboard are authenticated without an API key.

Error Format

All errors return a consistent JSON structure:

{
  "error": "Human-readable message",
  "code": "ERROR_CODE"
}
CodeStatusDescription
BAD_REQUEST400Invalid parameters
UNAUTHORIZED401Missing or invalid API key
FORBIDDEN403Insufficient permissions
UPGRADE_REQUIRED403Endpoint requires the Pro plan
NOT_FOUND404Resource not found
RATE_LIMITED429Rate limit exceeded - check the X-RateLimit-* response headers
INTERNAL_ERROR500Server error

CORS

  • Widget-facing endpoints (/api/gateway*, /api/consent/*, /api/sdk/*): Any origin allowed - GET, POST, OPTIONS
  • Developer API (/api/v1/*): No CORS headers (API key auth, not browser-facing)

TypeScript Types

type ConsentAction = "accept_all" | "reject_all" | "customize";

interface Category {
  key: string;
  name: string;
  description: string;
  required: boolean;
  default: boolean;
}

interface ConsentEvent {
  siteId: string;
  action: ConsentAction;
  categories?: Record<string, boolean>;
  visitorHash: string;
  policyVersion?: string;
}

On this page