Skip to content

Developers · Data

Importing Files

Last updated 1 November 2026

Import images and attachments with their records: the CLI uploads local files during a JSON import.

You can import images and attachments together with the records they belong to. The Insites CLI uploads each file from your computer to the instance's storage during the import and links it to the right record.

What you need

  • A table with file properties. In the import format, attachments fill attachment properties and images fill image properties.
  • The files on your disk, at paths the JSON file names.
  • insites-cli signed in to the environment you import into.

app/schema/car.yml

name: car
properties:
  - name: color
    type: string
  - name: car_document
    type: file
  - name: car_photo
    type: photo

Note

The schema marks file and photo as deprecated in favor of upload. The import format's attachments and images lists fill these two types.

Write the import file

data.json

{
  "models": [
    {
      "id": "1",
      "type_name": "car",
      "properties": { "color": "red" },
      "attachments": [
        { "name": "car_document", "url": "import_files/offer.pdf" }
      ],
      "images": [
        { "name": "car_photo", "url": "import_files/car.png" }
      ]
    }
  ]
}
KeyMeaning
idThe id in your source data. Stored as the external id, and used to link imported records
type_nameThe table the record belongs to
propertiesValues for the other properties. Every key must be a defined property
name in a file entryThe property the file goes in
url in a file entryThe path of the file on your disk

Run the import

insites-cli data import staging --path data.json

For each file, the CLI asks the instance for an upload slot and uploads the file. It then puts the stored file's address in place of the local path, and sends the import. If one file cannot be uploaded, the import stops and names that file. This is how insites-cli 6.4.1 behaves (lib/data/uploadFiles.js).

Common mistakes

  • Using --zip. File upload happens only for a JSON import; a zip is sent as it is.
  • A path that does not exist. The whole import stops with Could not upload and the path.
  • A property in properties that the table does not define.