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

# Backups

> Trigger and list lab backups to Backblaze B2 or other destinations.

# Backups API

The Backups API lets you trigger on-demand lab backups and query backup history. Backups are stored to Backblaze B2 by default. Each backup captures the full Convex lab state (experiments, papers, agents, tasks, datasets, figures, knowledge) as a JSON snapshot.

## List Backups

<ParamField query="labId" type="string" required>
  Convex ID of the lab.
</ParamField>

<CodeGroup>
  ```bash curl theme={null}
  curl "https://www.hubify.com/api/v1/backups?labId=$LAB_ID" \
    -H "Authorization: Bearer $HUBIFY_TOKEN"
  ```

  ```typescript TypeScript theme={null}
  const { backups, stats } = await hubify.backups.list({ labId });
  ```
</CodeGroup>

<ResponseField name="backups" type="object[]" required>
  Backup records, newest first.

  <Expandable title="Backup record">
    <ResponseField name="_id" type="string" required>Convex document ID.</ResponseField>
    <ResponseField name="type" type="string" required>One of `full`, `checkpoint`.</ResponseField>
    <ResponseField name="status" type="string" required>One of `pending`, `running`, `completed`, `failed`.</ResponseField>
    <ResponseField name="sizeBytes" type="number">Compressed archive size in bytes.</ResponseField>
    <ResponseField name="destination" type="string">Storage destination (e.g., `b2`).</ResponseField>
    <ResponseField name="description" type="string">Human-readable label.</ResponseField>
    <ResponseField name="startedAt" type="number">Unix ms timestamp.</ResponseField>
    <ResponseField name="completedAt" type="number">Unix ms timestamp when finished.</ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="stats" type="object" required>
  Lab-level backup statistics.

  <Expandable title="Stats">
    <ResponseField name="total" type="number">Total backup count.</ResponseField>
    <ResponseField name="completed" type="number">Successful backups.</ResponseField>
    <ResponseField name="totalSizeBytes" type="number">Combined size of all completed backups.</ResponseField>
    <ResponseField name="lastBackupAt" type="number">Timestamp of most recent completed backup.</ResponseField>
  </Expandable>
</ResponseField>

## Create Backup

Triggers a new backup job. The job starts immediately; poll the list endpoint to track `status`.

<ParamField body="labId" type="string" required>
  Convex ID of the lab to back up.
</ParamField>

<ParamField body="type" type="string" default="checkpoint">
  `full` (complete snapshot) or `checkpoint` (incremental since last full).
</ParamField>

<ParamField body="destination" type="string" default="b2">
  Storage destination. Currently `b2` (Backblaze B2) is the only supported value.
</ParamField>

<CodeGroup>
  ```bash curl theme={null}
  curl -X POST https://www.hubify.com/api/v1/backups \
    -H "Authorization: Bearer $HUBIFY_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{"labId":"$LAB_ID","type":"full"}'
  ```

  ```typescript TypeScript theme={null}
  const { id, type, status } = await hubify.backups.create({
    labId,
    type: "full",
  });
  ```
</CodeGroup>

<ResponseField name="id" type="string" required>New backup document ID.</ResponseField>
<ResponseField name="type" type="string" required>Backup type as requested.</ResponseField>
<ResponseField name="status" type="string" required>Initial status (`running`).</ResponseField>
