跳至正文内容
TursoDB.cn 独立社区 · MVCC 并发写与每 Agent 独立库实战 阅读解析 →
Turso Cloud API 参考 接口资源 API 令牌

列出组织 API 令牌

返回作用域限定为此组织的 API 令牌(包括组织级和组级)。无限制令牌不会在此返回——请通过 [`GET /v1/auth/api-tokens`](/api-reference/tokens/list) 管理这些令牌。

GET https://api.turso.tech/v1/organizations/{organizationSlug}/api-tokens

授权规则与撤销端点对称:

  • 管理员和所有者可查看范围内限定为组织的每一个令牌,owner 字段中包含创建该令牌的用户。
  • 成员和查看者只能看到自己创建的令牌。

这与 GitHub 组织设置中使用的个人访问令牌模型一致:管理员获得完整的归属列表;其他所有人只能看到自己的访问权限。

NOTE

使用此端点可枚举作用于单个组织的令牌(同时包括组织作用域和组作用域)。管理员和所有者能看到组织内的每个令牌,并附带创建者用户;成员和查看者只能看到自己的令牌。要列出调用者所属的所有组织中的令牌,请改用 GET /v1/auth/api-tokens。

curl -L 'https://api.turso.tech/v1/organizations/{organizationSlug}/api-tokens' \
  -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:
    get:
      summary: List Organization API Tokens
      description: >-
        Returns the API tokens scoped to this organization (both
        organization-scoped and group-scoped). Unrestricted tokens are not
        returned here — manage those via [`GET
        /v1/auth/api-tokens`](/api-reference/tokens/list).


        Authorization is symmetric with the revoke endpoint:


        - **Admins and owners** see every token scoped to the organization, with
        the minting user attached in the `owner` field.

        - **Members and viewers** see only tokens they minted themselves.


        This mirrors the personal-access-token model used in GitHub organization
        settings: admins get the full attribution list; everyone else sees their
        own access.
      operationId: listOrganizationAPITokens
      parameters:
        - $ref: '#/components/parameters/organizationSlug'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  tokens:
                    type: array
                    items:
                      type: object
                      properties:
                        name:
                          type: string
                          description: The token name.
                          example: ci-bot
                        id:
                          type: string
                          description: The token ID. Pass this to the revoke endpoint.
                          example: clGFZ4STEe6fljpFzIum8A
                        organization:
                          type: string
                          description: >-
                            The organization slug. Always equal to the path
                            parameter for tokens returned here.
                          example: my-org
                        group:
                          type: string
                          description: >-
                            The group name. Present only for group-scoped
                            tokens.
                          example: default
                        scopes:
                          type: array
                          items:
                            type: string
                          description: >-
                            The expanded scope list. Present only for tokens
                            with scopes.
                          example:
                            - db:create
                            - db:configure
                            - db:mint-token
                        owner:
                          type: object
                          properties:
                            username:
                              type: string
                              example: alice
                            email:
                              type: string
                              example: alice@example.com
                          description: >-
                            The user who minted the token. Returned to admins
                            and owners so they can see who provisioned each
                            token.
                        created_at:
                          type: string
                          description: The date the token was created.
                          example: '2026-05-21'
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 开源协议) 查看官方原文 ↗
搜索
按 Esc 关闭 · 由 Pagefind 静态索引驱动