# Analytics event retention

`POST /analytics/events/retention` · Rivier · analytics

Of the people who first did one event in each day or week, how many did another in each later one (people who agreed only).

- Scope: analytics:read
- Mcp: rivier_analytics_retention
- Graphql: Query.analyticsEventRetention
- Sdk: analytics.event.retention
- Cli: analytics event retention

## Request body

`application/json`

```json
{
  "type": "object",
  "properties": {
    "start": {
      "type": "string",
      "pattern": "^[A-Za-z][A-Za-z0-9_.:-]{0,59}$"
    },
    "back": {
      "type": "string",
      "pattern": "^[A-Za-z][A-Za-z0-9_.:-]{0,59}$"
    },
    "interval": {
      "type": "string",
      "enum": [
        "day",
        "week"
      ],
      "default": "week"
    },
    "periods": {
      "type": "integer",
      "minimum": 1,
      "maximum": 12,
      "default": 8
    },
    "from": {
      "type": "string",
      "format": "date-time"
    },
    "to": {
      "type": "string",
      "format": "date-time"
    }
  },
  "required": [
    "start",
    "back",
    "from",
    "to"
  ],
  "additionalProperties": false
}
```

## Responses

- `200`: Success
- `400`: The request was malformed
- `401`: No valid credential
- `403`: The credential lacks the scope, origin or address
- `429`: Over the key's rate limit; see Retry-After

## Example

```sh
curl -X POST 'https://api.rivier.ai/analytics/events/retention' \
  -H 'Authorization: Bearer $KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "start": "string",
  "back": "string",
  "from": "2026-01-01T00:00:00Z",
  "to": "2026-01-01T00:00:00Z"
}'
```
