> ## Documentation Index
> Fetch the complete documentation index at: https://docs.linquid.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Cohorts, LTV, Journey, and Attribution

> Customer analytics endpoints for cohorting, lifetime value, journey timelines, and attribution details

# Cohorts, LTV, Journey, and Attribution

Customer analytics endpoints are workspace-scoped and require revenue-tracking entitlement.

## Endpoints

* `GET /api/customers/cohorts`
* `GET /api/customers/ltv-cohorts`
* `POST /api/customers/:id/recalculate-ltv`
* `GET /api/customers/:id/journey`
* `GET /api/customers/:id/attribution`

## Auth and permissions

* Feature gate: `revenueTracking`
* `links:read`: cohorts, journey, attribution
* `analytics:read`: ltv cohorts
* `links:create`: recalculate LTV

## Cohorts endpoint

`GET /api/customers/cohorts`

Query params:

* `group_by`: `week | month | campaign | source` (default `week`)
* `start` (optional date)
* `end` (optional date)

Returns grouped customer cohorts based on first-touch data.

## LTV cohorts endpoint

`GET /api/customers/ltv-cohorts`

Query params:

* `months`: analysis window (default `12`, max `24`)

Returns cohort-level lifetime value curves.

## Journey endpoint

`GET /api/customers/:id/journey`

Query params:

* `summary=true|false` (optional)
* `start` (optional)
* `end` (optional)

Returns chronological touchpoints for one customer.

## Attribution endpoint

`GET /api/customers/:id/attribution`

Returns attribution summary for the customer, including first-touch/last-touch and touched entities.

## Recalculate LTV

`POST /api/customers/:id/recalculate-ltv`

For correction/rebuild workflows after historical conversion updates.

## Operational behavior

* Customer existence is validated before journey/attribution/LTV recalculation.
* If analytics backend is unavailable, analytics endpoints can return `503` or `ANALYTICS_ERROR`.
* These customer analytics reads are HTTP snapshot-cached with short TTL.

## Common errors

* `400`: invalid `group_by` or malformed params
* `404`: customer not found
* `503`: analytics backend not configured
* `500`: analytics execution failure
