> ## 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

> This endpoint lists the backups of a database.



## OpenAPI

````yaml GET /v1/databases/{databaseId}/backups
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:
    get:
      tags:
        - Databases
      description: >-
        Lists the backups of a database, newest first, and what is being done to
        it right now. For team databases the `canManageDatabaseBackup`
        permission is required.
      parameters:
        - name: databaseId
          in: path
          required: true
          description: ID of the database.
          schema:
            type: string
            pattern: ^[a-f0-9]{24}$
      responses:
        '200':
          description: The backups.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DatabaseBackupList'
        '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
        '500':
          $ref: '#/components/responses/InternalError'
components:
  schemas:
    DatabaseBackupList:
      type: object
      properties:
        backups:
          type: array
          items:
            $ref: '#/components/schemas/DatabaseBackup'
          description: The 50 newest, newest first.
        operation:
          type: object
          nullable: true
          description: >-
            What is being done to the database right now. While it runs,
            starting, stopping, restarting, changing the settings or credentials
            of, and deleting the database answer `409`.
          properties:
            kind:
              type: string
              enum:
                - backup
                - restore
            backupId:
              type: string
        limits:
          type: object
          properties:
            manualMax:
              type: integer
              example: 4
            dailyKept:
              type: integer
              example: 7
    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
    DatabaseBackup:
      type: object
      description: >-
        A copy of a database's data, made by the database engine itself
        (mysqldump, pg_dump, mongodump or Redis' RDB), gzipped, encrypted and
        kept off the server. For PostgreSQL, the backup holds the database
        created with it (`POSTGRES_DB`); other databases created inside the same
        instance are not included.
      properties:
        _id:
          type: string
          description: ID of the backup.
        databaseInstanceId:
          type: string
          description: ID of the database.
        type:
          type: string
          enum:
            - manual
            - automatic
          description: >-
            `manual` backups are made on request and kept until deleted (up to 4
            per database). `automatic` ones leave on their own.
        reason:
          type: string
          enum:
            - manual
            - daily
            - before-restore
          description: >-
            Why it exists: asked for, the daily one (the 7 newest are kept), or
            the copy taken right before a restore (the 2 newest are kept).
        status:
          type: string
          enum:
            - pending
            - running
            - done
            - failed
        engine:
          type: string
          enum:
            - mysql
            - postgresql
            - mongodb
            - redis
        sizeInBytes:
          type: integer
          nullable: true
          description: Size of the gzipped dump, which is what a download gives.
        sha256:
          type: string
          nullable: true
          description: SHA-256 of the gzipped dump.
        error:
          type: string
          nullable: true
          description: Why it failed, when `status` is `failed`.
        startedAt:
          type: string
          format: date-time
          nullable: true
        finishedAt:
          type: string
          format: date-time
          nullable: true
        restoredAt:
          type: string
          format: date-time
          nullable: true
          description: The last time it was restored into its database.
        restore:
          type: object
          nullable: true
          description: The last restore asked for from this backup.
          properties:
            status:
              type: string
              enum:
                - running
                - done
                - failed
            error:
              type: string
              nullable: true
            startedAt:
              type: string
              format: date-time
              nullable: true
            finishedAt:
              type: string
              format: date-time
              nullable: true
            errorCode:
              type: string
              nullable: true
              description: >-
                For example `RESTORE_SAFETY_FAILED`, `RESTORE_FAILED` or
                `RESTORE_START_FAILED` (the data was restored but the database
                did not start again).
        createdAt:
          type: string
          format: date-time
        errorCode:
          type: string
          nullable: true
          description: >-
            A stable code for `error`, such as `BACKUP_TOO_LARGE`,
            `DATABASE_NOT_RUNNING` or `BACKUP_TIMEOUT`.
        databaseName:
          type: string
          nullable: true
          description: >-
            The database's name when the backup was made (kept after the
            database is deleted).
  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.