---
title: "Reset all statistics accumulated by `pg_stat_statements` for a Postgres service. This affects every user, database, and normalized query tracked by the target Postgres instance and cannot be undone."
method: POST
path: "/external-services/{service_id}/pg-stat-statements/reset"
tags: ["External Services"]
---

# Reset all statistics accumulated by \`pg_stat_statements\` for a Postgres service. This affects every user, database, and normalized query tracked by the target Postgres instance and cannot be undone.

`POST /external-services/{service_id}/pg-stat-statements/reset`

## Request

- Base URL: `/api` (relative, and the document was published on a file host, not at the API’s origin)
- URL: `/api/external-services/{service_id}/pg-stat-statements/reset`
- Auth: HTTP bearer

## Path parameters

- `service_id` integer, required

## Request body

- ResetPgStatStatementsRequest: Explicit confirmation required for the destructive statistics reset. Requiring JSON makes the endpoint non-simple for browsers, preventing a deployed same-site application from triggering it with a plain HTML form.
  - `confirm` boolean, required: Must be `true` to acknowledge the global, irreversible reset.

## Response `200`

All accumulated pg_stat_statements statistics cleared

- ResetPgStatStatementsResponse: Response for the pg_stat_statements reset endpoint.
  - `message` string, required: Human-readable message confirming the destructive action.

## Other responses

- `400`: Missing or invalid reset confirmation
- `401`: Unauthorized
- `403`: Insufficient permissions (requires external_services:write)
- `404`: Service not found
- `422`: Service is not Postgres
- `502`: Target Postgres rejected or failed the reset operation

## Changes

- **2026-08-04** `c647b6ab1d2c`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/gotempsh/apis/temps/changes/external-services/:service_id/pg-stat-statements/reset/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)
