---
title: "POST /projects/{project_id}/analytics/activity/preview"
method: POST
path: "/projects/{project_id}/analytics/activity/preview"
tags: ["Visitor Activity"]
---

# POST /projects/{project_id}/analytics/activity/preview

`POST /projects/{project_id}/analytics/activity/preview`

## Request

- Base URL: `/api` (relative, and the document was published on a file host, not at the API’s origin)
- URL: `/api/projects/{project_id}/analytics/activity/preview`
- Auth: HTTP bearer

## Path parameters

- `project_id` integer, required

## Request body

- ActivityPreviewRequest: An unsaved onboarding preview. Sharing is explicit and scheduling is never inferred.
  - `environment_id` integer, nullable
  - `goal` string, required
  - `min_page_paths` integer
  - `min_sessions` integer
  - `property_keys` string[]
  - `share_activity_with_ai` boolean, required
  - `source_domain` string, nullable
  - `source_url` string, nullable

## Response `200`

- ActivityPreview
  - `report` ActivityReport, required
    - `categories` ActivityCategory[], required
      - `description` string, required
      - `name` string, required
    - `completed_at` string, date-time, required
    - `environment_id` integer, nullable
    - `events_considered` integer, required
    - `model` string, nullable
    - `sampled` boolean, required
    - `settings_revision` integer, required
    - `skipped_low_activity` integer
    - `skipped_unchanged` integer
    - `started_at` string, date-time, required
    - `summary` string, required
    - `visitors` VisitorActivityAssessment[], required
      - `categories` string[], required
      - `evidence` ActivityEvidence[], required
        - `event` string, required
        - `path` string, required
        - `properties` ActivityProperty[], required
          - `key` string, required
          - `value` string, required
        - `reference` integer, required: Local to this report, not a database event ID.
        - `timestamp` string, date-time, required
        - `title` string, nullable
      - `explanation` string, required
      - `visitor_id` integer, required
    - `window_end` string, date-time, required
    - `window_start` string, date-time, required
  - `settings` ActivitySettings, required
    - `application_context` string, required
    - `categories` ActivityCategory[], required
      - `description` string, required
      - `name` string, required
    - `daily_enabled` boolean, required
    - `environment_id` integer, nullable
    - `goal_title` string, nullable: Short operator-facing label for the selected analysis goal.
    - `min_page_paths` integer
    - `min_sessions` integer
    - `property_keys` string[], required: Only these event-property keys may be sent to the provider.
    - `share_activity_with_ai` boolean, required: Explicit permission to send the selected analytics fields to the configured AI provider.
    - `source_domain` string, nullable
    - `source_url` string, nullable

## Other responses

- `400`: Invalid goal or sharing disabled
- `401`: Authentication required
- `403`: Access denied
- `404`: Project not found
- `409`: An analysis is already running for this project
- `429`: Cooling down after spending provider tokens, or rate-limited; see `Retry-After`
- `502`: The AI provider failed or returned unusable output
- `503`: AI provider not configured, or analysis capacity busy
- `504`: The AI provider timed out

## Changes

- **2026-11-22** `b701bf70926b`: 8 info
  - added the media type `application/json` for the response with the status `400`
  - added the media type `application/json` for the response with the status `404`
  - added the media type `application/json` for the response with the status `409`
  - added the media type `application/json` for the response with the status `502`
  - …4 more
- **2026-09-19** `9c1c1055e436`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/gotempsh/apis/temps/changes/projects/:project_id/analytics/activity/preview/post.md)

---

[API](https://skmtc.dev/gotempsh/apis/temps.md) - [All operations](https://skmtc.dev/gotempsh/apis/temps/llms.txt) - [OpenAPI document](https://skmtc.dev/gotempsh/apis/temps/revisions/3b040526eb43?raw)
