---
title: "Prune Environments"
method: POST
path: "/admin/prune-environments"
---

# Prune Environments

`POST /admin/prune-environments`

## Request

- Base URL: `https://api-docs.session-exchange.com` (the document declares no server; this is the origin it was published from)
- URL: `https://api-docs.session-exchange.com/admin/prune-environments`
- Auth: none declared

DESTRUCTIVE, admin-only: permanently DELETE every event belonging to the given
environments' stations, reclaiming disk that `deactivate` (a reversible flag) cannot.
Matches stations currently IN each env OR quarantined to ``_retired:<env>`` (so it
works after a cascade-deactivate). The default environment can never be pruned.
Requires ``confirm: true``.

ASYNC: the actual rewrite/delete can exceed the ingress timeout on a large store,
so this validates + kicks off a BACKGROUND job and returns 202 immediately. Poll
``GET /admin/prune-environments/status`` for progress. Entity/skill projections
(derived from the same JSONL) reconcile on the next collector start.

## Request body

- PruneEnvironmentsRequest
  - `environments` string[], required
  - `confirm` boolean

## Response `200`

Successful Response

- unknown

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/session-exchange/apis/a4sx.md) · [All operations](https://skmtc.dev/session-exchange/apis/a4sx/llms.txt) · [OpenAPI document](https://skmtc.dev/session-exchange/apis/a4sx/revisions/abaefc33dfc7?raw)
