# 恢复组

> 恢复在过去五天内删除的组，以及随该组一起被删除的成员数据库。此操作需要付费套餐、组织管理员或所有者权限，并且已为组织启用恢复功能。如果部分数据库恢复失败，组仍会变为活跃状态：请使用“恢复数据库”逐一重试失败的数据库 UUID。
> Canonical HTML: https://tursodb.cn/zh-cn/docs/api-reference/groups/restore/
> Upstream Source (MIT): https://docs.turso.tech/api-reference/groups/restore
> Language: zh-CN

---
<div class="doc-callout doc-callout-info"><div class="doc-callout-title">注意</div><div class="doc-callout-body">

与 v1 端点不同，此端点通过 **UUID** 标识组织和组——请使用
[获取组织](/zh-cn/docs/api-reference/organizations/retrieve/) 中的 `id` 字段，以及
[列出已删除的组](/zh-cn/docs/api-reference/groups/list-deleted/) 中的 `uuid` 字段。

</div></div>


```bash cURL
curl -L -X POST 'https://api.turso.tech/v3/organizations/{organizationId}/groups/{groupId}/restore' \
  -H 'Authorization: Bearer TOKEN'
```


## OpenAPI

````yaml POST /v3/organizations/{organizationId}/groups/{groupId}/restore
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:
  /v3/organizations/{organizationId}/groups/{groupId}/restore:
    post:
      summary: Restore Group
      description: >-
        Restore a group deleted within the last five days, along with the member
        databases that were deleted with it. Requires a paid plan, an admin or
        owner of the organization, and recovery enabled for the organization. If
        some databases fail to restore, the group still becomes active: retry
        the failed database UUIDs individually with Restore Database.
      operationId: restoreGroup
      parameters:
        - $ref: '#/components/parameters/organizationId'
        - $ref: '#/components/parameters/groupId'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  group:
                    $ref: '#/components/schemas/Group'
                    description: The restored group.
                  databases:
                    type: array
                    items:
                      $ref: '#/components/schemas/DeletedDatabase'
                    description: >-
                      The member databases restored with the group, in restore
                      order.
                  failures:
                    type: object
                    additionalProperties:
                      type: string
                    description: >-
                      Maps database UUID to error message for members whose
                      restore failed. Retry them individually with Restore
                      Database.
        '400':
          description: >-
            Recovery is disabled for the organization, or the request is
            invalid.
        '403':
          description: >-
            The organization is on the free plan, or the caller is not an admin
            or owner.
        '404':
          description: >-
            No deleted group with this UUID exists, or its recovery window has
            passed.
components:
  parameters:
    organizationId:
      name: organizationId
      in: path
      required: true
      schema:
        type: string
        format: uuid
      description: >-
        The UUID of the organization. Retrieve it with the Retrieve Organization
        endpoint (the `id` field).
    groupId:
      name: groupId
      in: path
      required: true
      schema:
        type: string
        format: uuid
      description: >-
        The UUID of the group, as returned when listing deleted groups (the
        `uuid` field).
  schemas:
    Group:
      allOf:
        - $ref: '#/components/schemas/BaseGroup'
        - type: object
    DeletedDatabase:
      type: object
      properties:
        Name:
          type: string
          description: The database name.
        DbId:
          type: string
          format: uuid
          description: The database UUID. Use it to restore the database.
        Hostname:
          type: string
          description: >-
            The DNS hostname the database had, used for client and HTTP
            connections.
        group:
          type: string
          description: The name of the group the database belonged to.
        group_id:
          type: string
          format: uuid
          description: The UUID of the group the database belonged to.
        organization_id:
          type: string
          format: uuid
          description: The UUID of the organization.
        regions:
          type: array
          items:
            type: string
          description: The regions the database was located in.
        primaryRegion:
          type: string
          description: The primary region of the database.
        delete_protection:
          type: boolean
          description: Whether delete protection was enabled for the database.
        deleted_at:
          type: string
          format: date-time
          description: When the database was deleted.
        group_deleted_at:
          type: string
          format: date-time
          description: >-
            Set when the database's group was deleted with it. Restoring the
            database also restores the group.
    BaseGroup:
      type: object
      properties:
        name:
          type: string
          description: The group name, unique across your organization.
          example: default
        version:
          type: string
          description: >-
            The current libSQL server version the databases in that group are
            running.
          example: v0.23.7
          deprecated: true
        uuid:
          type: string
          description: The group universal unique identifier (UUID).
          example: 0a28102d-6906-11ee-8553-eaa7715aeaf2
        locations:
          type: array
          items:
            type: string
          description: An array of location keys the group is located.
          example:
            - aws-us-east-1
          deprecated: true
        primary:
          type: string
          description: The primary location key.
          example: us-east-1
        delete_protection:
          type: boolean
          description: >-
            The current status for delete protection. If enabled, the group and
            all its databases cannot be deleted.
          example: false

````
