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

# Start a database export

> Starts a fresh export of one of your databases and returns a signed
download URL straight away.

The export itself runs after this request returns, so the link is not
ready at the moment you receive it: it answers 503 while the export is
still being prepared, then serves the archive once it finishes. A
script can therefore request an export and poll that one link, without
asking for a status anywhere else. See the download endpoint for the
request that does this safely.




## OpenAPI

````yaml /openapi.yaml post /api/v1/dbs/{id}/export
openapi: 3.1.0
info:
  title: PivoCloud API
  version: 1.0.0
  description: >-
    Start an export of one of your databases and download the result, using a
    personal access token you create in the PivoCloud console.
servers:
  - url: https://api.pivocloud.com
    description: The PivoCloud API.
security:
  - personalAccessToken: []
paths:
  /api/v1/dbs/{id}/export:
    post:
      summary: Start a database export
      description: |
        Starts a fresh export of one of your databases and returns a signed
        download URL straight away.

        The export itself runs after this request returns, so the link is not
        ready at the moment you receive it: it answers 503 while the export is
        still being prepared, then serves the archive once it finishes. A
        script can therefore request an export and poll that one link, without
        asking for a status anywhere else. See the download endpoint for the
        request that does this safely.
      operationId: createExport
      parameters:
        - name: id
          in: path
          required: true
          description: The identifier of the database to export.
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: >-
            The export was accepted, and the response carries the download URL
            for it.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SignedExportResponse'
        '400':
          description: >-
            The database identifier in the path is not a valid identifier. The
            reply carries the code INVALID_REQUEST.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: >-
            No usable access token reached the API. Send a personal access token
            as a bearer token. The reply carries the code UNAUTHORIZED.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: >-
            No database with that identifier is available to you. A database
            that does not exist and a database that belongs to someone else
            answer in exactly the same way, on purpose, so this reply is not a
            sign that something is broken. The reply carries the code NOT_FOUND.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: >-
            Too many requests. The reply carries one of three codes, and they
            mean different things. A reply with the code cooldown_active means
            this database was exported recently, and the wait is the whole
            cooldown window. A reply with the code export_in_flight means an
            export is already running, the wait is short, and the right move is
            to poll the link the earlier request already returned rather than
            sit out a cooldown. A reply with the code RATE_LIMIT_EXCEEDED is the
            general limit on how often you may call the API at all, and is not
            about this database: it applies to every endpoint here, so any
            request can meet it. Read the wait from the Retry-After header
            rather than assuming one, and treat a code you do not recognise as a
            wait rather than as a failure.
          headers:
            Retry-After:
              description: >-
                How long to wait, in seconds, before asking again. This is the
                value to use, and it differs between the three codes above.
              schema:
                type: integer
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: >-
            Something went wrong on our side and the export was not started. The
            reply carries the code INTERNAL_ERROR.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    SignedExportResponse:
      type: object
      description: The reply to an export request. Both fields are always present.
      required:
        - url
        - expires_at
      properties:
        url:
          type: string
          format: uri
          description: >-
            The download link for this export, complete with its signature and
            expiry. Store it as it is and request it as it is.
        expires_at:
          type: string
          format: date-time
          description: >-
            The moment the download link stops working. Links are short-lived,
            minutes rather than days, so read this value rather than taking a
            horizon from any example you have seen. A link requested after this
            moment answers 401 with the code SIGNED_URL_EXPIRED, which is the
            link having lapsed rather than anything wrong with the request.
    ErrorResponse:
      type: object
      description: >-
        The reply to a request that did not succeed. Every field is always
        present. Read `code` in a script and show `error` to a person.
      required:
        - success
        - error
        - code
      properties:
        success:
          type: boolean
          description: Always false on this reply.
        error:
          type: string
          description: A short sentence describing what went wrong.
        code:
          type: string
          description: >-
            A short machine readable label for the reason, stable across wording
            changes. This is the field to branch on.
  securitySchemes:
    personalAccessToken:
      type: http
      scheme: bearer
      description: >-
        A personal access token. Create one in the API tokens section of your
        profile page in the PivoCloud console. The token is shown once, when you
        create it.

````