# 创建组

> 为组织或用户创建一个新组。
> Canonical HTML: https://tursodb.cn/zh-cn/docs/api-reference/groups/create/
> Upstream Source (MIT): https://docs.turso.tech/api-reference/groups/create
> Language: zh-CN

---
<div class="doc-callout doc-callout-warning"><div class="doc-callout-title">警告</div><div class="doc-callout-body">

创建多个组仅限 Scaler、Pro 和 Enterprise 套餐使用。

</div></div>


```bash cURL
curl -L -X POST 'https://api.turso.tech/v1/organizations/{organizationSlug}/groups' \
-H 'Authorization: Bearer TOKEN' \
-H 'Content-Type: application/json' \
-d '{
    "name": "new-group",
    "location": "lhr"
}'
```

```ts Node.js
import { createClient } from "@tursodatabase/api";

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

const group = await turso.groups.create("new-group", {
  location: "lhr",
  extensions: ["vector", "uuid"], // 'all'
});
```


## OpenAPI

````yaml POST /v1/organizations/{organizationSlug}/groups
openapi: 3.0.1
info:
  title: Turso Platform API
  description: 此处为 API 描述
  license:
    name: MIT
  version: 0.1.0
servers:
  - url: https://api.turso.tech
    description: Turso 的平台 API
security: []
paths:
  /v1/organizations/{organizationSlug}/groups:
    post:
      summary: 创建组
      description: 为组织或用户创建一个新组。
      operationId: createGroup
      parameters:
        - $ref: '#/components/parameters/organizationSlug'
      requestBody:
        description: 用于创建新组的组数据
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NewGroup'
      responses:
        '200':
          description: 成功响应
          content:
            application/json:
              schema:
                type: object
                properties:
                  group:
                    $ref: '#/components/schemas/Group'
                    description: 新创建的组
        '409':
          description: 冲突
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: 错误信息
                    example: group already exists
components:
  parameters:
    organizationSlug:
      in: path
      name: organizationSlug
      required: true
      schema:
        type: string
      description: 组织或用户账户的 slug。
  schemas:
    NewGroup:
      type: object
      properties:
        name:
          type: string
          description: 新组的名称。
        location:
          type: string
          description: 新组的位置键。
        extensions:
          $ref: '#/components/schemas/Extensions'
      required:
        - name
        - location
      example:
        name: new-group
        location: aws-us-east-1
    Group:
      allOf:
        - $ref: '#/components/schemas/BaseGroup'
        - type: object
    Extensions:
      oneOf:
        - type: string
          enum:
            - all
          description: 设置为 `all` 以启用所有扩展。
        - type: array
          items:
            type: string
            enum:
              - vector
              - crypto
              - fuzzy
              - math
              - stats
              - text
              - unicode
              - uuid
              - regexp
              - vec
          description: 要启用的扩展数组。
      description: >-
        为此组中新创建的数据库启用的扩展。希望启用向量扩展的用户应改用原生
        [libSQL 向量数据类型](/features/ai-and-embeddings)。
    BaseGroup:
      type: object
      properties:
        name:
          type: string
          description: 组名称，在你的组织内唯一。
          example: default
        version:
          type: string
          description: >-
            该组中的数据库当前运行的 libSQL 服务器版本。
          example: v0.23.7
          deprecated: true
        uuid:
          type: string
          description: 组的通用唯一标识符（UUID）。
          example: 0a28102d-6906-11ee-8553-eaa7715aeaf2
        locations:
          type: array
          items:
            type: string
          description: 组所在的位置键数组。
          example:
            - aws-us-east-1
          deprecated: true
        primary:
          type: string
          description: 主位置键。
          example: us-east-1
        delete_protection:
          type: boolean
          description: >-
            删除保护功能的当前状态。如果启用，该组及其所有数据库均无法被删除。
          example: false

````
