---
title: "Prepare a backup download"
method: POST
path: "/api/projects/{projectName}/backups/{backupId}/download"
tags: ["backups"]
---

# Prepare a backup download

`POST /api/projects/{projectName}/backups/{backupId}/download`

## Request

- Base URL: `https://api.hostim.dev`
- URL: `https://api.hostim.dev/api/projects/{projectName}/backups/{backupId}/download`
- Auth: HTTP bearer

Creates a BackupDownload custom resource for the given restic snapshot. The operator materializes the file and fills in the pre-signed URL. Returns the existing download when one is already prepared, and 409 when two downloads are already being prepared.

## Path parameters

- `projectName` string, required
- `backupId` string, required

## Response `200`

The download already exists

- BackupDownload: A prepared download of one backed up database or volume.
  - `id` string, required: The restic short snapshot ID of the backup
  - `phase` string, required: Pending, Running, Succeeded or Failed
  - `fileName` string, required: The name of the prepared download file
  - `sizeBytes` integer: The size of the prepared download file
  - `url` string: The pre-signed download URL, valid until expiresAt
  - `expiresAt` string, date-time: When the download URL stops working
  - `error` string: The reason the download failed

## Other responses

- `201`: The download is being prepared
- `401`: User is not authorized
- `404`: Project or backup not found
- `409`: Two downloads are already being prepared
- `500`: Internal server error

---

[API](https://skmtc.dev/hostim/apis/hostim-api.md) · [All operations](https://skmtc.dev/hostim/apis/hostim-api/llms.txt) · [OpenAPI document](https://skmtc.dev/hostim/apis/hostim-api/revisions/37c35e1026a9?raw)
