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
AuthorizationstringrequiredBearer token. Format: Bearer cl_key_live_xxx
Response fields
| Field | Type | Description |
|---|---|---|
id | string | Unique site identifier (UUID) |
accountId | string | Account that owns this site |
name | string | Display name of the site |
projectKey | string | Public key used in the banner script tag |
createdAt | string | ISO 8601 creation timestamp |
updatedAt | string | ISO 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
idstringrequiredThe site's unique identifier (UUID)
Headers
AuthorizationstringrequiredBearer token. Format: Bearer cl_key_live_xxx
Error responses
| Status | Description |
|---|---|
404 | Site not found |
401 | Missing 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"
}