sites

Manage sites

Add and remove the sites you track, entirely by code. Creating a site returns the install snippet; deleting is a soft delete you can undo for 30 days.

GET/api/v1/sites
List every site in your workspace.
curl https://datalenk.com/api/v1/sites -H "Authorization: Bearer dlk_live_…"
POST/api/v1/sites
Create a site. Idempotent by domain: if it already exists you get it back with existing: true.
ParamTypeDescription
domainreqstringThe site domain (www is ignored).
namestringDisplay name.
timezonestringIANA zone, e.g. Europe/Paris. Defaults to UTC.
categoriesstring[]Built-in type slugs. First one is the primary type.
tagsstring[]Free organizational tags.
detectbooleanRun automatic detection in the background.
curl -X POST https://datalenk.com/api/v1/sites \
  -H "Authorization: Bearer dlk_live_…" \
  -H "Content-Type: application/json" \
  -d '{ "domain": "myshop.com", "categories": ["ecommerce"], "detect": true }'
response
{
  "id": 42, "domain": "myshop.com", "installed": false,
  "category": "ecommerce", "categories": ["ecommerce"], "tags": [],
  "existing": false,
  "snippet": "<script defer data-site=\"42\" data-key=\"dk_...\" src=\"https://in.datalenk.com/dl.js\"></script>"
}
GET/api/v1/sites/{id}
Get a site with its detection summary, goals and funnels.
PATCH/api/v1/sites/{id}
Update name, timezone, categories (built-in types only, first = primary) or tags.
curl -X PATCH https://datalenk.com/api/v1/sites/42 \
  -H "Authorization: Bearer dlk_live_…" -H "Content-Type: application/json" \
  -d '{ "name": "My Shop", "tags": ["priority"] }'
DELETE/api/v1/sites/{id}
Soft delete. Recoverable for 30 days, then purged.
response
{ "deleted": true, "id": 42, "purgeAt": "2026-08-08T…" }
GET/api/v1/sites/{id}/status
Poll install state after adding the snippet.
response
{ "installed": true, "lastEventAt": "2026-07-09T12:20:01Z", "online": 4 }

Typical lifecycle

Create the site, drop the returned snippet on the site, poll /status until installed is true, then read stats. Delete when you are done; restore from the dashboard within 30 days if needed.