Command Line Interface for Cortex
Repo cortexapps/cli, read from GitHub 1 min ago. cortexapps has not joined Take My Repo.
cortexapps/cli is a public repo on GitHub by cortexapps. Command Line Interface for Cortex. It declares the MIT license on GitHub. It is written mainly in Python, has 20 stars and last changed on 2026-11-17. Nobody has reviewed it on Take My Repo yet, which says nothing about its quality. Read from GitHub on 2026-11-22.
In the maintainer's words. Shown from GitHub; Take My Repo does not keep a copy.
pip install cortexapps-cli
Using a python virtual environment:
VENV_DIR=~/.venv/cortex python3 -m venv $VENV_DIR source $VENV_DIR/bin/activate pip install cortexapps-cli
brew tap cortexapps/tap brew install cortexapps-cli
docker run -e CORTEX_API_KEY=<your API key> cortexapp/cli <Cortex CLI arguments>
The CLI requires an API key for all operations. This key is stored in a config file whose default location is ~/.cortex/config. This path can be overridden with the -c flag. You will be prompted to create the file if it does not exist.
Minimal contents of the file:
[default] api_key = REPLACE_WITH_YOUR_CORTEX_API_KEY
If you have multiple Cortex instances, you can create a section for each, for example:
[default] api_key = REPLACE_WITH_YOUR_CORTEX_API_KEY [my-test] api_key = REPLACE_WITH_YOUR_CORTEX_API_KEY base_url = https://app.cortex.mycompany.com
NOTE: if not supplied, base_url defaults to https://api.getcortexapp.com.
The CLI will retrieve configuration data from the [default] section unless you pass the -t/--tenant flag.
For example, to list all entities in the my-test tenant, run the following command:
cortex -t my-test catalog list
If the config file does not exist, the CLI will prompt you to create it.
The CLI supports the following environment variables. If provided, the Cortex config file will not be read.
Example:
export CORTEX_API_KEY=<YOUR_API_KEY>
Run cortex to see a list of options and sub-commands.
Run cortex <subcommand> -h to see a list of all commands for each subcommand.
Almost all CLI responses return JSON or YAML. Tools like jq and yq will be helpful to extract content from these responses.
This example shows how to export from a tenant named myTenant-dev and import those contents into a tenant
named myTenant.
Your cortex config file will require api keys for both tenants. It would look like this:
[myTenant] api_key = <your API Key for myTenant> [myTenant-dev] api_key = <your API Key for myTenant-dev>
Export
cortex -t myTenant-dev backup exportGetting catalog --> my-domain-1 --> my-service-1 --> my-service-2 Getting entity-types --> my-entity-type-1 Getting ip-allowlist --> ip-allowlist Getting plugins --> my-plugin-1 Getting scorecards --> my-scorecard-1 Getting workflows --> my-workflow-1 Export complete! Contents available in /Users/myUser/.cortex/export/2025-06-12-14-58-14
Import
cortex -t myTenant backup import -d <directory created by export>
NOTE: some content will not be exported, including integration configurations and resources that are automatically imported by Cortex. Cortex does not have access to any keys, so it cannot export any integration configurations.
for domain in `cortex catalog list -t domain --csv -C tag --sort tag:asc`; do echo "domain = $domain"; done
NOTE: as of June 2025, requires a feature flag enabled to return team entities in the catalog API. Work with your CSM if you need assistance.
for team in `cortex catalog list -t team --csv -C tag --sort tag:asc`; do echo "team = $team"; done
for service in `cortex catalog list -t service --csv -C tag --sort tag:asc`; do echo "service = $service"; done
cortex catalog details -t my-service-1 | jq ".git"
{
"repository": "my-org/my-service-1",
"alias": null,
"basepath": null,
"provider": "github"
}
for service in `cortex catalog list -t service --csv -C tag --sort tag:asc`; do cortex catalog descriptor -y -t ${service} | yq '.info.x-cortex-tag |= . + "-suffix"' | cortex catalog create -f- done
This example combines several CLI commands:
x-cortex-tag is retrieved and modified to add "-suffix" to the endNOTE: Any cortex commands that accept a file as input can also receive input from stdin by specifying a "-" after the -f parameter.
for domain in `cortex catalog list -t domain | jq -r ".entities[].tag" | sort`; do cortex catalog descriptor -y -t ${domain} | yq -e '.info.x-cortex-groups += [ "my-new-group" ]' | cortex catalog create -f- done
for domain in `cortex catalog list -t domain --csv -C tag --sort tag:asc`; do cortex catalog descriptor -y -t ${domain} | yq -e '.info.x-cortex-groups -= [ "my-old-group" ]' | cortex catalog create -f- done
cortex catalog descriptor -y -t my-service | yq -e '.info.x-cortex-domain-parents += { "tag": "my-new-domain" }' | cortex catalog create -f-
cortex catalog descriptor -y -t my-service | yq -e '.info.x-cortex-owners += { "name": "my-org/my-team", "type": "GROUP", "provider": "GITHUB" }' | cortex catalog create -f-
for domain in `cortex catalog list -t domain --csv -C tag --sort tag:asc`; do cortex catalog descriptor -y -t ${domain} | yq ".info.x-cortex-git.github.basepath |= sub(\"-\", \"_\")" | cortex catalog create -f- done
This example fixes a typo in the deployment environment field, changing PYPI.org to PyPI.org.
It loops over each selected array element based on the search criteria, removes the uuid attribute (because that is not included in the payload), assigns the environment attribute to the correct value and invokes the CLI with that input.
cortex deploys list -t cli > /tmp/deploys.json for uuid in `cat /tmp/deploys.json | jq -r '.deployments[] | select(.environment=="PYPI.org") | .uuid'` do cat /tmp/deploys.json | jq ".deployments[] | select (.uuid==\"${uuid}\") | del(.uuid) | .environment = \"PyPI.org\"" | cortex deploys update-by-uuid -t cli -u ${uuid} -f- done
for tag in `cortex scorecards list --csv -C tag` do echo "backing up: ${tag}" cortex scorecards descriptor -t ${tag} > ${tag}.yaml done
This recipe creates a draft scorecard for all existing scorecards. It creates each scorecard with a suffix for the scorecard tag of "-draft" and it appends " Draft" to the end of the existing title.
for tag in `cortex scorecards list --csv -C tag` do cortex scorecards descriptor -t ${tag} | yq '.draft = true | .tag += "-draft" | .name += " Draft"' | cortex scorecards create -f- done
This recipe is a companion to the above recipe. This recipe will replace the versions from which the drafts were created and delete the drafts.
for tag in `cortex scorecards list --csv -C tag --filter tag=.*-draft` do cortex scorecards descriptor -t ${tag} | yq '.draft = false | .tag |= sub("-draft","") | .name |= sub(" Draft", "")' | cortex scorecards create -f- && cortex scorecards delete -t ${tag} done
This recipe is similar to the one above, but it does not create a new scorecard in Cortex. Rather, it makes the changes and saves to a file.
for tag in `cortex scorecards list --csv -C tag --filter tag=.*-draft` do cortex scorecards descriptor -t ${tag} | yq '.draft = false | .tag |= sub("-draft","") | .name |= sub(" Draft", "")' > ${tag}.yaml done
WARNING: This recipe will delete all draft scorecards.
for tag in `cortex scorecards list -s | jq -r ".scorecards[].tag"` do cortex scorecards delete -t ${tag} done
If you only want to delete some drafts, for example if you followed a recipe that creates draft versions of all existing scorecards, you will likely want to run this instead:
for tag in `cortex scorecards list -s | jq -r ".scorecards[].tag" | grep "\-draft$"` do cortex scorecards delete -t ${tag} done
This could be helpful for changing CQL rules (for example for CQL v1 -> CQL v2) and ensuring that scorecards produce the same results.
The following command get all scores for a scorecard, pipes the JSON output to jq and filters it to create a CSV file of the form:
service,score,ladderLevel
cortex scorecards scores -t myScorecard | jq -r '.serviceScores[] | [ .service.tag, .score.ladderLevels[].level.name // "noLevel", .score.summary.score|tostring] | join(",")' | sort > /tmp/scorecard-output.csv
Run this command for two different scorecards and diff the csv files to compare results
export SCORECARD=scorecard1 cortex scorecards scores -t ${SCORECARD} | jq -r '.serviceScores[] | [ .service.tag, .score.ladderLevels[].level.name // "noLevel", .score.summary.score|tostring] | join(",")' | sort > /tmp/${SCORECARD}.csv export SCORECARD=scorecard2 cortex scorecards scores -t ${SCORECARD} | jq -r '.serviceScores[] | [ .service.tag, .score.ladderLevels[].level.name // "noLevel", .score.summary.score|tostring] | join(",")' | sort > /tmp/${SCORECARD}.csv sdiff -s /tmp/scorecard1.csv /tmp/scorecard2.csv
This recipe adds the value of variable named provider to any owner for which type = GROUP and the provider field is not listed. This recipe can be used to address this issue from Cortex release notes:
Starting July 2nd (2024), any group type owners in the x-cortex-owners section of an entity descriptor will require a provider to be explicitly defined.
Adjust the value of provider accordingly. It must be one of the providers listed in our public docs.
This recipe does the following:
cortex queries parameter -f- indicates that the query input comes from stdin, provided by the here document (the content provided between the two 'EOF' delimiters).-x 600) for the query to complete.provider variable for any group owner where the provider is not defined in the entity.provider="GITHUB" query_output="query.json" cortex queries run -f- -w -x 600 > ${query_output} << EOF jq(entity.descriptor(), "[.info.\"x-cortex-owners\" | .[] | select(.type | ascii_downcase == \"group\") | select(.provider == null)] | length") > 0 EOF for entity in `cat ${query_output} | jq -r ".result[].tag"` do echo "entity = $entity" cortex catalog descriptor -y -t ${entity} | yq "with(.info.x-cortex-owners[]; select(.type | downcase == \"group\") | select(.provider == null) | .provider = \"${provider}\" )" | cortex catalog create -f- done
This recipe creates YAML files for each Workflow. This may be helpful if you are considering enabling GitOps for Workflows and you want to export current Workflows as a starting point.
for workflow in `cortex workflows list --csv --no-headers --columns tag` do echo "workflow = $workflow" cortex workflows get --tag $workflow --yaml > $workflow.yaml done
cortexapps/cli is a public repo on GitHub by cortexapps. Command Line Interface for Cortex.
It declares the MIT license on GitHub.
Its maker tagged it for macOS, Windows and Linux, or as Docker or cross-platform. That is declared by the maker; Take My Repo has not tested it.
Open "Take it" on its page: Take My Repo writes an install plan for your machine and hands it to your AI agent (Claude Code, Codex or Cursor), which asks you before each step. Take My Repo has not tested it on any machine.
Its last change on GitHub was on 2026-11-17. GitHub counts 29 open issues and pull requests. Take My Repo does not judge from that whether it is maintained.
Nobody has reviewed it on Take My Repo yet, which says nothing about its quality.
This page is also available as structured data, with the same sources and dates.
/api/v1/resources/gh/cortexapps/cliTake My Repo has not tested this on your machine. Requirements come from the project's own documentation.