mics CLI

The platform is built using an API first approach. You can manage nearly anything using our API. Unfortunately, some actions can require you to use a combination of different APIs, and you'll have to handle authentication for every request.

Using mediarithmics Command Line Interface, you can simplify some actions and you won't have to add authentication headers in every request.


The CLI for mediarithmics is distributed as an NPM package. To use it, install it globally using

npm install -g @mediarithmics-ps/mics-cli

You need access to mediarithmics private packages to run this command. Contact us if required.

Getting started

On a fresh install, any command will prompt you for your authentication token. You won't have to enter it anymore.

You can use a command like mics-cli config:list to trigger this prompt.

# Run this command on a fresh install
mics-cli config:list
# The prompt will ask you for MICS API Token
# Simply copy/paste it and press enter
# The token will be saved and your command will be executed
Please enter a value for authToken (MICS API token) : *******

Creating an alias

The invoke command is mics-cli. If you prefer something else because it's shorter or just before you want, you can use

# Creates an alias for the mics-cli invoke command
alias mics="mics-cli"

# From now, all mics-cli commands can be called with mics
mics config:list

Config commands

The mics CLI has a set of config commands. They are particularly useful to manage your authentication token.

Lists all your configuration variables.

mics-cli config:list

Get the value of a configuration variable

# mics-cli config:get <VARIABLE>
mics-cli config:get authToken

Set the value of a configuration variable

# mics-cli config:set <VARIABLE> <VALUE>
# Will prompt for the value if empty
mics-cli config:set authToken

Help command

Shows all available commands, and other useful information.

mics-cli help

Whoami command

Retrieves user information based on the authentication token

# The output can be very large, 
# you may want to save it to a file
mics-cli whoami > whoami.txt
GET /v1/connected_user
    "id": "<USER_ID>",
    "first_name": "<USER_FIRSTNAME>",
    "last_name": "<USER_LASTNAME>",
    "email": "<USER_EMAIL>",
    "locale": null,
    "workspaces": [
            "organisation_id": "<ORG_ID>",
            "customer_type": "ENTERPRISE",
            "organisation_name": "<ORG_NAME>",
            "administrator": false,
            "role": "CUSTOMER_ADMIN",
            "community_id": "<COMMUNITY_ID>",
            "administrator_id": null,
            "datamarts": [
                    "id": "<DATAMART_ID>",
                    "name": "<DATAMART_NAME>",
                    "organisation_id": "<ORG_ID>",
                    "token": "<TOKEN>",
                    "creation_date": 1582031749723,
                    "time_zone": "Europe/Paris",
                    "type": "DATAMART",
                    "datafarm": "<DATAFARM>",
                    "storage_model_version": "v201709",
                    "user_point_system_version": "v201901",
                    "region": "EUROPE",
                    "archived": false,
                    "audience_segment_metrics": [...]


Autocomplete installation instructions can be displayed based on your shell using the autocomplete command.

  $ mics-cli autocomplete [SHELL]

  SHELL  shell type

  -r, --refresh-cache  Refresh cache (ignores displaying instructions)

  $ mics-cli autocomplete
  $ mics-cli autocomplete bash
  $ mics-cli autocomplete zsh
  $ mics-cli autocomplete --refresh-cache

Last updated