ConsentLayer
API Reference

Sites

Sites represent the websites or applications where you deploy ConsentLayer. Each site has a unique project key used to identify it in the banner script tag and SDK.

GET

List all sites

GET /sites

Returns all sites belonging to the authenticated account.

Headers

Authorizationstringrequired

Bearer token. Format: Bearer cl_key_live_xxx

Response fields

FieldTypeDescription
idstringUnique site identifier (UUID)
accountIdstringAccount that owns this site
namestringDisplay name of the site
projectKeystringPublic key used in the banner script tag
createdAtstringISO 8601 creation timestamp
updatedAtstringISO 8601 last-modified timestamp
curl https://api.consentlayer.com/api/v1/sites \
  -H "Authorization: Bearer cl_key_live_a8f2b9c4d1e6f3a7"
const res = await fetch('https://api.consentlayer.com/api/v1/sites', {
  headers: { Authorization: 'Bearer cl_key_live_a8f2b9c4d1e6f3a7' },
});
const sites = await res.json();
import requests

res = requests.get(
    "https://api.consentlayer.com/api/v1/sites",
    headers={"Authorization": "Bearer cl_key_live_a8f2b9c4d1e6f3a7"},
)
sites = res.json()

Response 200

[
  {
    "id": "e1a2b3c4-d5e6-7f89-0a1b-2c3d4e5f6789",
    "accountId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "name": "My Marketing Site",
    "projectKey": "cl_live_k8m2p5r9t3w7",
    "createdAt": "2025-01-15T10:30:00.000Z",
    "updatedAt": "2025-03-20T14:22:00.000Z"
  }
]
GET

Get a site by ID

GET /sites/{id}

Returns a single site by its UUID.

Path parameters

idstringrequired

The site's unique identifier (UUID)

Headers

Authorizationstringrequired

Bearer token. Format: Bearer cl_key_live_xxx

Error responses

StatusDescription
404Site not found
401Missing or invalid API key
curl https://api.consentlayer.com/api/v1/sites/e1a2b3c4-d5e6-7f89-0a1b-2c3d4e5f6789 \
  -H "Authorization: Bearer cl_key_live_a8f2b9c4d1e6f3a7"
const siteId = 'e1a2b3c4-d5e6-7f89-0a1b-2c3d4e5f6789';
const res = await fetch(
  `https://api.consentlayer.com/api/v1/sites/${siteId}`,
  { headers: { Authorization: 'Bearer cl_key_live_a8f2b9c4d1e6f3a7' } },
);
const site = await res.json();
import requests

site_id = "e1a2b3c4-d5e6-7f89-0a1b-2c3d4e5f6789"
res = requests.get(
    f"https://api.consentlayer.com/api/v1/sites/{site_id}",
    headers={"Authorization": "Bearer cl_key_live_a8f2b9c4d1e6f3a7"},
)
site = res.json()

Response 200

{
  "id": "e1a2b3c4-d5e6-7f89-0a1b-2c3d4e5f6789",
  "accountId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "name": "My Marketing Site",
  "projectKey": "cl_live_k8m2p5r9t3w7",
  "createdAt": "2025-01-15T10:30:00.000Z",
  "updatedAt": "2025-03-20T14:22:00.000Z"
}