Clokeep Clokeep Docs
Documentation API Reference
BackupsDownload a backup
Backups View as Markdown

Download a backup

The archive as stored. A backup on an S3 storage that is not encrypted answers 302 to a presigned URL on the storage, valid for 5 minutes by default: follow the redirect, and do not send your Clokeep token to the storage. Any other backup is streamed: send a Range header to resume, and the answer is 206 with that part, or 416 with no body when the range lies outside the archive. 403 while backup downloads are switched off for the client. 503 while the storage that holds the backup cannot be reached.

Get /api/v1/artifacts/{artifact}/download
curl 'https://app.clokeep.com/api/v1/artifacts/2291/download' \
  -H 'Authorization: Bearer YOUR_API_TOKEN' \
  -H 'Accept: application/octet-stream' \
  --fail \
  -o 'download.bin'
<?php

$ch = curl_init('https://app.clokeep.com/api/v1/artifacts/2291/download');

curl_setopt_array($ch, [
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer YOUR_API_TOKEN',
    'Accept: application/octet-stream',
  ],
]);

$response = curl_exec($ch);

$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);

if ($status >= 400) {
  throw new RuntimeException('Request failed with status '.$status);
}

file_put_contents('download.bin', $response);
import { writeFile } from "node:fs/promises";

const response = await fetch("https://app.clokeep.com/api/v1/artifacts/2291/download", {
  headers: {
    "Authorization": "Bearer YOUR_API_TOKEN",
    "Accept": "application/octet-stream",
  },
});

if (!response.ok) {
  throw new Error("Request failed with status " + response.status);
}

await writeFile("download.bin", Buffer.from(await response.arrayBuffer()));
import requests

response = requests.get(
    "https://app.clokeep.com/api/v1/artifacts/2291/download",
    headers={
        "Authorization": "Bearer YOUR_API_TOKEN",
        "Accept": "application/octet-stream",
    },
)

response.raise_for_status()

with open("download.bin", "wb") as file:
    file.write(response.content)

Binary body (application/octet-stream).

Binary body (application/octet-stream).

{
  "message": "Unauthenticated."
}
{
  "message": "Backup downloads are disabled."
}
{
  "message": "Artifact file not found in storage."
}
{
  "message": "The storage that held this backup was deleted."
}
{
  "message": "The storage that holds this backup can't be reached right now. Try again later."
}

Path Parameters

  • artifactintegerrequired

    The ID of the backup.

    Example: 2291

Response

200

The whole archive.

Binary body (application/octet-stream)

206

The part of the archive the Range header asked for.

Binary body (application/octet-stream)

302

An unencrypted backup on an S3 storage: Location is a presigned URL on the storage that serves the archive, valid for a few minutes. Follow it without your Clokeep token.

401

The request carries no valid token: the Authorization: Bearer header is missing, or its token is unknown, revoked or past its expiry date. Send a current personal access token.

  • messagestring

    Always Unauthenticated.

403

The token may not read this. The message says why: Your role does not permit this action. (its owner is not an Admin, Operator or Viewer in the client), This account is disabled., This token is not bound to a client you belong to., or Client suspended. While backup downloads are switched off for the client the message is Backup downloads are disabled.

  • messagestring

    What went wrong.

404

The backup, or its file in storage, was not found.

  • messagestring

    What went wrong.

410

The storage that held this backup was deleted.

  • messagestring

    What went wrong.

416

The Range header asks for bytes outside the archive. No body.

503

The storage that holds the backup cannot be reached right now. Try again later.

  • messagestring

    What went wrong.

Esc
↑↓to navigate↵to openEscto close