Home/Documentation

CLI Tool

Manage your jsondb.cloud data from the terminal with the @jsondb-cloud/cli command-line tool.

Installation

npx @jsondb-cloud/cli

Authentication

The CLI authenticates using API keys. Log in once and your credentials are stored locally.

# Log in with your API key
jsondb login
# Enter: API key, namespace, base URL

# Check current config
jsondb whoami

# Log out
jsondb logout
info

Environment Variables

You can also set JSONDB_API_KEY, JSONDB_NAMESPACE, and JSONDB_BASE_URL as environment variables. Config is stored in ~/.config/jsondb/credentials.json.

Document Operations

List collections

jsondb collections

List documents in a collection

jsondb documents users

Get a document

jsondb get users/usr_abc123

Create a document

echo '{"name":"Alice","email":"[email protected]"}' | jsondb create users

Update a document (full replace)

echo '{"name":"Alice Smith","email":"[email protected]"}' | jsondb update users/usr_abc123

Patch a document (partial update)

echo '{"role":"admin"}' | jsondb patch users/usr_abc123

Delete a document

jsondb delete users/usr_abc123

Import & Export

Push (import from file)

jsondb push users.json --to users

Pull (export to file)

# Export to stdout
jsondb pull users

# Export to file
jsondb pull users -o users.json

# Export as CSV
jsondb pull users --format csv -o users.csv

Schema Management

Get collection schema

jsondb schema get users

Set schema from file

jsondb schema set users < schema.json

Remove schema

jsondb schema remove users

Command Reference

CommandDescription
jsondb loginAuthenticate with API key
jsondb logoutRemove stored credentials
jsondb whoamiShow current config
jsondb collectionsList collections in namespace
jsondb documents <coll>List documents in collection
jsondb get <coll/id>Read a document
jsondb create <coll>Create document from stdin/file
jsondb update <coll/id>Replace document
jsondb patch <coll/id>Partial update
jsondb delete <coll/id>Delete document
jsondb push <file> --to <coll>Import from file
jsondb pull <coll>Export to stdout/file
jsondb schema get <coll>Get collection schema
jsondb schema set <coll>Set schema from file/stdin
jsondb schema remove <coll>Remove schema