---
title: "Purge Old Transactions Endpoint"
method: POST
path: "/api/admin/purge-old-transactions"
tags: ["admin"]
---

# Purge Old Transactions Endpoint

`POST /api/admin/purge-old-transactions`

## Request

- Base URL: `https://api.stellara.natlex.it` (the document declares no server; this is the origin it was published from)
- URL: `https://api.stellara.natlex.it/api/admin/purge-old-transactions`
- Auth: none declared

Delete coin_transactions older than the retention window
(default 5 years, see app_settings.coin_tx_retention_years).

The user-facing «История трат» footer says "История хранится 5 лет"
— this endpoint is what enforces that promise. Cloud Scheduler job
`stellara-purge-tx` runs it nightly at 03:00 UTC; an admin can also
trigger it manually from the admin panel.

Idempotent — re-running on the same day after a sweep returns
`deleted=0`.

## Headers

- `authorization` string, nullable
- `X-Cron-Secret` string, nullable

## Response `200`

Successful Response

- PurgeOldTransactionsResponse
  - `status` string, required
  - `deleted` integer, required
  - `retention_years` integer, required

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/natlex/apis/stellara-api.md) · [All operations](https://skmtc.dev/natlex/apis/stellara-api/llms.txt) · [OpenAPI document](https://skmtc.dev/natlex/apis/stellara-api/revisions/e576f046b61f?raw)
