Profile API
A low-latency read of one person or group for personalization and AI agents: the properties you allowlist, computed traits, current cohort memberships and...
A low-latency read of one person or group for personalization and AI agents: the properties you allowlist, computed traits, current cohort memberships and the last events. The gateway serves it with an edge cache, so a website backend, an edge function or an agent tool can call it on every request.
Turn it on (Customers, Profile API)
Off by default. Nothing outside the lists below is ever returned.
Setting ( | Default | Meaning |
|---|---|---|
| false | Serve profiles to |
| none | Person properties served (exact names, up to 200) |
| none | Group properties served on group profiles |
| none | Event properties kept on the last events (name and time are always there) |
| true | Enabled computed traits of the entity (Customers, Computed traits) |
| true | The person's current cohort memberships (id and name) |
| 10 | Last events served, 0 to 50, from the last 90 days |
| 30 | How long the gateway caches a profile, 0 to 3600 (0 = no edge cache) |
Properties tagged PII in the data catalog stay masked unless the key also holds pii:read.
The key
Create a secret key with the profiles:read scope (Project settings, API keys). The scope grants nothing else: the key cannot query, read persons through the management API or capture. A valid key without the scope gets 403 (the key's own permission); a profile that does not exist, or a project with the API off, gets 404. Public keys get 401.
Requests
GET {gateway}/v1/profiles/{distinct_id}?events=5
GET {gateway}/v1/profiles/groups/{group_type_index}/{group_key}
Authorization: Bearer <secret key with profiles:read>events asks for fewer last events than the project serves (never more). The answer:
{
"type": "person",
"distinct_id": "user-42",
"person_id": "0192...",
"properties": {"plan": "pro"},
"traits": {"trait_orders_30d": 4},
"cohorts": [{"id": "0193...", "name": "Power users"}],
"events": [{"event": "checkout", "timestamp": "2026-11-01 09:12:01.000", "properties": {"amount": 40}}],
"cache_ttl_secs": 30,
"enabled": true
}Headers: Cache-Control: private, max-age=<remaining ttl> and X-Lucida-Cache: hit|miss. Unknown ids answer 404 and are cached for 10 seconds, so a lookup storm for a missing id stays at the edge.
How it works
The gateway authenticates the key (profiles:read, secret), then answers from its in-memory cache keyed by project, profile, events and whether the key holds pii:read. On a miss it calls lc-api (GET /v1/projects/{id}/profiles/..., LC_API_URL) with the caller's key; lc-api checks the scope and the switch again, reads the person or group from ClickHouse, applies the allowlist and masking and sets the cache time. A settings change reaches the edge when the cached entries expire.
Variable | Where | Meaning |
|---|---|---|
| lc-gateway | lc-api base the profile API reads through; unset = 503 |
The same profile is available to members at GET /v1/projects/{id}/profiles/{distinct_id} (person read) for previews and tests.