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 開源授權)
檢視官方原文 ↗