> ## Documentation Index
> Fetch the complete documentation index at: https://developers.openalex.org/llms.txt
> Use this file to discover all available pages before exploring further.

# OpenAlex CLI

> Download filtered subsets of OpenAlex data from the command line

The OpenAlex CLI is the official command-line tool for downloading data from OpenAlex. It handles parallel downloads, checkpointing, and rate limiting so you don't have to build that yourself.

```bash theme={"dark"}
pip install openalex-official
```

<Info>
  **Work in progress.** The CLI currently focuses on work metadata and content downloads. More features (CSV export, other entity types) are coming. [Follow development on GitHub](https://github.com/ourresearch/openalex-official).
</Info>

## Quick examples

**Download metadata for works on a topic:**

```bash theme={"dark"}
openalex download \
  --api-key YOUR_KEY \
  --output ./results \
  --filter "topics.id:T10325"
```

**Download metadata + PDFs:**

```bash theme={"dark"}
openalex download \
  --api-key YOUR_KEY \
  --output ./results \
  --filter "topics.id:T10325" \
  --content pdf
```

**Download metadata + PDFs + TEI XML:**

```bash theme={"dark"}
openalex download \
  --api-key YOUR_KEY \
  --output ./results \
  --filter "topics.id:T10325" \
  --content pdf,xml
```

**Download by DOI:**

```bash theme={"dark"}
openalex download \
  --api-key YOUR_KEY \
  --output ./results \
  --ids "10.1038/nature12373,10.1126/science.1234567"
```

**Pipe in a list of work IDs:**

```bash theme={"dark"}
cat work_ids.txt | openalex download \
  --api-key YOUR_KEY \
  --output ./results \
  --stdin
```

See [Full-text PDFs](/download/full-text-pdfs#option-2-openalex-cli-up-to-a-few-million-files) for more examples.

## Output format

Metadata is saved as JSON files alongside any content you requested:

```
output/
├── W2741809807.json     # metadata (always saved)
├── W2741809807.pdf      # content (if --content pdf)
├── W2741809807.tei.xml  # content (if --content xml)
└── W1234567890.json
```

## Why use the CLI?

Building a robust bulk downloader is harder than it looks. The CLI handles:

* **Metadata by default** — Every work gets a complete JSON file
* **Parallel downloads** — Up to 200 concurrent connections
* **Automatic checkpointing** — Resume interrupted downloads without re-downloading
* **Adaptive rate limiting** — Adjusts to API conditions automatically
* **DOI resolution** — Auto-detects DOIs and converts them to OpenAlex IDs
* **Progress tracking** — Real-time stats in your terminal

At full speed, you can download thousands of works per hour.

## Pricing

| Download type | Cost        |
| ------------- | ----------- |
| Metadata      | Free        |
| PDFs          | \$0.01 each |
| TEI XML       | \$0.01 each |

With a free API key (\$1/day), you can download unlimited metadata and about 100 content files per day.

Need more content? [Contact us](mailto:steve@ourresearch.org) about enterprise pricing for large-scale projects.

## Full documentation

For all options and advanced usage:

```bash theme={"dark"}
openalex download --help
```

See the [GitHub README](https://github.com/ourresearch/openalex-official) for complete documentation.
