> For the complete documentation index, see [llms.txt](https://docs.safetycli.com/safety-2/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.safetycli.com/safety-2/safety-2.x-basics/license-scanning.md).

# License Scanning

### Common Commands

To display the licenses in use, run the followng command instead of the usual "safety check" command used to perform vulnerability scans.

```
// safety license
```

&#x20;You can run the following command to get **help** and a full list of available options.&#x20;

```
// safety license --help
```

License checks require an API key, which you can include either using the "--key" argument or by setting an environment variable using the following command:

```
// SAFETY_API_KEY (export SAFETY_API_KEY=YOUR_KEY_HERE)
```

Running `safety license` will scan the current Python environment for all installed dependencies and report on their licenses.

Running `safety license -r requirements.txt` will report on the packages in the named requirements file.

### Output Options

The default output option is to the screen.&#x20;

If you wish to ingest or analyze the resulting license report data you can generate a JSON file from the report by adding the `--output json` argument, as in the example below:

```
// safety license -r requirements.txt --output json
```

Another output option is `--output bare` which will print the unique set of licenses that were present in the packages that were analyzed, as in the example below:

```
// safety license -r requirements.txt --output bare
```

<br>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.safetycli.com/safety-2/safety-2.x-basics/license-scanning.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
