# 使所有数据库认证令牌失效

> 使指定数据库的所有数据库级授权令牌失效。在 AWS 上，仅该数据库的令牌会失效；组令牌以及组中其他数据库的令牌不受影响。
> Canonical HTML: https://tursodb.cn/zh-cn/docs/api-reference/databases/invalidate-tokens/
> Upstream Source (MIT): https://docs.turso.tech/api-reference/databases/invalidate-tokens
> Language: zh-CN

---
<div class="doc-callout doc-callout-warning"><div class="doc-callout-title">警告</div><div class="doc-callout-body">

在 AWS 上，此操作仅会使为此数据库创建的令牌失效。组令牌以及组中其他数据库的令牌不受影响。

</div></div>


```bash cURL
curl -L -X POST 'https://api.turso.tech/v1/organizations/{organizationSlug}/databases/{databaseName}/auth/rotate' \
-H 'Authorization: Bearer TOKEN'
```

```ts Node.js
import { createClient } from "@tursodatabase/api";

const turso = createClient({
  org: "...",
  token: "",
});

const response = await turso.databases.rotateTokens("my-db");
```


## OpenAPI

````yaml POST /v1/organizations/{organizationSlug}/databases/{databaseName}/auth/rotate
openapi: 3.0.1
info:
  title: Turso Platform API
  description: API description here
  license:
    name: MIT
  version: 0.1.0
servers:
  - url: https://api.turso.tech
    description: Turso's Platform API
security: []
paths:
  /v1/organizations/{organizationSlug}/databases/{databaseName}/auth/rotate:
    post:
      summary: Invalidate All Database Auth Tokens
      description: >-
        Invalidates all database-scoped authorization tokens for the specified
        database. On AWS, only tokens for this database are invalidated; group
        tokens and tokens for other databases in the group are not affected.
      operationId: invalidateDatabaseTokens
      parameters:
        - $ref: '#/components/parameters/organizationSlug'
        - $ref: '#/components/parameters/databaseName'
      responses:
        '200':
          description: Successful response (No Content)
        '404':
          $ref: '#/components/responses/DatabaseNotFoundResponse'
components:
  parameters:
    organizationSlug:
      in: path
      name: organizationSlug
      required: true
      schema:
        type: string
      description: The slug of the organization or user account.
    databaseName:
      name: databaseName
      in: path
      required: true
      schema:
        type: string
      description: The name of the database.
  responses:
    DatabaseNotFoundResponse:
      description: Database not found
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
                description: The error message
                example: >-
                  could not find database with name [databaseName]: record not
                  found

````
