Export
Export knowledge as a JSON bundle, a ZIP of up to 500 items, or an asynchronous job for anything larger, and download and verify the archive.
Every export contains exactly what the token's owner may read, in the portable v2 format described in Export format. All of these need the export scope, and every one is recorded in the audit log.
Choose the right one#
| Operation | Best for |
|---|---|
POST /knowledge/export | A small JSON bundle. |
POST /knowledge/export/zip | A ZIP of selected items, synchronously, up to 500 items. Above that it returns 413. |
POST /knowledge/exports | Everything, or more than 500 items. Runs in the background. |
A ZIP, directly#
curl -s -X POST -H "Authorization: Bearer $TOKEN" -o breno-export.zip "$BRENO/knowledge/export/zip"With no list of ids, this exports your own knowledge, not the whole workspace.
An asynchronous export#
curl -s -X POST -H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
-d '{"scope":"personal"}' "$BRENO/knowledge/exports"scope is personal (what you created, the default) or workspace (everything you may read; it needs an Admin or Owner, otherwise 403). The response is 202 with the job:
| Field | Meaning |
|---|---|
id | The job's id. |
status | queued, running, completed, failed, expired or cancelled. |
item_count, bytes, sha256 | Filled in as it finishes. |
error | Why it failed, if it did. |
expires_at | When the archive stops being downloadable: seven days after it finishes. |
A caller may have three jobs running and ten a day.
Download it#
curl -s -H "Authorization: Bearer $TOKEN" -o export.zip "$BRENO/knowledge/exports/$JOB_ID/download"200streams the ZIP, with the archive's SHA-256 in theX-Export-SHA256header.409means the export has not finished, failed, or expired. A token cannot read the job's status, so poll the download: retry while it returns409, and stop if it keeps failing and start a new export.404means there is no such job, or it is not yours.
Verify#
unzip export.zip -d export && cd export && sha256sum -c checksums.sha256