Skip to content

SpaceBay Exchange Format

SBX is the file that SpaceBay writes when you export a community and reads when you import one Since 1.2.0. This page describes format version 1.0. For the screens, see Import and export.

A file is a ZIP archive named *.sbx.zip, or the same content unpacked into a folder. It holds one manifest.json, the data as NDJSON files (one JSON object per line), and the media files. It is plain text and standard ZIP, so ordinary tools can read it.

manifest.json
README.txt
data/users.0001.ndjson
data/spaces.0001.ndjson
data/posts.0001.ndjson
data/pro.shops.0001.ndjson
media/55/<sha256>.jpg
EntryMeaning
manifest.jsonRequired. Describes the file.
README.txtA note for humans. Import never reads it.
data/<entity>.NNNN.ndjsonThe records of one entity, in numbered parts. A new part starts after 100,000 rows or 64 MB.
media/<aa>/<sha256>.<ext>A media file named by its SHA-256 hash. <aa> is the first two characters of the hash. The extension is jpg, png, gif or webp.

SpaceBay checks a ZIP against an allow-list of names. An unsafe name, a duplicate name or a symlink makes SpaceBay refuse the whole file. An entry that is not on the list is ignored and reported. Encrypted ZIPs, and compression methods other than store and deflate, are refused.

The manifest is a JSON object, at most 1 MB.

KeyMeaning
formatAlways spacebay-exchange.
format_versionThe version of the format, MAJOR.MINOR, for example 1.0.
requires_readerThe lowest reader version that can read the file.
export_id, created_atAn ID for this export and the time it was made.
generatorWhat wrote the file: plugin, version, db_version, extension_api, wp, php.
sourceThe site it came from: site_uid, home_url, portal_url, multisite, blog_id, locale, timezone.
scopetype (space, spaces, members or full), the spaces chosen and include.
optionsThe choices made at export: media, messages, secrets, password_hashes, social_links, structure_only.
modulesThe add-ons whose data is inside: a list of id, label, version.
entitiesOne entry per entity name, 500 at most. Each has module, schema, min_reader, introduced_in, personal and files, a list of path, rows, bytes and sha256.
mediaThe number of files and their total bytes.
notesFree notes from the exporter, such as items it skipped.
contains_secrets, contains_password_hashesFlags for the two things a careful person wants to know first.

Unknown manifest keys are ignored and listed in the preview. A shortened example from a test export:

{
"format": "spacebay-exchange",
"format_version": "1.0",
"requires_reader": "1.0",
"generator": { "plugin": "spacebay", "version": "1.2.0" }
}

Each line of a data file is one JSON object, UTF-8, no byte order mark, depth at most 16. A line is at most 4 MB; a longer line rejects the file. The number of lines in the parts of an entity must equal the rows in the manifest. A line that is empty, is not valid UTF-8, is not valid JSON or is not an object is skipped, and it still counts as a row.

Records refer to each other by the ID they had on the source site. On import, SpaceBay builds a map from those source IDs to the IDs it creates. People are matched by email address, and an account that already exists is never changed.

A space and a post (the post line is shortened; a real one has more date fields):

{"id":2,"type":"space","group":1,"title":"Garden","slug":"garden","description":"","privacy":"public","status":"published","position":0,"settings":{"icon":"leaf","color":"#2d7a3e"},"created_by":2,"created_at":"2026-11-08T11:30:23Z","updated_at":"2026-11-08T11:30:23Z"}
{"id":1,"space":2,"author":3,"type":"text","title":"Spring planting","slug":"spring-planting","message":"What do you plant first? #spring","status":"published","pinned":false,"featured":false,"topics":[1],"media":[1],"meta":[],"scheduled_at":null}

Times are ISO 8601 in UTC.

An entity is a kind of record. Its name starts with a lowercase letter and uses lowercase letters, digits and underscores, up to 31 characters. An entity that belongs to an add-on is written <module>.<name>, for example pro.shops.

ScopeEntities
space, spacesspaces, topics, posts, comments, reactions, events, rsvps, space_members, points, the users and profiles they need, media
membersusers, profiles, user_prefs, space_members, points, user_badges, media
fulleverything above plus settings, reports, redirects and, if chosen, private messages

With SpaceBay Pro 1.0.0, a full export also holds pro.profile_fields, pro.shops, pro.shop_products, pro.shop_placements and pro.settings.

A media record carries the owner, what it belongs to, the file path inside the archive, the SHA-256 hash, the MIME type, the size and the settings (such as width and height):

{"id":1,"owner":3,"object_type":"post","object":1,"file":"media/55/<sha256>.jpg","sha256":"<sha256>","mime":"image/jpeg","bytes":696,"settings":{"width":4,"height":4}}

A media file is at most 32 MB.

The format version has a major and a minor number.

  • A file with a newer major version, or a requires_reader above what the reader supports, is refused with the code sbx_format_too_new.
  • A file with a newer minor version is read, with the warning sbx_newer_minor.
  • A reader ignores fields it does not know.

Each entity has its own schema number, so a file can be partly readable. The preview shows one of these states for every entity:

StateMeaning
readThe schema is the same. Read as is.
upgradeThe file is older. SpaceBay upgrades the records while it reads them.
forwardThe file is newer, but the entity’s min_reader is not above this reader. Fields SpaceBay does not know are dropped.
unsafeThe entity’s min_reader is above this reader. A partial import skips the entity. A full import is refused and says which SpaceBay version is needed.
unknownThe add-on that owns the entity is not installed. The entity is left out with a warning. A full import needs your explicit confirmation.

Never written: password hashes, two-factor secrets, login history, notifications, and the Pro calls and signals.

Written only when the exporter chooses the secrets option: the IDs and secrets of social sign-in, the TURN user and credential, and any settings key that looks like a secret. The manifest then has contains_secrets set and the download name ends in -with-secrets. On import, secrets are applied only from a file that has them and only when the importer asks for it (import_secrets).

An entity marked personal in the manifest holds data about people. Email addresses are in the users records, so treat every export as personal data.

WhatLimit
Manifest1 MB, JSON depth 32
README.txt64 KB
One NDJSON line4 MB, JSON depth 16
One data part100,000 rows or 64 MB
Entries in the archive200,000
Compression ratio200 to 1 (entries under 64 KB are not checked)
One media file32 MB
Unpacked size8 GB by default
Entities in the manifest500
Import file upload2 GB by default, set with spacebay_import_max_bytes

An add-on registers its entities on the spacebay_exchange_register action, which receives the registry. The hooks spacebay_import_record, spacebay_import_finished and spacebay_exchange_replace_emptied let it change records, react to a finished import and empty its own tables in Replace mode. Each is listed in Hooks and filters.

The Import and export screen uses these routes under /wp-json/spacebay/v1/. All of them are internal: they serve the screen and may change, so build on the file format, not on them. The caller needs both the WordPress capability manage_options and the SpaceBay capability spacebay_manage. A job is an export or an import, and it does not run inside one request. The screen calls POST /transfers/{id}/step again and again, and WP-Cron and WP-CLI drive the same steps.

RoutePurpose
GET /transfersList jobs. Filters: kind, status, page, per_page.
POST /transfers/exportsStart an export. Takes scope (space, spaces, members, full or members_csv), space_ids (at most 500) and options.
POST /transfers/uploadsOpen an upload for an import file. Takes size, sha256 and name (must end in .zip).
PUT /transfers/uploads/{uid}?offset=Send one chunk of at most 5 MB as application/octet-stream.
POST /transfers/uploads/{uid}/finishClose the upload and check the file.
GET /transfers/{id}, DELETE /transfers/{id}Read a job, or cancel it.
POST /transfers/{id}/stepRun one step of the job.
POST /transfers/{id}/planStart the dry run of an import. Takes mode, choices and apply_settings. Owner only.
GET /transfers/{id}/previewRead the report of the dry run.
POST /transfers/{id}/runStart the import. Takes the plan_id of the dry run and the same mode and choices. Owner only.
POST /transfers/{id}/undoUndo a finished Merge or New import. Owner only.
GET /transfers/{id}/downloadDownload a finished export. Owner only.
GET /transfers/{id}/remapsThe IDs an import changed, as a CSV file.
GET /transfers/{id}/redirects, DELETE /transfers/{id}/redirectsList the redirects an import recorded, or remove them.
GET /movedAsk where an old address went. Open to anyone who can open the community. Takes route, such as posts/80.

Each route has its own rate limit, and the limits also count managers. See REST API for the other routes.