---
title: "Flush Expired OAuth2 Access Tokens"
method: POST
path: "/oauth2/flush"
tags: ["admin"]
---

# Flush Expired OAuth2 Access Tokens

`POST /oauth2/flush`

This endpoint flushes expired OAuth2 access tokens from the database. You can set a time after which no tokens will be
not be touched, in case you want to keep recent tokens for auditing. Refresh tokens can not be flushed as they are deleted
automatically when performing the refresh flow.

## Request body

- FlushInactiveOAuth2TokensRequest
  - `notAfter` string, date-time — NotAfter sets after which point tokens should not be flushed. This is useful when you want to keep a history of recently issued tokens for auditing.

## Response `204`

Empty responses are sent when, for example, resources are deleted. The HTTP status code for empty responses is
typically 201.

## Other responses

- `401` — jsonError
- `500` — jsonError

## Changes

- **2022-02-16** `82d233540486` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/ory/apis/ory-hydra-api/changes/oauth2/flush/post.md)

---

[API](https://skmtc.dev/ory/apis/ory-hydra-api.md) · [All operations](https://skmtc.dev/ory/apis/ory-hydra-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/ory/ory-hydra-api/revisions/82d233540486/schema)
