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

创建邀请

邀请用户加入组织。如果该用户尚未注册 Turso,他们将收到一封注册链接。如果同一邮箱已存在待处理的邀请,该邀请将被替换。

POST https://api.turso.tech/v2/organizations/{organizationSlug}/invites
警告

邀请功能仅限 scaler 套餐及以上版本使用。

注意

你可以通过 邮箱 或 用户名 发起邀请——二者只能提供其中之一。通过用户名邀请时,邀请会发送到该用户注册的邮箱。

注意

你必须是 owner 或 admin 才能邀请其他用户。你只能邀请用户加入团队,而不能邀请加入你的个人账户。

注意

如果同一邮箱已存在待处理的邀请,它将被新的邀请替换。

curl -L -X POST https://api.turso.tech/v2/organizations/{organizationSlug}/invites \
  -H 'Authorization: Bearer TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"email": "user@example.com", "role": "member"}'
curl -L -X POST https://api.turso.tech/v2/organizations/{organizationSlug}/invites \
  -H 'Authorization: Bearer TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"username": "turso-user", "role": "member"}'
import { createClient } from "@tursodatabase/api";

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

const invite = await turso.organizations.inviteUser(
  "user@example.com",
  "member"
);

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:
  /v2/organizations/{organizationSlug}/invites:
    post:
      summary: Invite Organization Member
      description: >-
        Invite a user to an organization. If the user isn't already registered
        with Turso, they will receive a signup link. If an existing pending
        invite exists for the same email, it will be replaced.
      operationId: inviteOrganizationMemberV2
      parameters:
        - $ref: '#/components/parameters/organizationSlug'
      requestBody:
        description: >-
          The user you want to invite to join Turso, and your organization.
          Provide exactly one of email or username.
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                email:
                  type: string
                  description: >-
                    The email of the user you want to invite. Exactly one of
                    email or username must be provided.
                username:
                  type: string
                  description: >-
                    The username of an existing Turso user you want to invite.
                    Exactly one of email or username must be provided.
                role:
                  type: string
                  enum:
                    - admin
                    - member
                    - viewer
                  description: The role given to the user.
                  default: member
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  invited:
                    $ref: '#/components/schemas/InviteCreatedV2'
components:
  parameters:
    organizationSlug:
      in: path
      name: organizationSlug
      required: true
      schema:
        type: string
      description: The slug of the organization or user account.
  schemas:
    InviteCreatedV2:
      type: object
      properties:
        email:
          type: string
          description: The email of the person invited.
          example: iku@turso.tech
        role:
          type: string
          enum:
            - admin
            - member
            - viewer
          description: The assigned role for the invited user.
          example: member
        organization:
          type: string
          description: The name of the organization the user was invited to.
          example: mycompany
同步自官方 Turso 文档仓库 ( tursodatabase/turso-docs · MIT 开源协议) 查看官方原文 ↗
搜索
按 Esc 关闭 · 由 Pagefind 静态索引驱动