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} 撤銷。
NOTE
此端點接受的是權杖 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 開源授權)
檢視官方原文 ↗