Skip to content

Powered by Grav CMS + Helios Theme

Store export and restore

Exporting the whole store into one bundle, restoring a bundle into another store, and the history of both.

Everything behind Import & Export → Export, Restore from a bundle and History. Exporting needs kahunacart.export and restoring needs kahunacart.restore, and each set in a bundle also needs its own permission: the customers set needs kahunacart.customers.view, the orders set kahunacart.orders.view, and so on. See Export and restore.

List export sets

GET /api/v1/kahunacart/export/sets Permission kahunacart.export

List the parts of the store a bundle can carry (settings, customers, catalog, pictures, digital files, promotions, reviews, orders, store credit, and each add-on's own), grouped as the Export screen shows them, with how many rows each holds, the sets each depends on, the permission each needs, and whether this caller holds it. Also says whether this server can write a zip and seal secrets with a passphrase.

Export the store

POST /api/v1/kahunacart/exports Permission kahunacart.export

Queue an export of the store into one bundle (a zip) on the server. It runs in the background job queue a step at a time; read its progress with get_store_export. Give everything: true for every set the caller may export, or sets to name them. Hashed customer passwords go only with passwords: true. Credentials, tokens, webhook secrets and saved payment methods go only with secrets: true and a passphrase of at least eight characters, sealed in one encrypted file; without them the bundle holds none and the restore report lists what to enter again.

Parameters

Name Type Description
everything optional boolean Every set the caller may export.
sets optional array of string The set ids to export, from list_export_sets.
media optional boolean Include product and category picture files (default true).
files optional boolean Include digital product files (default true).
passwords optional boolean Include customers' hashed sign-in passwords (default false).
secrets optional boolean Include credentials and tokens, sealed with the passphrase (default false).
passphrase optional string The passphrase that seals the secrets; at least eight characters.
orders_from optional string Earliest order date to include, YYYY-MM-DD.
orders_to optional string Latest order date to include, YYYY-MM-DD.

Read a store export

GET /api/v1/kahunacart/exports/{id} Permission kahunacart.export

Read one export's progress, and once it has finished, its size, its sets with their row and file counts, whether secrets were sealed in it, what was not included, and when the bundle will be deleted from the server.

Parameters

Name Type Description
id required integer

Delete an export's bundle

DELETE /api/v1/kahunacart/exports/{id} Permission kahunacart.export

Delete an export's bundle from the server. The export's line in the history stays, saying who exported what and when.

Parameters

Name Type Description
id required integer

List bundles on the server

GET /api/v1/kahunacart/restores/bundles Permission kahunacart.restore

List the bundles in user/data/kahunacart/exports, newest first: this store's exports, uploaded bundles, and bundles copied into the folder by hand. Any of them can be inspected and restored by name.

Inspect a bundle

GET /api/v1/kahunacart/restores/bundles/{name} Permission kahunacart.restore

Read what a bundle on the server holds before restoring it: where it came from, the KahunaCart and add-on versions that wrote it, each set with its counts and whether it can be restored here (and which add-on to install when not), whether it carries sealed secrets, and whether a full restore is allowed into this store and why not.

Parameters

Name Type Description
name required string The bundle's file name, from list_store_bundles.

Delete a bundle from the server

DELETE /api/v1/kahunacart/restores/bundles/{name} Permission kahunacart.restore

Delete a bundle from user/data/kahunacart/exports by its file name.

Parameters

Name Type Description
name required string

Rehearse a restore

POST /api/v1/kahunacart/restores/dry-run Permission kahunacart.restore

Queue a rehearsal of restoring a bundle: the whole restore inside a transaction that is always rolled back, so it writes nothing. Read the report with get_store_restore. mode is merge (add to this store, never deleting anything) or full (only into a store with no orders and no customers). Give the passphrase to rehearse the secrets too.

Parameters

Name Type Description
bundle required string The bundle's file name on the server.
mode required string
One of: merge, full
sets optional array of string Restore only these sets; every restorable set when absent.
passphrase optional string The passphrase the bundle's secrets were sealed with.

Restore a bundle

POST /api/v1/kahunacart/restores Permission kahunacart.restore

Queue the restore of a bundle into this store. It runs in the background job queue a set at a time and sends nothing: no email, notification, webhook or payment provider call. Read its progress and report with get_store_restore. Run dry_run_store_restore first.

Parameters

Name Type Description
bundle required string The bundle's file name on the server.
mode required string
One of: merge, full
sets optional array of string Restore only these sets; every restorable set when absent.
passphrase optional string The passphrase the bundle's secrets were sealed with.

Read a restore

GET /api/v1/kahunacart/restores/{id} Permission kahunacart.restore

Read one restore or dry run: its progress, and once finished its report. The report has created, updated, skipped and failed per set, the sets that could not run and why, what to enter again, and when the store moved to a new address, a checklist for the old site with a redirects block for its site.yaml and each payment provider's new webhook address.

Parameters

Name Type Description
id required integer

List exports and restores

GET /api/v1/kahunacart/transfers Permission kahunacart.export or kahunacart.restore

The history of store exports and restores, newest first: who ran each, when, which sets, the mode, the bundle's size and how it went.

Parameters

Name Type Description
kind optional string
One of: export, restore
per_page optional integer At least 1.

Response

Answers {transfers}, newest first, without each run's report. The route takes either permission, so someone who can only restore still sees the history; the MCP tool list_store_transfers needs kahunacart.export.

Upload a store bundle

POST /api/v1/kahunacart/restores/uploads Permission kahunacart.restore

Store an uploaded bundle (multipart, field file) on the server and answer with what it holds, the same summary inspect_store_bundle gives. No tool, because it takes multipart.

Download a store bundle

GET /api/v1/kahunacart/exports/{id}/download Permission kahunacart.export

The bundle itself, streamed. This is the only way a bundle leaves the server. No tool, because it serves a file.

Download the catalog file

GET /api/v1/kahunacart/export/catalog.yaml Permission kahunacart.export and kahunacart.products.manage

The catalog file, the same one bin/plugin kahunacart export writes. This is Export… → Catalog file on Products. No tool, because it serves a file.

Download the products CSV

GET /api/v1/kahunacart/export/products.csv Permission kahunacart.export and kahunacart.products.manage

Every product with its default variant, in the CSV importer's own column names, so it imports back with nothing to map. No tool, because it serves a file.

Download the customers CSV

GET /api/v1/kahunacart/export/customers.csv Permission kahunacart.export and kahunacart.customers.view

Every customer, in the CSV importer's own column names, so it imports back with nothing to map. No tool, because it serves a file.

Exports, restores and dry runs are queued and run a step at a time in the job queue. The routes that start one answer at once with its history row, and the read routes give its progress and, once it is done, its report. A restore's report carries the old-site checklist when the bundle came from another address.

A passphrase is at least 8 characters. It crosses into the job encrypted with this store's own key and never appears on the history row. A dry run with sets left out covers every set in the bundle, and an empty list is refused with a 422.

The bundle download, the catalog file and the two CSVs answer with a file, and the upload takes multipart, so those five have no MCP tool.