CipherStash Documentation

Importing Data into a Collection with Stash CLI

You can bulk-import records into a collection in your workspace using the stash import command. In order to successfully describe a collection, you must be logged in.


stash import <name> \
    --data <file>


The only argument is <name>, the name of the collection to describe. The collection must already exist with the given name within the workspace.


  • --data <file> (required) the name of the file which contains the record to be imported. The required format of a data file is described in the “Record File Format” section, below.


Import a couple of movies into the movies collection in the workspace:

$ cat movies.json
    "title": "Star Trek: The Motion Picture",
    "year": 1979,
    "runningTime": 132
    "title": "Star Trek II: The Wrath of Khan",
    "year": 1982,
    "runningTime": 113
    "title": "Star Trek III: The Search for Spock",
    "year": 1984,
    "runningTime": 105
$ stash import movies --data movies.json
Imported 3 records into the 'movies' collection.

Record File Format

The file which provides the record to import must contain valid JSON, being an array of objects, each of which is a single record. Each of the records must contain all the keys that are involved in the indexes for the collection. Any record which is missing a required key will not be imported, and a warning emitted to standard error.

Exit Status

The exit status will be 0 if any records were successfully imported. An exit status of 1 indicates a client-side failure, such as a missing option or a malformed input document. An exit status of 2 indicates a server-side failure, most likely because the collection does not exist, credentials were invalid, or the server was unavailable.

Whenever a non-zero exit status is returned, a helpful error message is printed to standard error.