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

# /v1/databases/{databaseId}/backups/{backupId}/restore

> This endpoint restores a backup into its database.

> [!WARNING]
>
> This replaces all the data of the database. A copy of the database as it is is taken first.


## OpenAPI

````yaml POST /v1/databases/{databaseId}/backups/{backupId}/restore
openapi: 3.1.0
info:
  title: CamposCloud API Documentation
  description: >-
    This documentation provides an overview of the CamposCloud API, including
    authentication, endpoints, and data structures. It is designed to help
    developers integrate with the CamposCloud platform effectively.
  version: 1.0.0
servers:
  - url: https://api.camposcloud.com
security:
  - bearerAuth: []
paths:
  /v1/databases/{databaseId}/backups/{backupId}/restore:
    post:
      tags:
        - Databases
      description: >-
        Puts a backup back into its own database, replacing **all** of its
        current data. It runs in the background; follow it with `restore.status`
        in the list.


        Before restoring, a backup of the database as it is is taken (`reason:
        before-restore`), so the restore can be undone; without that copy the
        restore does not start. The database is offline for a few moments (Redis
        is stopped and started).


        The body must carry the database's name, exactly, in `confirm`.
      parameters:
        - name: databaseId
          in: path
          required: true
          description: ID of the database.
          schema:
            type: string
            pattern: ^[a-f0-9]{24}$
        - name: backupId
          in: path
          required: true
          description: ID of the backup.
          schema:
            type: string
            pattern: ^[a-f0-9]{24}$
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - confirm
              properties:
                confirm:
                  type: string
                  description: The database's name, exactly.
                  example: loja
      responses:
        '202':
          description: The restore started.
          content:
            application/json:
              example:
                message: >-
                  Restauração iniciada. Antes dela é guardada uma cópia do banco
                  como está, para poder voltar.
        '400':
          description: >-
            `confirm` does not match the database's name, the backup is not
            `done`, or it is of another kind of database.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: >-
                  Para restaurar, digite o nome do banco exatamente como ele
                  está.
                code: RESTORE_NOT_CONFIRMED
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          description: >-
            For team databases, the `canManageDatabaseBackup` permission is
            required.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: >-
                  You do not have permission to perform this action on this
                  database.
        '404':
          description: Database (or backup) not found, or not yours.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: Banco de dados não encontrado.
                code: DATABASE_NOT_FOUND
        '409':
          description: A backup or a restore of this database is already in progress.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: >-
                  Já há um backup ou uma restauração deste banco em andamento.
                  Espere terminar.
                code: DATABASE_BUSY
        '429':
          description: A rate limit was exceeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: Too many requests, please try again later
        '500':
          $ref: '#/components/responses/InternalError'
components:
  schemas:
    Error:
      type: object
      description: >-
        Every error returned by the API has this shape. `error` is a human
        readable message (in English or in Portuguese, depending on the
        endpoint). Many errors also carry `code`, a stable identifier to rely on
        in your code, and sometimes extra fields with details (for example
        `requestedMB` and `availableMB` with `PLAN_MEMORY_LIMIT`). Resources you
        have no relation to answer `404`, not `403`.
      required:
        - error
      properties:
        error:
          type: string
          description: Human readable description of the error.
          example: Application not found.
        code:
          type: string
          description: >-
            Stable, machine-readable identifier of the error. Present on many
            errors; compare against it instead of the message. Examples:
            `PLAN_MEMORY_LIMIT`, `APPLICATION_NOT_FOUND`, `DATABASE_NOT_FOUND`,
            `MAIN_FILE_INVALID`, `ENV_DUPLICATE_KEY`, `CUSTOM_DOMAIN_IN_USE`,
            `CUSTOM_DOMAIN_RESERVED`, `CUSTOM_DOMAIN_NOT_CLOUDFLARE`,
            `CUSTOM_DOMAIN_NO_PENDING`, `CUSTOM_DOMAIN_TXT_NOT_FOUND`.
          example: PLAN_MEMORY_LIMIT
  responses:
    Unauthorized:
      description: >-
        The `Authorization` header is missing or malformed, or the API token is
        invalid.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: Invalid developer token
    InternalError:
      description: >-
        Unexpected error. On endpoints that do not document a `400` for it, this
        is also returned when an ID in the URL is not a valid identifier.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: Internal server error. Please try again later.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'Your CamposCloud API token, sent as `Authorization: Bearer <token>`.'

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.