---
title: "Rotate service-account token"
method: POST
path: "/api/organizations/{name}/service-accounts/{serviceAccountId}/tokens/{tokenId}/rotate"
tags: ["service-accounts"]
---

# Rotate service-account token

`POST /api/organizations/{name}/service-accounts/{serviceAccountId}/tokens/{tokenId}/rotate`

Invalidate an existing token and generate a new one with the same permissions. The old token will stop working immediately.

## Path parameters

- `name` string, required
- `serviceAccountId` string, required
- `tokenId` string, required

## Response `200`

Rotated token

- object
  - `token` string, required — The new access token
  - `tokenInfo` object, required
    - `_id` string, required
    - `displayName` string, required
    - `createdAt` string, required
    - `last4` string

---

[API](https://skmtc.net/huggingface/apis/hub-api-endpoints.md) · [All operations](https://skmtc.net/huggingface/apis/hub-api-endpoints/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/huggingface/hub-api-endpoints/revisions/44f2ea8b03a5/schema)
