---
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`

## Request

- Base URL: `https://huggingface.co`
- URL: `https://huggingface.co/api/organizations/{name}/service-accounts/{serviceAccountId}/tokens/{tokenId}/rotate`
- Auth: HTTP bearer

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.dev/huggingface/apis/hub-api-endpoints.md) - [All operations](https://skmtc.dev/huggingface/apis/hub-api-endpoints/llms.txt) - [OpenAPI document](https://skmtc.dev/huggingface/apis/hub-api-endpoints/revisions/5cabdcc8a394?raw)
