Keep Command Line Interface (keepcli)


keepcli is a command line tool used primarily for issuing search and aggregate queries. Additional verbs are added to the environment from time to time.

Tool Advisory

Please Note: Despite the availability of this tool it is still considered to be in development and does not undergo our normal test procedures. It should only be used as a supplementary tool and we will not provide any guarantees for bug fixings or feature improvements.


keepcli is installed as a .NET Core Global Tool from our NuGet repository, and runs on Windows, Mac and Linux (untested) environments. The .NET Core SDK must be installed prior to installing and running keepcli. Download the SDK for your specific operating system from

Confirm the .NET Core SDK is installed

dotnet --info

.NET Core SDK (reflecting any global.json):
 Version:   3.0.100-preview8-013656
 Commit:    8bf06ffc8d


dotnet tool install --global --add-source keepcli

If keepcli is already installed it can be updated with

dotnet tool update --global --add-source keepcli


keepcli stores credential information in the folder Feenics/KeepCli within the system folder identified using System.Environment.GetFolderPath(System.SpecialFolder.LocalApplicationData)(see MSDN docs). This folder’s location varies by operating environment. On MacOS the path will be ~/.local/share and on Windows the path will be %HOMEDRIVE%%HOMEPATH%\AppData\Local.

keepcli supports multiple configurations. Each configuration is stored as a unique file with .json extension inside the configuration folder. Use the -@ option to name a configuration. If missing default is assumed.

These configuration files are unencrypted, and only as secure as the workstation & user profile on which they reside

keepcli configure \
    -a \
    -i *yourinstance* -u *yourusername* \
    -p *yourpassword*

After setting the default configuration, try it out with the test verb.

keepcli test
Connected to *your instance commonName* (yourInstanceFQDN) on version


The first argument for keepcli must be one of the defined verb. Use the –help option to get a list of verb with descriptions for each verb.

keepcli --help
Copyright (C) 2019 KeepCli

  configure                Supply Configuration information to be saved to disk...
  test                     Test saved configuration
  list                     Test saved configuration
  get                      Get object by Key
  search                   Search
  command                  Command Mercury Readers
  aggregate                Execute an Aggregate Query
  getinfotemplate          Get object by Key
  message                  Send a message to a person
  renameFqdn               Rename an FQDN for an existing instance
  remove                   Remove saved configuration
  subscribe                Subscribe to events
  controller-changetype    Change the type of a Controller from Ep to Lp or Lp to Ep
  help                     Display more information on a specific command.
  version                  Display version information.

Use the –help option with a verb to get the set of options specific for that verb.

keepcli configure --help
KeepCli 1.0.32
Copyright (C) 2019 KeepCli

  -a, --ApiAddress        URL of the Keep Server to connect to.  For example for US customers
  -i, --Instance          The login name of the instance.  The same value that is supplied when logging in using the Windows, Web, or Mobile Clients
  -u, --Username          The user name to connect with.  May be proceeded with an different instance name in the system hierarchy
  -p, --Password          The password to be used for this user to connect.
  -r, --Replace           Update existing configuration with new values
  -c, --Copy              Copy this existing configuration
  -e, --EventPublisher    Url of the MQTT Event Publisher for this API Service
  -@, --Profile           (Default: default) Saved Profile Name
  --help                  Display this help screen.
  --version               Display version information.

Using KeepCli with cUrl

There are number of circumstances when making a cUrl call to the Keep by Feenics API is necessary as part of application development and testing. To make a curl call to the API, a valid access token is required. keepcli can be used to get an access_token as well as other necessary information.

INSTANCE=$(keepcli test -j)
BASEADDRESS=$(echo $INSTANCE | jq -r .BaseAddress)
TOKEN=$(echo $INSTANCE | jq -r .Token)

curl -s -H 'Accept: application/json' -H "Authorization: Bearer ${TOKEN}" ${BASEADDRESS}/api | jq '{Cn:.CommonName, Fqdn:.FullyQualifiedDomainName, Key:.Key}'

This script uses the -j option on the test verb to return a JSON value similar to:

  "CommonName": "feenicsdev Origo TEST",
  "FullyQualifiedDomainName": "feenicsdev",
  "BaseAddress": "",
  "Key": "5d6e6ebd22ac6900016d96b4",
  "Version": "",
  "Token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6IkFkbWluaXN0cmF0b3IiLCJzdWIiOiI1ZDZlNmVkYjIyYWM2OTAwMDE2ZDk2YmIiLCJpbnN0YW5jZSI6IjVkNmU2ZWJkMjJhYzY5MDAwMTZkOTZiNCIsIm5iZiI6MTU2NzUyMjM0NiwiZXhwIjoxNTY3NjA4NzQ2LCJpYXQiOjE1Njc1MjIzNDZ9.ChSSbhqq6gGJaIkT7KjnRzbGtk9l6WuM5UT34ZGneS8"

This JSON value is stored in the environment variable INSTANCE and from it the BASEADDRESS and TOKEN values are extracted using jq

the curl command in this case simply returns the InstanceInfo object for the logged in user

Search examples

The Keep by Feenics API offers a search facility leverages the MongoDB search syntax. For example to find the zero or more people with a given name (first name) of Ralph use:

keepcli search -s '{"GivenName":"Ralph"}' | jq .

This will return one more PersonInfo objects. Use jq to filter out only specific fields.

keepcli search -s '{"GivenName":"Ralph"}' | jq '{cn:.CommonName, cards:.CardAssignments}'

Subscribe to Events examples

The keepcli is able to subscribe to events in real time. Use the -t option to provide a template for the event output in human readable format. More typical use case is to transform the published event message into something more concise. Event subscription runs over a separate web socket from a separate service independent to the API Server. This service end point must be added to the configuration.

keepcli configure -r -e wss://

Once configured use the subscribe verb to establish a connection to the event publisher. The event messages produced are an extension to the EventMessageData. keepcli adds the property EventData to the message, which is the JSON rendering of the EventDataBsonBase64 string that is also included. The EventData property of the event message is free-form and it’s contents will vary depending on the event type. Use the -d option to change the duration of the subscription, or the -l to limit the total number of events reported. Also note that DateTime properties such as PublishedOn, and OccurredOn are returned as Unix Epoch (milliseconds since 1970-01-01). Also all DateTime values are UTC.


For example, the following command will subscribe to all events for a period of 1 hours (3600 seconds) and use jq to format the output to include only the PublishedOn date, MessageLong value, and all EventData.

keepcli subscribe -d 3600 | jq -c '{d:.PublishedOn."$date"| (. / 1000 | todate),m:.MessageLong,meta:.EventData}'
  "d": "2019-09-04T11:37:28Z",
  "m": "Login attempted by user System Administrator.  Outcome: Passed",
  "meta": {
    "Outcome": "Passed",
    "User": {
      "CommonName": "System Administrator"