# Vault ## `GET /api/vault` **List vault files** Lists every file stored in the vault, sorted by name. Needs the `X-Vault-Key` header. Answers 503 while the site has no vault key set. **Response `200` — Every stored file's name, size, sha256 and update time.** Model: {ref}`VaultFileList ` | Field | Type | Required | Description | |---|---|---|---| | `files` | array of {ref}`VaultFileInfo ` | yes | Every stored file, sorted by name. | ## `DELETE /api/vault/{name}` **Delete a vault file** Deletes one named file. Needs the `X-Vault-Key` header. Answers 404 for an unknown name, 503 while the site has no vault key set. **Parameters** | Name | In | Type | Required | Description | |---|---|---|---|---| | `name` | path | string | yes | The file's name. | **Response `204`** — The file was deleted. ## `GET /api/vault/{name}` **Get a vault file** Returns one named file's raw bytes (`application/octet-stream`), with an `ETag` of its sha256. Send `If-None-Match` with a previous `ETag` to get 304 when the file is unchanged. Needs the `X-Vault-Key` header. Answers 404 for an unknown name, 503 while the site has no vault key set. **Parameters** | Name | In | Type | Required | Description | |---|---|---|---|---| | `name` | path | string | yes | The file's name. | **Response `200` — The file's raw bytes, or 304 if unchanged since `If-None-Match`.** Type: string ## `PUT /api/vault/{name}` **Store a vault file** Replaces (or creates) one named file with opaque bytes (`application/octet-stream`), up to 16 MiB. Needs the `X-Vault-Key` header. `name` must match `^[a-z0-9][a-z0-9._-]{0,63}$`. An `If-Match` header with a sha256 fails the write with 412 unless it matches the stored file's current sha256 (or there is no stored file yet, when any `If-Match` 412s). Answers 503 while the site has no vault key set. **Parameters** | Name | In | Type | Required | Description | |---|---|---|---|---| | `name` | path | string | yes | The file's name. | **Response `200` — The stored file's name, size, sha256 and update time.** Model: {ref}`VaultFileInfo ` | Field | Type | Required | Description | |---|---|---|---| | `name` | string | yes | The file's name. | | `size` | integer | yes | The file's size in bytes. | | `sha256` | string | yes | The sha256 of the file's bytes, as 64 lowercase hex characters. | | `updated_at` | string (date-time) | yes | When the file was last stored. |