---
title: "Rotate token"
method: POST
path: "/api/index/v1/rotatetoken"
tags: ["Authentication"]
---

# Rotate token

`POST /api/index/v1/rotatetoken`

Rotates the secret value inside the Indexing API token and returns the new raw secret. All other properties of the token are unchanged. In order to rotate the secret value, include the token as the bearer token in the `/rotatetoken` request. Please refer to [Token rotation](https://developers.glean.com/indexing/authentication/token-rotation) documentation for more information.

## Response `200`

OK

- RotateTokenResponse — Describes the response body of the /rotatetoken API call
  - `rawSecret` string — New raw secret
  - `createdAt` integer — Unix timestamp in seconds when the new secret value is assigned to the token. The token needs to be rotated before `rotationPeriodMinutes` past the createdAt timestamp otherwise it would be rendered unusable.
  - `rotationPeriodMinutes` integer — Refers to the time period in minutes before which this token needs to be rotated. It is required to rotate the token within the specified `rotationPeriodMinutes` after each `/rotatetoken` call, otherwise the tokens would expire. Note that the token would still expire at `expiresAt` timestamp provided during token creation even if the token is being regularly rotated. `rotationPeriodMinutes` property is inherited from the parent token being rotated

## Other responses

- `400` — Bad Request
- `401` — Not Authorized

---

[API](https://skmtc.net/gleanwork/apis/glean-indexing-api.md) · [All operations](https://skmtc.net/gleanwork/apis/glean-indexing-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/gleanwork/glean-indexing-api/versions/1c92beda1a4f/schema)
