---
title: "Preview trace deletion"
method: POST
path: "/v1/projects/{projectSlug}/trace-deletions/preview"
tags: ["Trace deletions"]
---

# Preview trace deletion

`POST /v1/projects/{projectSlug}/trace-deletions/preview`

## Request

- Base URL: `https://api.latitude.so`
- URL: `https://api.latitude.so/v1/projects/{projectSlug}/trace-deletions/preview`
- Auth: HTTP bearer

Counts the traces a deletion with this selector would delete, without deleting anything. Accepts the same `traces` selector as `createTraceDeletion`.

## Path parameters

- `projectSlug` string, required: Project slug (human-readable identifier)

## Request body

- CreateTraceDeletionBody
  - `traces` union, required
    - object: Which traces to delete: up to 100 explicit trace ids, or a trace filter set (for example every trace tagged `customer:acme`, or every trace of one `userId`). A filter must contain at least one condition, and percentile conditions are not accepted. Only traces that started before the deletion is requested are deleted.
      - `by` 'ids', required: Match an explicit list of traces by their identifiers. Pair with `ids`.
      - `ids` string[], required: Non-empty list of trace identifiers.
    - object: Which traces to delete: up to 100 explicit trace ids, or a trace filter set (for example every trace tagged `customer:acme`, or every trace of one `userId`). A filter must contain at least one condition, and percentile conditions are not accepted. Only traces that started before the deletion is requested are deleted.
      - `by` 'filters', required: Match every trace produced by a filter set. Pair with `filters`; result count is not bounded.
      - `filters` FilterSet, required: Filter set keyed by field name. Each entry holds an array of conditions ANDed together for that field; field-level groups are also ANDed across the set.
  - `includeDatasetRows` boolean: Also delete dataset rows that were copied from the deleted traces, in every dataset of the organization, including their earlier versions. Defaults to `false`, which keeps dataset rows. Ignored by `previewTraceDeletion`.

## Response `200`

Number of matching traces

- PreviewTraceDeletionResponse
  - `matchedTraceCount` integer, required: How many traces a deletion with this selector would delete if it were requested now.

## Other responses

- `400`: Validation error
- `401`: Unauthorized
- `404`: Not found

## Changes

- **2026-10-27** `0685be1cbf9f`: 1 info
  - added the new optional request property `includeDatasetRows`
- **2026-10-27** `15073decd632`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/latitude-dev/apis/latitude/changes/v1/projects/:projectSlug/trace-deletions/preview/post.md)

---

[API](https://skmtc.dev/latitude-dev/apis/latitude.md) - [All operations](https://skmtc.dev/latitude-dev/apis/latitude/llms.txt) - [OpenAPI document](https://skmtc.dev/latitude-dev/apis/latitude/revisions/0685be1cbf9f?raw)
