> ## Documentation Index
> Fetch the complete documentation index at: https://docs.turso.tech/llms.txt
> Use this file to discover all available pages before exploring further.

# Restore Database

> Restore a database deleted within the last five days, exactly as it was at the moment it was deleted. Requires a paid plan, an admin or owner of the organization, and recovery enabled for the organization.

<Note>
  Unlike the v1 endpoints, this endpoint identifies the organization and database
  by **UUID** — use the `id` field from
  [Retrieve Organization](/api-reference/organizations/retrieve) and the `DbId`
  field from [List Deleted Databases](/api-reference/databases/list-deleted).
</Note>

<RequestExample>
  ```bash cURL theme={null}
  curl -L -X POST 'https://api.turso.tech/v3/organizations/{organizationId}/databases/{databaseId}/restore' \
    -H 'Authorization: Bearer TOKEN'
  ```

  ```bash cURL (new name) theme={null}
  curl -L -X POST 'https://api.turso.tech/v3/organizations/{organizationId}/databases/{databaseId}/restore' \
    -H 'Authorization: Bearer TOKEN' \
    -H 'Content-Type: application/json' \
    -d '{ "name": "my-restored-database" }'
  ```
</RequestExample>


## OpenAPI

````yaml POST /v3/organizations/{organizationId}/databases/{databaseId}/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}/databases/{databaseId}/restore:
    post:
      summary: Restore Database
      description: >-
        Restore a database deleted within the last five days, exactly as it was
        at the moment it was deleted. Requires a paid plan, an admin or owner of
        the organization, and recovery enabled for the organization.
      operationId: restoreDatabase
      parameters:
        - $ref: '#/components/parameters/organizationId'
        - $ref: '#/components/parameters/databaseId'
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  description: >-
                    Optional new name for the restored database. If omitted, the
                    original name is reused. The hostname is re-derived from the
                    name.
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  database:
                    $ref: '#/components/schemas/DeletedDatabase'
                    description: The restored 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 database 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).
    databaseId:
      name: databaseId
      in: path
      required: true
      schema:
        type: string
        format: uuid
      description: >-
        The UUID of the database, as returned when listing deleted databases
        (the `DbId` field).
  schemas:
    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.

````