Inventory import & export
Use Inventory → Transfer to export inventory to JSON or import it into the same or another instance. API endpoints: GET /api/v1/inventory/export and POST /api/v1/inventory/import. The covered resources are listed below.
File format
One self-contained JSON document:
{
"version": "piping-inventory-v1",
"resources": {
"dcim.sites": [{ "name": "Berlin DC", "slug": "berlin-dc", "status": "active" }],
"dcim.devices": [
{
"name": "edge-01",
"site": "berlin-dc",
"role": "router",
"ip_addresses": ["192.0.2.10/24"],
"primary_ip": "192.0.2.10"
}
]
}
}
versionis alwayspiping-inventory-v1.resourcesmaps a resource key to an array of records. Keys missing from the file are left untouched on import.- Records reference each other by slug or name (a device names its site by slug), never by database id, so the file is portable across instances. An omitted
slugis derived from the name automatically. - The browser export downloads as
piping-inventory-export-<date>.json, pretty-printed.
Covered resources
| Key | Contents | Matched on import by |
|---|---|---|
dcim.regions | Top-level regions | slug |
dcim.site-groups | Top-level site groups | slug |
tenancy.tenants | Tenants | slug |
dcim.sites | Sites with region/tenant/group refs, addresses, coordinates | slug |
dcim.manufacturers | Manufacturers | slug |
dcim.device-types | Device models per manufacturer | manufacturer + slug |
dcim.device-roles | Roles incl. colour, VM flag, custom-field bag | slug |
dcim.devices | Devices with site, type, role, status, tenant, IPs, primary IP | name + site + tenant |
virtualization.virtual-machines | VMs with site, role, status, IPs | name + site |
extras.config-contexts | Config contexts: weight, active flag, role/site bindings, data | name |
secrets.variables | Secret metadata: key, masked/protected flags | id (UUID) |
secrets.store | Encrypted secret values | secret id |
tenancy.contacts | Contacts (name, email, phone) | name |
tenancy.contact-roles | Contact roles | slug |
tenancy.contact-assignments | Site-scoped assignments (object_type: "dcim.site") | site + contact + role |
automation.templates | Automation template definitions | name |
workspace.connection-target-layouts | Saved connection-target layouts | name |
Exporting
- Open Inventory → Transfer, Export tab.
- Click Generate Export. The browser downloads a full snapshot — all records of every resource above, with no filtering.
Export requires the read action on the inventory resource; import requires create — see Access control.
Importing
- On the Import tab, click Choose File and pick a
.jsonexport file. The file shape (version+resourcesarrays) is checked in the browser before anything is uploaded. - Tune the rule matrix. Each enabled resource has three independent flags:
| Flag | Effect |
|---|---|
Create (createMissing) | Insert records from the file that don't exist yet |
Update (updateExisting) | Overwrite existing records matched by the identity key above |
Delete (deleteMissing) | Remove existing records of that type that are absent from the file |
Defaults: Create and Update on, Delete off. Resources you uncheck get no rule and are left untouched (their records are still counted in the summary).
- Click Execute Import.
The whole import runs in a single database transaction: any validation error — a malformed record, a non-UUID secret id, invalid connection parameters in a config context — rolls back everything.
The response is a per-resource summary:
{ "counts": { "dcim.sites": 4, "dcim.devices": 32 }, "applied": true, "skipped": [] }
If no resource has any active rule, nothing is applied: applied is false and skipped lists the resource keys from the file.
Tip: Delete turns the file into the desired full state for that resource — anything not listed is removed. Leave it off unless the file is meant as a complete mirror, e.g. when promoting a curated inventory from staging to production.
Secrets in transfer files
secrets.variablescarries metadata only; the values travel insecrets.storeasenc:v1:AES-GCM envelopes. Plaintext secret values never leave the instance.- On import, an
encrypted_valuethat is already anenc:v1:envelope is stored as-is — restoring it on another instance requires the same cipher key (PIPING_SECRETS__CIPHER_KEY_B64). A plain string is encrypted at import time, so a hand-written seed file may contain plaintext values. - Secret records are matched by UUID and are never deleted by an import.
- Config-context data may embed inline secrets as
{"secret": true, "value": "..."}. On import they are extracted into managed secrets and replaced by a secret id inside the stored context. If a context references a secret id that has no value insecrets.store, the import fails with a validation error listing the missing ids. - Config contexts that define connection parameters under
piping.connectionsare validated against the connection-parameter schema during import — see Connection configuration.
Transfer vs. sync
Transfer imports or exports a file once. Use inventory sync for ongoing updates from an external source. Both write to the same inventory.
REST API
| Method | Path | Purpose | Permission |
|---|---|---|---|
GET | /api/v1/inventory/export | Download the full inventory snapshot | inventory read |
POST | /api/v1/inventory/import | Apply a snapshot with per-resource rules | inventory create |
Import request body:
{
"payload": { "version": "piping-inventory-v1", "resources": { "dcim.sites": [] } },
"rules": {
"dcim.sites": { "createMissing": true, "updateExisting": true, "deleteMissing": false }
}
}
The authoritative schemas live in the OpenAPI contract — see API reference.