Turso Cloud API 参考 接口资源 API 令牌
撤销组织 API 令牌
撤销归属于此组织的令牌。
DELETE
https://api.turso.tech/v1/organizations/{organizationSlug}/api-tokens/{tokenId} 路径接受令牌 ID 而非名称,因为名称仅在单个用户范围内唯一,跨用户并不唯一——管理员在撤销某个成员的令牌时,仅凭名称无法区分到底是哪个令牌。
授权规则与列表端点保持对称:
- 管理员和所有者可以撤销归属于该组织的任意令牌(无论组织级还是组级,也无论由谁签发)。
- 成员和查看者只能撤销自己签发的令牌。
归属于其他组织的令牌会返回 404 而非 403,这样该端点就不会泄露跨组织令牌 ID 的存在性。无限制令牌同样无法通过此端点操作,必须通过 DELETE /v1/auth/api-tokens/{tokenName} 撤销。
注意
此端点接受令牌 ID(而非名称),因为令牌名称在组织内的不同用户之间并不唯一。管理员和所有者可以撤销归属于该组织的任意令牌;成员和查看者只能撤销自己签发的令牌。如需撤销无限制令牌,请使用 DELETE /v1/auth/api-tokens/{tokenName}。
curl -L -X DELETE 'https://api.turso.tech/v1/organizations/{organizationSlug}/api-tokens/{tokenId}' \
-H 'Authorization: Bearer TOKEN'
OpenAPI
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}/api-tokens/{tokenId}:
delete:
summary: Revoke Organization API Token
description: >-
Revokes a token scoped to this organization.
The path takes a token **ID**, not a name, because names are unique per
user but not across users — an admin revoking a member's token can't
disambiguate by name alone.
Authorization is symmetric with the list endpoint:
- **Admins and owners** can revoke any token scoped to the organization
(org-scoped or group-scoped, regardless of who minted it).
- **Members and viewers** can revoke only tokens they minted themselves.
A token scoped to a different organization returns `404`, not `403`, so
the endpoint does not leak the existence of cross-org token IDs.
Unrestricted tokens are also unreachable here and must be revoked via
[`DELETE
/v1/auth/api-tokens/{tokenName}`](/api-reference/tokens/revoke).
operationId: revokeOrganizationAPIToken
parameters:
- $ref: '#/components/parameters/organizationSlug'
- name: tokenId
in: path
required: true
schema:
type: string
description: The ID of the token to revoke (from the list endpoint).
example: clGFZ4STEe6fljpFzIum8A
responses:
'200':
description: Successful response
content:
application/json:
schema:
type: object
properties:
token:
type: string
description: The ID of the revoked token.
example: clGFZ4STEe6fljpFzIum8A
components:
parameters:
organizationSlug:
in: path
name: organizationSlug
required: true
schema:
type: string
description: The slug of the organization or user account.
同步自官方 Turso 文档仓库 (
tursodatabase/turso-docs
· MIT 开源协议)
查看官方原文 ↗